diff --git a/go.mod b/go.mod index 184abbc9..067c3b85 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/gruntwork-io/terratest v0.41.18 github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 - github.com/lacework/go-sdk v1.16.1-0.20230414081001-e281108dfe4b + github.com/lacework/go-sdk v1.17.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.2 golang.org/x/text v0.9.0 @@ -56,7 +56,7 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/klauspost/compress v1.15.11 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.18 // indirect github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect diff --git a/go.sum b/go.sum index 9089d0e8..bd6eca35 100644 --- a/go.sum +++ b/go.sum @@ -459,8 +459,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lacework/go-sdk v1.16.1-0.20230414081001-e281108dfe4b h1:t0kSqUK4b8+A2Zd0PjVzhJyNnOK8p+atsGr5eJPWWkw= -github.com/lacework/go-sdk v1.16.1-0.20230414081001-e281108dfe4b/go.mod h1:DnRA1Jdu5EqEG+ZPAdTm/tx+CaYrdpwU43Bu5+BlbbA= +github.com/lacework/go-sdk v1.17.0 h1:CNoLqlkkw5bsHu9Ze+b9CR1vIsrhBCkvC0K3JYF8nT4= +github.com/lacework/go-sdk v1.17.0/go.mod h1:BF+DjehjtVtBdY/VOIjO7/IK85hUkg7pgyLFzlD3PWw= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -472,8 +472,8 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= +github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 h1:ofNAzWCcyTALn2Zv40+8XitdzCgXY6e9qvXwN9W0YXg= github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo= diff --git a/vendor/github.com/lacework/go-sdk/api/api.go b/vendor/github.com/lacework/go-sdk/api/api.go index f0fba786..fbf9cc43 100644 --- a/vendor/github.com/lacework/go-sdk/api/api.go +++ b/vendor/github.com/lacework/go-sdk/api/api.go @@ -73,7 +73,8 @@ const ( apiV2PolicyExceptions = "v2/Exceptions?policyId=%s" apiV2PolicyExceptionsFromExceptionID = "v2/Exceptions/%s?policyId=%s" - apiV2InventorySearch = "v2/Inventory/search" + apiV2InventorySearch = "v2/Inventory/search" + apiV2InventoryScanCsp = "v2/Inventory/scan?csp=%s" apiV2ComplianceEvaluationsSearch = "v2/Configs/ComplianceEvaluations/search" diff --git a/vendor/github.com/lacework/go-sdk/api/client.go b/vendor/github.com/lacework/go-sdk/api/client.go index 1d5a1158..84c02200 100644 --- a/vendor/github.com/lacework/go-sdk/api/client.go +++ b/vendor/github.com/lacework/go-sdk/api/client.go @@ -32,7 +32,10 @@ import ( "go.uber.org/zap" ) -const defaultTimeout = 60 * time.Second +const ( + defaultTimeout = 60 * time.Second + defaultTLSTimeout = 63 * time.Second +) type Client struct { id string @@ -99,7 +102,8 @@ func NewClient(account string, opts ...Option) (*Client, error) { auth: &authConfig{ expiration: DefaultTokenExpiryTime, }, - c: &http.Client{Timeout: defaultTimeout}, + c: &http.Client{Timeout: defaultTimeout, + Transport: &http.Transport{TLSHandshakeTimeout: defaultTLSTimeout}}, } c.V2 = NewV2Endpoints(c) @@ -172,6 +176,14 @@ func WithTimeout(timeout time.Duration) Option { }) } +// WithTransport changes the default transport to increase TLSHandshakeTimeout +func WithTransport(transport *http.Transport) Option { + return clientFunc(func(c *Client) error { + c.c.Transport = transport + return nil + }) +} + // WithURL sets the base URL, this options is only available for test purposes func WithURL(baseURL string) Option { return clientFunc(func(c *Client) error { diff --git a/vendor/github.com/lacework/go-sdk/api/inventory.go b/vendor/github.com/lacework/go-sdk/api/inventory.go index 4a5d8c38..dd3b53cc 100644 --- a/vendor/github.com/lacework/go-sdk/api/inventory.go +++ b/vendor/github.com/lacework/go-sdk/api/inventory.go @@ -18,7 +18,10 @@ package api -import "time" +import ( + "fmt" + "time" +) type InventoryService struct { client *Client @@ -28,6 +31,8 @@ type inventoryType string type inventoryDataset string const AwsInventoryType inventoryType = "AWS" +const AzureInventoryType inventoryType = "Azure" +const GcpInventoryType inventoryType = "GCP" const AwsInventoryDataset inventoryDataset = "AwsCompliance" // Search expects the response and the search filters @@ -53,6 +58,13 @@ func (svc *InventoryService) Search(response interface{}, filters SearchableFilt return svc.client.RequestEncoderDecoder("POST", apiV2InventorySearch, filters, response) } +// Scan triggers a resource inventory scan +func (svc *InventoryService) Scan(cloud inventoryType) (response InventoryScanResponse, err error) { + url := fmt.Sprintf(apiV2InventoryScanCsp, cloud) + err = svc.client.RequestEncoderDecoder("POST", url, nil, &response) + return +} + type InventorySearch struct { SearchFilter Csp inventoryType `json:"csp"` @@ -70,3 +82,10 @@ func (i InventorySearch) SetStartTime(time *time.Time) { func (i InventorySearch) SetEndTime(time *time.Time) { i.TimeFilter.EndTime = time } + +type InventoryScanResponse struct { + Data struct { + Status string `json:"status"` + Details string `json:"details"` + } `json:"data"` +} diff --git a/vendor/github.com/lacework/go-sdk/api/version.go b/vendor/github.com/lacework/go-sdk/api/version.go index 87d419ae..09cc426b 100644 --- a/vendor/github.com/lacework/go-sdk/api/version.go +++ b/vendor/github.com/lacework/go-sdk/api/version.go @@ -1,5 +1,5 @@ // Code generated by: scripts/version_updater.sh -// File generated at: 20230407042013 +// File generated at: 20230421133259 // // <<< DO NOT EDIT >>> // @@ -7,4 +7,4 @@ package api // Version is the semver coming from the VERSION file -const Version = "1.16.1-dev" +const Version = "1.17.0" diff --git a/vendor/modules.txt b/vendor/modules.txt index b888f6ef..3c3a6ad1 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -279,7 +279,7 @@ github.com/klauspost/compress/internal/cpuinfo github.com/klauspost/compress/internal/snapref github.com/klauspost/compress/zstd github.com/klauspost/compress/zstd/internal/xxhash -# github.com/lacework/go-sdk v1.16.1-0.20230414081001-e281108dfe4b +# github.com/lacework/go-sdk v1.17.0 ## explicit; go 1.18 github.com/lacework/go-sdk/api github.com/lacework/go-sdk/internal/array @@ -293,7 +293,7 @@ github.com/lacework/go-sdk/lwtime # github.com/mattn/go-colorable v0.1.13 ## explicit; go 1.15 github.com/mattn/go-colorable -# github.com/mattn/go-isatty v0.0.17 +# github.com/mattn/go-isatty v0.0.18 ## explicit; go 1.15 github.com/mattn/go-isatty # github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326