diff --git a/examples/resource_lacework_resource_group/main.tf b/examples/resource_lacework_resource_group/main.tf index aa96d14b..5b71c535 100644 --- a/examples/resource_lacework_resource_group/main.tf +++ b/examples/resource_lacework_resource_group/main.tf @@ -8,53 +8,25 @@ terraform { provider "lacework" {} -resource "lacework_resource_group" "example" { - type = "AWS" - name = var.resource_group_name - description = var.description - - group { - operator = "AND" - filter { - filter_name = "filter1" - field = "Region" - operation = "EQUALS" - value = ["us-east-1"] - } - - filter { - filter_name = "filter2" - field = "Region" - operation = "EQUALS" - value = ["us-west-2"] - } - +resource "lacework_resource_group" "team" { + name = var.resource_group_name + description = var.description + type = "AWS" group { - operator = "AND" - - filter { - filter_name = "filter5" - field = "Region" - operation = "EQUALS" - value = ["us-central-1"] - } - - group { - operator = "OR" + operator = "AND" filter { - filter_name = "filter3" - field = "Account" - operation = "EQUALS" - value = ["987654321"] + filter_name = "account" + field = "Account" + operation = "EQUALS" + value = ["248375806489"] } filter { - filter_name = "filter4" - field = "Account" - operation = "EQUALS" - value = ["123456789"] + filter_name = "team_tag" + field = "Resource Tag" + operation = "EQUALS" + value = ["MYTEAM"] + key = "TEAM" } - } } - } } diff --git a/lacework/resource_lacework_resource_group.go b/lacework/resource_lacework_resource_group.go index 909a8b98..e7c90d9e 100644 --- a/lacework/resource_lacework_resource_group.go +++ b/lacework/resource_lacework_resource_group.go @@ -243,7 +243,7 @@ func resourceLaceworkResourceGroupCreate(d *schema.ResourceData, meta interface{ populateRgQuery(d.Get("group").(*schema.Set), &rgQuery, true) - data := api.NewResourceGroupWithQuery(d.Get("name").(string), + data := api.NewResourceGroup(d.Get("name").(string), groupType, d.Get("description").(string), &rgQuery) @@ -260,7 +260,7 @@ func resourceLaceworkResourceGroupCreate(d *schema.ResourceData, meta interface{ } d.SetId(response.Data.ResourceGroupGuid) - d.Set("name", response.Data.NameV2) + d.Set("name", response.Data.Name) d.Set("enabled", response.Data.Enabled == 1) d.Set("query", response.Data.Query) d.Set("description", response.Data.Description) @@ -289,7 +289,7 @@ func resourceLaceworkResourceGroupRead(d *schema.ResourceData, meta interface{}) } d.SetId(response.Data.ResourceGroupGuid) - d.Set("name", response.Data.NameV2) + d.Set("name", response.Data.Name) d.Set("enabled", response.Data.Enabled == 1) d.Set("query", response.Data.Query) d.Set("description", response.Data.Description) @@ -318,7 +318,7 @@ func resourceLaceworkResourceGroupUpdate(d *schema.ResourceData, meta interface{ populateRgQuery(d.Get("group").(*schema.Set), &rgQuery, true) - data := api.NewResourceGroupWithQuery(d.Get("name").(string), + data := api.NewResourceGroup(d.Get("name").(string), groupType, d.Get("description").(string), &rgQuery) @@ -336,8 +336,8 @@ func resourceLaceworkResourceGroupUpdate(d *schema.ResourceData, meta interface{ return err } - d.SetId(response.Data.ResourceGuid) - d.Set("name", response.Data.NameV2) + d.SetId(response.Data.ResourceGroupGuid) + d.Set("name", response.Data.Name) d.Set("enabled", response.Data.Enabled == 1) d.Set("query", response.Data.Query) d.Set("description", response.Data.Description) @@ -346,7 +346,7 @@ func resourceLaceworkResourceGroupUpdate(d *schema.ResourceData, meta interface{ d.Set("type", response.Data.Type) log.Printf("[INFO] Updated %s Resource Group with guid %s\n", - data.Type, response.Data.ResourceGuid) + data.Type, response.Data.ResourceGroupGuid) return nil } diff --git a/vendor/github.com/lacework/go-sdk/api/_templates/resource_groups/kubernetes.json b/vendor/github.com/lacework/go-sdk/api/_templates/resource_groups/kubernetes.json new file mode 100644 index 00000000..a91d047c --- /dev/null +++ b/vendor/github.com/lacework/go-sdk/api/_templates/resource_groups/kubernetes.json @@ -0,0 +1,49 @@ +{ + "filters": { + "filter1": { + "field": "AWS Account", + "operation": "EQUALS", + "values": [ + "123456789012" + ] + }, + "filter2": { + "field": "AWS Region", + "operation": "EQUALS", + "values": [ + "us-west-2" + ] + }, + "filter3": { + "field": "Cluster Name", + "operation": "EQUALS", + "values": [ + "*" + ] + }, + "filter4": { + "field": "Namespace", + "operation": "EQUALS", + "values": [ + "prod" + ] + } + }, + "expression": { + "operator": "OR", + "children": [ + { + "filterName": "filter1" + }, + { + "filterName": "filter2" + }, + { + "filterName": "filter3" + }, + { + "filterName": "filter4" + } + ] + } +} \ No newline at end of file diff --git a/vendor/github.com/lacework/go-sdk/api/client.go b/vendor/github.com/lacework/go-sdk/api/client.go index 95fa7a35..37d41b66 100644 --- a/vendor/github.com/lacework/go-sdk/api/client.go +++ b/vendor/github.com/lacework/go-sdk/api/client.go @@ -36,8 +36,8 @@ import ( ) const ( - defaultTimeout = 60 * time.Second - defaultTLSTimeout = 63 * time.Second + defaultTimeout = 120 * time.Second + defaultTLSTimeout = 123 * time.Second ) type Client struct { diff --git a/vendor/github.com/lacework/go-sdk/api/component_data.go b/vendor/github.com/lacework/go-sdk/api/component_data.go index 6ceb1515..b434d69e 100644 --- a/vendor/github.com/lacework/go-sdk/api/component_data.go +++ b/vendor/github.com/lacework/go-sdk/api/component_data.go @@ -17,8 +17,9 @@ type ComponentDataService struct { const URL_TYPE_DEFAULT = "Default" const URL_TYPE_SAST_TABLES = "SastTables" +const URL_TYPE_PROSAST = "ProSast" -var URL_TYPES = []string{URL_TYPE_DEFAULT, URL_TYPE_SAST_TABLES} +var URL_TYPES = []string{URL_TYPE_DEFAULT, URL_TYPE_SAST_TABLES, URL_TYPE_PROSAST} type ComponentDataInitialRequest struct { Name string `json:"name"` @@ -70,6 +71,10 @@ func (svc *ComponentDataService) UploadSastTables( return svc.doUploadFiles(name, []string{"sast"}, paths, URL_TYPE_SAST_TABLES) } +func (svc *ComponentDataService) UploadProSast(name string, paths []string) (string, error) { + return svc.doUploadFiles(name, []string{"sast"}, paths, URL_TYPE_PROSAST) +} + func (svc *ComponentDataService) doUploadFiles( name string, tags []string, paths []string, urlType string) (string, error) { var hasValidType = false diff --git a/vendor/github.com/lacework/go-sdk/api/feature_flags.go b/vendor/github.com/lacework/go-sdk/api/feature_flags.go index 22f34138..8fa897c6 100644 --- a/vendor/github.com/lacework/go-sdk/api/feature_flags.go +++ b/vendor/github.com/lacework/go-sdk/api/feature_flags.go @@ -4,8 +4,6 @@ import ( "fmt" ) -const ApiV2CliFeatureFlag = "PUBLIC.rgv2.cli" - type FeatureFlagsService struct { client *Client } diff --git a/vendor/github.com/lacework/go-sdk/api/lql.go b/vendor/github.com/lacework/go-sdk/api/lql.go index e30caa5a..ae476d4d 100644 --- a/vendor/github.com/lacework/go-sdk/api/lql.go +++ b/vendor/github.com/lacework/go-sdk/api/lql.go @@ -29,9 +29,8 @@ import ( ) type NewQuery struct { - QueryID string `json:"queryId" yaml:"queryId"` - QueryLanguage *string `json:"queryLanguage,omitempty" yaml:"queryLanguage,omitempty"` - QueryText string `json:"queryText" yaml:"queryText"` + QueryID string `json:"queryId" yaml:"queryId"` + QueryText string `json:"queryText" yaml:"queryText"` } func ParseNewQuery(s string) (NewQuery, error) { @@ -50,7 +49,6 @@ func ParseNewQuery(s string) (NewQuery, error) { if err == nil && !reflect.DeepEqual(query, NewQuery{}) { // empty string unmarshals w/o error return query, nil } - // invalid query return query, errors.New("unable to parse query") } @@ -61,7 +59,6 @@ type UpdateQuery struct { type Query struct { QueryID string `json:"queryId" yaml:"queryId"` - QueryLanguage *string `json:"queryLanguage,omitempty" yaml:"queryLanguage,omitempty"` QueryText string `json:"queryText" yaml:"queryText"` Owner string `json:"owner"` LastUpdateTime string `json:"lastUpdateTime"` @@ -134,12 +131,3 @@ func (svc *QueryService) Get(id string) ( ) return } - -func (svc *QueryService) RegoQueryEnabled() bool { - response, err := svc.client.V2.FeatureFlags.GetFeatureFlagsMatchingPrefix("PUBLIC.lpp_rego_enabled") - if err != nil { - return false - } - - return len(response.Data.Flags) >= 1 -} diff --git a/vendor/github.com/lacework/go-sdk/api/lql_validate.go b/vendor/github.com/lacework/go-sdk/api/lql_validate.go index 1857ff52..1349242b 100644 --- a/vendor/github.com/lacework/go-sdk/api/lql_validate.go +++ b/vendor/github.com/lacework/go-sdk/api/lql_validate.go @@ -19,8 +19,7 @@ package api type ValidateQuery struct { - QueryText string `json:"queryText"` - QueryLanguage *string `json:"queryLanguage,omitempty" yaml:"queryLanguage,omitempty"` + QueryText string `json:"queryText"` } func (svc *QueryService) Validate(vq ValidateQuery) ( diff --git a/vendor/github.com/lacework/go-sdk/api/policy.go b/vendor/github.com/lacework/go-sdk/api/policy.go index 0450e51c..e5a83233 100644 --- a/vendor/github.com/lacework/go-sdk/api/policy.go +++ b/vendor/github.com/lacework/go-sdk/api/policy.go @@ -25,10 +25,9 @@ import ( "reflect" "time" + "github.com/lacework/go-sdk/internal/array" "github.com/pkg/errors" "gopkg.in/yaml.v3" - - "github.com/lacework/go-sdk/internal/array" ) // PolicyService is a service that interacts with the Custom Policies @@ -177,7 +176,6 @@ type Policy struct { PolicyID string `json:"policyId" yaml:"policyId"` PolicyType string `json:"policyType" yaml:"-"` QueryID string `json:"queryId" yaml:"queryId"` - QueryLanguage *string `json:"queryLanguage,omitempty" yaml:"queryLanguage,omitempty"` Title string `json:"title" yaml:"title"` Enabled bool `json:"enabled" yaml:"enabled"` Description string `json:"description" yaml:"description"` diff --git a/vendor/github.com/lacework/go-sdk/api/resource_groups.go b/vendor/github.com/lacework/go-sdk/api/resource_groups.go index 17084323..35b15aa9 100644 --- a/vendor/github.com/lacework/go-sdk/api/resource_groups.go +++ b/vendor/github.com/lacework/go-sdk/api/resource_groups.go @@ -22,37 +22,11 @@ import ( _ "embed" "encoding/json" "fmt" - "strconv" "time" - "github.com/lacework/go-sdk/lwtime" "github.com/pkg/errors" ) -// ResourceGroupsService is the service that interacts with -// the ResourceGroups schema from the Lacework APIv2 Server -type ResourceGroupsService struct { - client *Client -} - -type ResourceGroupProps interface { - GetBaseProps() ResourceGroupPropsBase -} - -type ResourceGroupPropsBase struct { - Description string `json:"description"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated *lwtime.Epoch `json:"lastUpdated,omitempty"` -} - -type ResourceGroup interface { - ID() string - ResourceGroupType() resourceGroupType - ResetResourceGUID() - ResetRGV2Fields() - IsV2Group() bool -} - type resourceGroupType int const ( @@ -63,11 +37,8 @@ const ( ContainerResourceGroup GcpResourceGroup MachineResourceGroup - - // requires Org Access account client.WithOrgAccess() - LwAccountResourceGroup - OciResourceGroup + KubernetesResourceGroup ) // query templates @@ -82,10 +53,11 @@ var ( //go:embed _templates/resource_groups/gcp.json GcpResourceGroupQueryTemplate string //go:embed _templates/resource_groups/machine.json - MachineResourceGroupQueryTemplate string - LwAccountResourceGroupQueryTemplate string = "" + MachineResourceGroupQueryTemplate string //go:embed _templates/resource_groups/oci.json OciResourceGroupQueryTemplate string + //go:embed _templates/resource_groups/kubernetes.json + KubernetesResourceGroupQueryTemplate string ) type resourceGroupContext struct { @@ -95,53 +67,37 @@ type resourceGroupContext struct { // ResourceGroupTypes is the list of available Resource Group types var ResourceGroupTypes = map[resourceGroupType]resourceGroupContext{ - NoneResourceGroup: {resourceGroupType: "None", queryTemplate: NoneResourceGroupQueryTemplate}, - AwsResourceGroup: {resourceGroupType: "AWS", queryTemplate: AwsResourceGroupQueryTemplate}, - AzureResourceGroup: {resourceGroupType: "AZURE", queryTemplate: AzureResourceGroupQueryTemplate}, - ContainerResourceGroup: {resourceGroupType: "CONTAINER", queryTemplate: ContainerResourceGroupQueryTemplate}, - GcpResourceGroup: {resourceGroupType: "GCP", queryTemplate: GcpResourceGroupQueryTemplate}, - LwAccountResourceGroup: {resourceGroupType: "LW_ACCOUNT", queryTemplate: LwAccountResourceGroupQueryTemplate}, - MachineResourceGroup: {resourceGroupType: "MACHINE", queryTemplate: MachineResourceGroupQueryTemplate}, - OciResourceGroup: {resourceGroupType: "OCI", queryTemplate: OciResourceGroupQueryTemplate}, -} - -// String returns the string representation of a Resource Group type -func (i resourceGroupType) String() string { - return ResourceGroupTypes[i].resourceGroupType -} - -// QueryTemplate returns the resource group type's query template -func (i resourceGroupType) QueryTemplate() string { - return ResourceGroupTypes[i].queryTemplate + NoneResourceGroup: {resourceGroupType: "None", queryTemplate: NoneResourceGroupQueryTemplate}, + AwsResourceGroup: {resourceGroupType: "AWS", queryTemplate: AwsResourceGroupQueryTemplate}, + AzureResourceGroup: {resourceGroupType: "AZURE", queryTemplate: AzureResourceGroupQueryTemplate}, + ContainerResourceGroup: {resourceGroupType: "CONTAINER", queryTemplate: ContainerResourceGroupQueryTemplate}, + GcpResourceGroup: {resourceGroupType: "GCP", queryTemplate: GcpResourceGroupQueryTemplate}, + MachineResourceGroup: {resourceGroupType: "MACHINE", queryTemplate: MachineResourceGroupQueryTemplate}, + OciResourceGroup: {resourceGroupType: "OCI", queryTemplate: OciResourceGroupQueryTemplate}, + KubernetesResourceGroup: {resourceGroupType: "KUBERNETES", queryTemplate: KubernetesResourceGroupQueryTemplate}, } -// FindResourceGroupType looks up inside the list of available resource group types -// the matching type from the provided string, if none, returns NoneResourceGroup -func FindResourceGroupType(typ string) (resourceGroupType, bool) { - for i, ctx := range ResourceGroupTypes { - if typ == ctx.resourceGroupType { - return i, true - } +func NewResourceGroup(name string, iType resourceGroupType, + description string, query *RGQuery) ResourceGroupData { + return ResourceGroupData{ + Name: name, + Type: iType.String(), + Enabled: 1, + Query: query, + Description: description, } - return NoneResourceGroup, false } -// List returns a list of Resource Groups func (svc *ResourceGroupsService) List() (response ResourceGroupsResponse, err error) { - var rawResponse resourceGroupsWorkaroundResponse + var rawResponse ResourceGroupsResponse err = svc.client.RequestDecoder("GET", apiV2ResourceGroups, nil, &rawResponse) if err != nil { - return - } - response, err = setResourceGroupsResponse(rawResponse) - if err != nil { - return + return rawResponse, err } - return + return rawResponse, nil } -// Create creates a single Resource Group func (svc *ResourceGroupsService) Create(group ResourceGroupData) ( response ResourceGroupResponse, err error, @@ -150,8 +106,7 @@ func (svc *ResourceGroupsService) Create(group ResourceGroupData) ( return } -// Update updates a single ResourceGroup on the Lacework Server -func (svc *ResourceGroupsService) Update(data ResourceGroup) ( +func (svc *ResourceGroupsService) Update(data *ResourceGroupData) ( response ResourceGroupResponse, err error, ) { @@ -170,49 +125,15 @@ func (svc *ResourceGroupsService) Update(data ResourceGroup) ( return } -func castResourceGroupResponse(data resourceGroupWorkaroundData, response interface{}) error { - isDefault, err := strconv.Atoi(data.IsDefault) - if err != nil { - return err - } - group := ResourceGroupResponse{ - Data: ResourceGroupData{ - Guid: data.Guid, - IsDefault: isDefault, - ResourceGuid: data.ResourceGuid, - Name: data.Name, - Type: data.Type, - Enabled: data.Enabled, - Props: data.Props, - }, - } - - j, err := json.Marshal(group) - if err != nil { - return err - } - - err = json.Unmarshal(j, &response) - if err != nil { - return err - } - return nil -} - -func setResourceGroupsResponse(workaround resourceGroupsWorkaroundResponse) (ResourceGroupsResponse, error) { - var data []ResourceGroupData - for _, r := range workaround.Data { - group, err := setResourceGroupResponse(r) - if err != nil { - return ResourceGroupsResponse{}, err - } - data = append(data, group.Data) - } - - return ResourceGroupsResponse{Data: data}, nil +func (group *ResourceGroupData) ResetResourceGUID() { + group.ResourceGroupGuid = "" + group.UpdatedBy = "" + group.UpdatedTime = nil + group.CreatedBy = "" + group.CreatedTime = nil + group.IsDefaultBoolean = nil } -// Delete deletes a Resource Group that matches the provided resource guid func (svc *ResourceGroupsService) Delete(guid string) error { if guid == "" { return errors.New("specify a resourceGuid") @@ -226,22 +147,23 @@ func (svc *ResourceGroupsService) Delete(guid string) error { ) } -// Get returns a raw response of the Resource Group with the matching resource guid. -// -// To return a more specific Go struct of a Resource Group, use the proper -// method such as GetContainerResourceGroup() where the function name is composed by: -// -// Get(guid) -// -// Where is the Resource Group type. func (svc *ResourceGroupsService) Get(guid string, response interface{}) error { - var rawResponse resourceGroupWorkaroundResponse + var rawResponse ResourceGroupResponse err := svc.get(guid, &rawResponse) if err != nil { return err } - return castResourceGroupResponse(rawResponse.Data, &response) + j, err := json.Marshal(rawResponse) + if err != nil { + return err + } + + err = json.Unmarshal(j, &response) + if err != nil { + return err + } + return nil } func (svc *ResourceGroupsService) create(data interface{}, response interface{}) error { @@ -250,7 +172,7 @@ func (svc *ResourceGroupsService) create(data interface{}, response interface{}) func (svc *ResourceGroupsService) get(guid string, response interface{}) error { if guid == "" { - return errors.New("specify an resourceGuid") + return errors.New("specify an resource group guid") } apiPath := fmt.Sprintf(apiV2ResourceGroupsFromGUID, guid) return svc.client.RequestDecoder("GET", apiPath, nil, response) @@ -265,102 +187,76 @@ func (svc *ResourceGroupsService) update(guid string, data interface{}, response return svc.client.RequestEncoderDecoder("PATCH", apiPath, data, response) } -func (group ResourceGroupData) ResourceGroupType() resourceGroupType { - t, _ := FindResourceGroupType(group.Type) - return t +type ResourceGroupsService struct { + client *Client } -func (group ResourceGroupData) ID() string { - if !group.IsV2Group() { - return group.ResourceGuid - } else { - return group.ResourceGroupGuid - } +type RGExpression struct { + Operator string `json:"operator"` + Children []*RGChild `json:"children"` } -func (group *ResourceGroupData) ResetRGV2Fields() { - group.UpdatedBy = "" - group.UpdatedTime = nil - group.CreatedBy = "" - group.CreatedTime = nil - group.IsDefaultBoolean = nil - group.IsOrg = nil +type RGChild struct { + Operator string `json:"operator,omitempty"` + FilterName string `json:"filterName,omitempty"` + Children []*RGChild `json:"children,omitempty"` } -func (group *ResourceGroupData) ResetResourceGUID() { - group.ResourceGuid = "" - group.ResourceGroupGuid = "" - group.ResetRGV2Fields() +type RGFilter struct { + Field string `json:"field"` + Operation string `json:"operation"` + Values []string `json:"values"` + Key string `json:"key,omitempty"` } -func (group ResourceGroupData) Status() string { - if group.Enabled == 1 { - return "Enabled" - } - return "Disabled" +type RGQuery struct { + Filters map[string]*RGFilter `json:"filters"` + Expression *RGExpression `json:"expression"` } -func (group ResourceGroupData) IsV2Group() bool { - return group.Query != nil +// String returns the string representation of a Resource Group type +func (i resourceGroupType) String() string { + return ResourceGroupTypes[i].resourceGroupType } -type ResourceGroupResponse struct { - Data ResourceGroupData `json:"data"` +// QueryTemplate returns the resource group type's query template +func (i resourceGroupType) QueryTemplate() string { + return ResourceGroupTypes[i].queryTemplate } -type ResourceGroupsResponse struct { - Data []ResourceGroupData `json:"data"` +// FindResourceGroupType looks up inside the list of available resource group types +// the matching type from the provided string, if none, returns NoneResourceGroup +func FindResourceGroupType(typ string) (resourceGroupType, bool) { + for i, ctx := range ResourceGroupTypes { + if typ == ctx.resourceGroupType { + return i, true + } + } + return NoneResourceGroup, false } -type ResourceGroupData struct { - // RGv1 Fields - Guid string `json:"guid,omitempty"` - IsDefault int `json:"isDefault,omitempty"` - ResourceGuid string `json:"resourceGuid,omitempty"` - Name string `json:"resourceName,omitempty"` - Type string `json:"resourceType"` - Enabled int `json:"enabled"` - Props interface{} `json:"props,omitempty"` - - // RG v2 Fields. `Enabled` and `Type` fields are the same in RGv1 nd RGv2 - NameV2 string `json:"name,omitempty"` - Query *RGQuery `json:"query,omitempty"` - Description string `json:"description,omitempty"` - ResourceGroupGuid string `json:"resourceGroupGuid,omitempty"` - CreatedTime *time.Time `json:"lastUpdated,omitempty"` - CreatedBy string `json:"createdBy,omitempty"` - UpdatedTime *time.Time `json:"updatedTime,omitempty"` - UpdatedBy string `json:"updatedBy,omitempty"` - IsDefaultBoolean *bool `json:"isDefaultBoolean,omitempty"` - IsOrg *bool `json:"isOrg,omitempty"` +func (group *ResourceGroupData) ID() string { + return group.ResourceGroupGuid } -// RAIN-21510 workaround -type resourceGroupWorkaroundResponse struct { - Data resourceGroupWorkaroundData `json:"data"` +type ResourceGroupResponse struct { + Data ResourceGroupData `json:"data"` } -type resourceGroupsWorkaroundResponse struct { - Data []resourceGroupWorkaroundData `json:"data"` +type ResourceGroupsResponse struct { + Data []ResourceGroupData `json:"data"` } -type resourceGroupWorkaroundData struct { - Guid string `json:"guid,omitempty"` - IsDefault string `json:"isDefault,omitempty"` - ResourceGuid string `json:"resourceGuid,omitempty"` - Name string `json:"resourceName"` - Type string `json:"resourceType"` - Enabled int `json:"enabled,omitempty"` - Props interface{} `json:"props"` - - NameV2 string `json:"name,omitempty"` +type ResourceGroupData struct { + Name string `json:"name,omitempty"` Query *RGQuery `json:"query,omitempty"` Description string `json:"description,omitempty"` ResourceGroupGuid string `json:"resourceGroupGuid,omitempty"` - CreatedTime *time.Time `json:"lastUpdated,omitempty"` + CreatedTime *time.Time `json:"createdTime,omitempty"` CreatedBy string `json:"createdBy,omitempty"` UpdatedTime *time.Time `json:"updatedTime,omitempty"` UpdatedBy string `json:"updatedBy,omitempty"` IsDefaultBoolean *bool `json:"isDefaultBoolean,omitempty"` - IsOrg *bool `json:"isOrg,omitempty"` + Type string `json:"resourceType"` + Enabled int `json:"enabled"` } diff --git a/vendor/github.com/lacework/go-sdk/api/resource_groups_aws.go b/vendor/github.com/lacework/go-sdk/api/resource_groups_aws.go deleted file mode 100644 index 96efcfe0..00000000 --- a/vendor/github.com/lacework/go-sdk/api/resource_groups_aws.go +++ /dev/null @@ -1,171 +0,0 @@ -// -// Author:: Darren Murray () -// Copyright:: Copyright 2021, Lacework Inc. -// License:: Apache License, Version 2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package api - -import ( - "encoding/json" - "strconv" - - "github.com/lacework/go-sdk/lwtime" - "github.com/pkg/errors" -) - -// Wildcard values for selecting all aws accounts -var ( - AwsResourceGroupAllAccounts = []string{"*"} -) - -// GetAws gets a single Aws ResourceGroup matching the -// provided resource guid -func (svc *ResourceGroupsVersionService) GetAws(guid string) ( - response AwsResourceGroupResponse, - err error, -) { - var rawResponse resourceGroupWorkaroundResponse - err = svc.get(guid, &rawResponse) - if err != nil { - return - } - - return setAwsResourceGroupResponse(rawResponse) -} - -// UpdateAws updates a single Aws ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) UpdateAws(data ResourceGroup) ( - response AwsResourceGroupResponse, err error) { - - if data == nil { - err = errors.New("resource group must not be empty") - return - } - guid := data.ID() - data.ResetResourceGUID() - - err = svc.update(guid, data, &response) - if err != nil { - return - } - - return -} - -// CreateAws creates a single Aws ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) CreateAws(data ResourceGroup) ( - response AwsResourceGroupResponse, - err error, -) { - err = svc.create(data, &response) - return -} - -func setAwsResourceGroupResponse(response resourceGroupWorkaroundResponse) (aws AwsResourceGroupResponse, err error) { - var props AwsResourceJsonStringGroupProps - - isDefault, err := strconv.Atoi(response.Data.IsDefault) - if err != nil { - return - } - - aws = AwsResourceGroupResponse{ - Data: AwsResourceGroupData{ - Guid: response.Data.Guid, - IsDefault: isDefault, - ResourceGuid: response.Data.ResourceGuid, - Name: response.Data.Name, - Type: response.Data.Type, - Enabled: response.Data.Enabled, - }, - } - - propsString, ok := response.Data.Props.(string) - if !ok { - err = errors.New("unable to cast props field from API response") - return - } - - err = json.Unmarshal([]byte(propsString), &props) - if err != nil { - return - } - aws.Data.Props = AwsResourceGroupProps(props) - return -} - -type AwsResourceGroupResponse struct { - Data AwsResourceGroupData `json:"data"` -} - -type AwsResourceGroupData struct { - Guid string `json:"guid,omitempty"` - IsDefault int `json:"isDefault,omitempty"` - ResourceGuid string `json:"resourceGuid,omitempty"` - Name string `json:"resourceName"` - Type string `json:"resourceType"` - Enabled int `json:"enabled,omitempty"` - Props AwsResourceGroupProps `json:"props"` - - NameV2 string `json:"name"` - Query *RGQuery `json:"query"` - Description string `json:"description,omitempty"` - ResourceGroupGuid string `json:"resourceGroupGuid,omitempty"` - CreatedTime *lwtime.Epoch `json:"lastUpdated,omitempty"` - CreatedBy string `json:"createdBy,omitempty"` - UpdatedTime *lwtime.Epoch `json:"updatedTime,omitempty"` - UpdatedBy string `json:"updatedBy,omitempty"` - IsDefaultBoolean *bool `json:"isDefaultBoolean,omitempty"` - IsOrg *bool `json:"isOrg,omitempty"` -} - -type AwsResourceGroupProps struct { - Description string `json:"description,omitempty"` - AccountIDs []string `json:"accountIds"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated *lwtime.Epoch `json:"lastUpdated,omitempty"` -} - -// Workaround for props being returned as a json string -type AwsResourceJsonStringGroupProps struct { - Description string `json:"DESCRIPTION,omitempty"` - AccountIDs []string `json:"ACCOUNT_IDS"` - UpdatedBy string `json:"UPDATED_BY,omitempty"` - LastUpdated *lwtime.Epoch `json:"LAST_UPDATED,omitempty"` -} - -func (props AwsResourceGroupProps) GetBaseProps() ResourceGroupPropsBase { - return ResourceGroupPropsBase{ - Description: props.Description, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated, - } -} - -func (props AwsResourceGroupProps) MarshalJSON() ([]byte, error) { - res := struct { - Description string `json:"description,omitempty"` - AccountIDs []string `json:"accountIds"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated string `json:"lastUpdated,omitempty"` - }{ - Description: props.Description, - AccountIDs: props.AccountIDs, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated.String(), - } - return json.Marshal(&res) -} diff --git a/vendor/github.com/lacework/go-sdk/api/resource_groups_azure.go b/vendor/github.com/lacework/go-sdk/api/resource_groups_azure.go deleted file mode 100644 index b2c293f6..00000000 --- a/vendor/github.com/lacework/go-sdk/api/resource_groups_azure.go +++ /dev/null @@ -1,167 +0,0 @@ -// -// Author:: Darren Murray () -// Copyright:: Copyright 2021, Lacework Inc. -// License:: Apache License, Version 2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package api - -import ( - "encoding/json" - "strconv" - - "github.com/lacework/go-sdk/lwtime" - "github.com/pkg/errors" -) - -// Wildcard values for selecting all azure subscriptions -var ( - AzureResourceGroupAllSubscriptions = []string{"*"} -) - -// GetAzure gets a single Azure ResourceGroup matching the -// provided resource guid -func (svc *ResourceGroupsVersionService) GetAzure(guid string) ( - response AzureResourceGroupResponse, - err error, -) { - var rawResponse resourceGroupWorkaroundResponse - err = svc.get(guid, &rawResponse) - if err != nil { - return - } - - return setAzureResponse(rawResponse) -} - -// UpdateAzure updates a single Azure ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) UpdateAzure(data ResourceGroup) ( - response AzureResourceGroupResponse, - err error, -) { - if data == nil { - err = errors.New("resource group must not be empty") - return - } - guid := data.ID() - data.ResetResourceGUID() - - err = svc.update(guid, data, &response) - if err != nil { - return - } - - return -} - -// CreateAzure creates a single Azure ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) CreateAzure(data ResourceGroup) ( - response AzureResourceGroupResponse, - err error, -) { - err = svc.create(data, &response) - return -} - -func setAzureResponse(response resourceGroupWorkaroundResponse) (az AzureResourceGroupResponse, err error) { - var props AzureResourceJsonStringGroupProps - - isDefault, err := strconv.Atoi(response.Data.IsDefault) - if err != nil { - return - } - - az = AzureResourceGroupResponse{ - Data: AzureResourceGroupData{ - Guid: response.Data.Guid, - IsDefault: isDefault, - ResourceGuid: response.Data.ResourceGuid, - Name: response.Data.Name, - Type: response.Data.Type, - Enabled: response.Data.Enabled, - }, - } - - propsString, ok := response.Data.Props.(string) - if !ok { - err = errors.New("unable to cast props field from API response") - return - } - - err = json.Unmarshal([]byte(propsString), &props) - if err != nil { - return - } - - az.Data.Props = AzureResourceGroupProps(props) - - return -} - -type AzureResourceGroupResponse struct { - Data AzureResourceGroupData `json:"data"` -} - -type AzureResourceGroupData struct { - Guid string `json:"guid,omitempty"` - IsDefault int `json:"isDefault,omitempty"` - ResourceGuid string `json:"resourceGuid,omitempty"` - Name string `json:"resourceName"` - Type string `json:"resourceType"` - Enabled int `json:"enabled,omitempty"` - Props AzureResourceGroupProps `json:"props"` -} - -type AzureResourceGroupProps struct { - Description string `json:"description,omitempty"` - Tenant string `json:"tenant"` - Subscriptions []string `json:"subscriptions"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated *lwtime.Epoch `json:"lastUpdated,omitempty"` -} - -// Workaround for props being returned as a json string -type AzureResourceJsonStringGroupProps struct { - Description string `json:"DESCRIPTION,omitempty"` - Tenant string `json:"TENANT"` - Subscriptions []string `json:"SUBSCRIPTIONS"` - UpdatedBy string `json:"UPDATED_BY,omitempty"` - LastUpdated *lwtime.Epoch `json:"LAST_UPDATED,omitempty"` -} - -func (props AzureResourceGroupProps) GetBaseProps() ResourceGroupPropsBase { - return ResourceGroupPropsBase{ - Description: props.Description, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated, - } -} - -func (props AzureResourceGroupProps) MarshalJSON() ([]byte, error) { - res := struct { - Description string `json:"description,omitempty"` - Tenant string `json:"tenant"` - Subscriptions []string `json:"subscriptions"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated string `json:"lastUpdated,omitempty"` - }{ - Description: props.Description, - Tenant: props.Tenant, - Subscriptions: props.Subscriptions, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated.String(), - } - return json.Marshal(&res) -} diff --git a/vendor/github.com/lacework/go-sdk/api/resource_groups_container.go b/vendor/github.com/lacework/go-sdk/api/resource_groups_container.go deleted file mode 100644 index 19769930..00000000 --- a/vendor/github.com/lacework/go-sdk/api/resource_groups_container.go +++ /dev/null @@ -1,167 +0,0 @@ -// -// Author:: Darren Murray () -// Copyright:: Copyright 2021, Lacework Inc. -// License:: Apache License, Version 2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package api - -import ( - "encoding/json" - "strconv" - - "github.com/lacework/go-sdk/lwtime" - "github.com/pkg/errors" -) - -// Wildcard values for selecting all labels/tags -var ( - ContainerResourceGroupAllLabels = []map[string]string{{"*": "*"}} - ContainerResourceGroupAllTags = []string{"*"} -) - -// GetContainer gets a single Container ResourceGroup matching the -// provided resource guid -func (svc *ResourceGroupsVersionService) GetContainer(guid string) ( - response ContainerResourceGroupResponse, - err error, -) { - var rawResponse resourceGroupWorkaroundResponse - err = svc.get(guid, &rawResponse) - if err != nil { - return - } - - return setContainerResponse(rawResponse) -} - -// UpdateContainer updates a single Container ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) UpdateContainer(data ResourceGroup) ( - response ContainerResourceGroupResponse, - err error, -) { - if data == nil { - err = errors.New("resource group must not be empty") - return - } - guid := data.ID() - data.ResetResourceGUID() - - err = svc.update(guid, data, &response) - return -} - -// CreateContainer creates a single Container ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) CreateContainer(data ResourceGroup) ( - response ContainerResourceGroupResponse, - err error, -) { - err = svc.create(data, &response) - if err != nil { - return - } - - return -} - -func setContainerResponse(response resourceGroupWorkaroundResponse) (ctr ContainerResourceGroupResponse, err error) { - var props ContainerResourceJsonStringGroupProps - - isDefault, err := strconv.Atoi(response.Data.IsDefault) - if err != nil { - return - } - - ctr = ContainerResourceGroupResponse{ - Data: ContainerResourceGroupData{ - Guid: response.Data.Guid, - IsDefault: isDefault, - ResourceGuid: response.Data.ResourceGuid, - Name: response.Data.Name, - Type: response.Data.Type, - Enabled: response.Data.Enabled, - }, - } - - propsString, ok := response.Data.Props.(string) - if !ok { - err = errors.New("unable to cast props field from API response") - return - } - - err = json.Unmarshal([]byte(propsString), &props) - if err != nil { - return - } - - ctr.Data.Props = ContainerResourceGroupProps(props) - return -} - -type ContainerResourceGroupResponse struct { - Data ContainerResourceGroupData `json:"data"` -} - -type ContainerResourceGroupData struct { - Guid string `json:"guid,omitempty"` - IsDefault int `json:"isDefault,omitempty"` - ResourceGuid string `json:"resourceGuid,omitempty"` - Name string `json:"resourceName"` - Type string `json:"resourceType"` - Enabled int `json:"enabled,omitempty"` - Props ContainerResourceGroupProps `json:"props"` -} - -type ContainerResourceGroupProps struct { - Description string `json:"description,omitempty"` - ContainerLabels []map[string]string `json:"containerLabels"` - ContainerTags []string `json:"containerTags"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated *lwtime.Epoch `json:"lastUpdated,omitempty"` -} - -// Workaround for props being returned as a json string -type ContainerResourceJsonStringGroupProps struct { - Description string `json:"DESCRIPTION,omitempty"` - ContainerLabels []map[string]string `json:"CONTAINER_LABELS"` - ContainerTags []string `json:"CONTAINER_TAGS"` - UpdatedBy string `json:"UPDATED_BY,omitempty"` - LastUpdated *lwtime.Epoch `json:"LAST_UPDATED,omitempty"` -} - -func (props ContainerResourceGroupProps) GetBaseProps() ResourceGroupPropsBase { - return ResourceGroupPropsBase{ - Description: props.Description, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated, - } -} - -func (props ContainerResourceGroupProps) MarshalJSON() ([]byte, error) { - res := struct { - Description string `json:"description,omitempty"` - ContainerLabels []map[string]string `json:"containerLabels"` - ContainerTags []string `json:"containerTags"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated string `json:"lastUpdated,omitempty"` - }{ - Description: props.Description, - ContainerLabels: props.ContainerLabels, - ContainerTags: props.ContainerTags, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated.String(), - } - return json.Marshal(&res) -} diff --git a/vendor/github.com/lacework/go-sdk/api/resource_groups_gcp.go b/vendor/github.com/lacework/go-sdk/api/resource_groups_gcp.go deleted file mode 100644 index 72f27dca..00000000 --- a/vendor/github.com/lacework/go-sdk/api/resource_groups_gcp.go +++ /dev/null @@ -1,165 +0,0 @@ -// -// Author:: Darren Murray () -// Copyright:: Copyright 2021, Lacework Inc. -// License:: Apache License, Version 2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package api - -import ( - "encoding/json" - "strconv" - - "github.com/lacework/go-sdk/lwtime" - "github.com/pkg/errors" -) - -// Wildcard values for selecting all gcp projects -var ( - GcpResourceGroupAllProjects = []string{"*"} -) - -// GetGcp gets a single Gcp ResourceGroup matching the -// provided resource guid -func (svc *ResourceGroupsVersionService) GetGcp(guid string) ( - response GcpResourceGroupResponse, - err error, -) { - var rawResponse resourceGroupWorkaroundResponse - err = svc.get(guid, &rawResponse) - if err != nil { - return - } - - return setGcpResponse(rawResponse) -} - -// UpdateGcp updates a single Gcp ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) UpdateGcp(data ResourceGroup) ( - response GcpResourceGroupResponse, - err error, -) { - if data == nil { - err = errors.New("resource group must not be empty") - return - } - guid := data.ID() - data.ResetResourceGUID() - - err = svc.update(guid, data, &response) - return -} - -// CreateGcp creates a single Gcp ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) CreateGcp(data ResourceGroup) ( - response GcpResourceGroupResponse, - err error, -) { - err = svc.create(data, &response) - if err != nil { - return - } - - return -} - -func setGcpResponse(response resourceGroupWorkaroundResponse) (gcp GcpResourceGroupResponse, err error) { - var props GcpResourceGroupJsonStringProps - - isDefault, err := strconv.Atoi(response.Data.IsDefault) - if err != nil { - return - } - - gcp = GcpResourceGroupResponse{ - Data: GcpResourceGroupData{ - Guid: response.Data.Guid, - IsDefault: isDefault, - ResourceGuid: response.Data.ResourceGuid, - Name: response.Data.Name, - Type: response.Data.Type, - Enabled: response.Data.Enabled, - }, - } - - propsString, ok := response.Data.Props.(string) - if !ok { - err = errors.New("unable to cast props field from API response") - return - } - - err = json.Unmarshal([]byte(propsString), &props) - if err != nil { - return - } - gcp.Data.Props = GcpResourceGroupProps(props) - return -} - -type GcpResourceGroupResponse struct { - Data GcpResourceGroupData `json:"data"` -} - -type GcpResourceGroupData struct { - Guid string `json:"guid,omitempty"` - IsDefault int `json:"isDefault,omitempty"` - ResourceGuid string `json:"resourceGuid,omitempty"` - Name string `json:"resourceName"` - Type string `json:"resourceType"` - Enabled int `json:"enabled,omitempty"` - Props GcpResourceGroupProps `json:"props"` -} - -type GcpResourceGroupProps struct { - Description string `json:"description,omitempty"` - Organization string `json:"organization"` - Projects []string `json:"projects"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated *lwtime.Epoch `json:"lastUpdated,omitempty"` -} - -// Workaround for props being returned as a json string -type GcpResourceGroupJsonStringProps struct { - Description string `json:"DESCRIPTION,omitempty"` - Organization string `json:"ORGANIZATION"` - Projects []string `json:"PROJECTS"` - UpdatedBy string `json:"UPDATED_BY,omitempty"` - LastUpdated *lwtime.Epoch `json:"LAST_UPDATED,omitempty"` -} - -func (props GcpResourceGroupProps) GetBaseProps() ResourceGroupPropsBase { - return ResourceGroupPropsBase{ - Description: props.Description, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated, - } -} - -func (props GcpResourceGroupProps) MarshalJSON() ([]byte, error) { - res := struct { - Description string `json:"description,omitempty"` - Organization string `json:"organization"` - Projects []string `json:"projects"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated string `json:"lastUpdated,omitempty"` - }{ - Description: props.Description, - Organization: props.Organization, - Projects: props.Projects, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated.String(), - } - return json.Marshal(&res) -} diff --git a/vendor/github.com/lacework/go-sdk/api/resource_groups_lw_account.go b/vendor/github.com/lacework/go-sdk/api/resource_groups_lw_account.go deleted file mode 100644 index 5a4ee991..00000000 --- a/vendor/github.com/lacework/go-sdk/api/resource_groups_lw_account.go +++ /dev/null @@ -1,161 +0,0 @@ -// -// Author:: Darren Murray () -// Copyright:: Copyright 2021, Lacework Inc. -// License:: Apache License, Version 2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package api - -import ( - "encoding/json" - "strconv" - - "github.com/lacework/go-sdk/lwtime" - "github.com/pkg/errors" -) - -// Wildcard values for selecting all lacework accounts -var ( - LwAccountResourceGroupAllAccounts = []string{"*"} -) - -// GetContainer gets a single LwAccount ResourceGroup matching the -// provided resource guid -func (svc *ResourceGroupsVersionService) GetLwAccount(guid string) ( - response LwAccountResourceGroupResponse, - err error, -) { - var rawResponse resourceGroupWorkaroundResponse - err = svc.get(guid, &rawResponse) - if err != nil { - return - } - - return setLwAccountResponse(rawResponse) -} - -// UpdateLwAccount updates a single LwAccount ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) UpdateLwAccount(data ResourceGroup) ( - response LwAccountResourceGroupResponse, - err error, -) { - if data == nil { - err = errors.New("resource group must not be empty") - return - } - guid := data.ID() - data.ResetResourceGUID() - - err = svc.update(guid, data, &response) - if err != nil { - return - } - - return -} - -// CreateLwAccount creates a single LwAccount ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) CreateLwAccount(data ResourceGroup) ( - response LwAccountResourceGroupResponse, - err error, -) { - err = svc.create(data, &response) - return -} - -func setLwAccountResponse(response resourceGroupWorkaroundResponse) (lw LwAccountResourceGroupResponse, err error) { - var props LwAccountResourceGroupJsonStringProps - - isDefault, err := strconv.Atoi(response.Data.IsDefault) - if err != nil { - return - } - - lw = LwAccountResourceGroupResponse{ - Data: LwAccountResourceGroupData{ - Guid: response.Data.Guid, - IsDefault: isDefault, - ResourceGuid: response.Data.ResourceGuid, - Name: response.Data.Name, - Type: response.Data.Type, - Enabled: response.Data.Enabled, - }, - } - - propsString, ok := response.Data.Props.(string) - if !ok { - err = errors.New("unable to cast props field from API response") - return - } - - err = json.Unmarshal([]byte(propsString), &props) - if err != nil { - return - } - lw.Data.Props = LwAccountResourceGroupProps(props) - return -} - -type LwAccountResourceGroupResponse struct { - Data LwAccountResourceGroupData `json:"data"` -} - -type LwAccountResourceGroupData struct { - Guid string `json:"guid,omitempty"` - IsDefault int `json:"isDefault,omitempty"` - ResourceGuid string `json:"resourceGuid,omitempty"` - Name string `json:"resourceName"` - Type string `json:"resourceType"` - Enabled int `json:"enabled,omitempty"` - Props LwAccountResourceGroupProps `json:"props"` -} - -type LwAccountResourceGroupProps struct { - Description string `json:"description,omitempty"` - LwAccounts []string `json:"lwAccounts"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated *lwtime.Epoch `json:"lastUpdated,omitempty"` -} - -// Workaround for props being returned as a json string -type LwAccountResourceGroupJsonStringProps struct { - Description string `json:"DESCRIPTION,omitempty"` - LwAccounts []string `json:"LW_ACCOUNTS"` - UpdatedBy string `json:"UPDATED_BY,omitempty"` - LastUpdated *lwtime.Epoch `json:"LAST_UPDATED,omitempty"` -} - -func (props LwAccountResourceGroupProps) GetBaseProps() ResourceGroupPropsBase { - return ResourceGroupPropsBase{ - Description: props.Description, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated, - } -} - -func (props LwAccountResourceGroupProps) MarshalJSON() ([]byte, error) { - res := struct { - Description string `json:"description,omitempty"` - LwAccounts []string `json:"lwAccounts"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated string `json:"lastUpdated,omitempty"` - }{ - Description: props.Description, - LwAccounts: props.LwAccounts, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated.String(), - } - return json.Marshal(&res) -} diff --git a/vendor/github.com/lacework/go-sdk/api/resource_groups_machine.go b/vendor/github.com/lacework/go-sdk/api/resource_groups_machine.go deleted file mode 100644 index f00ac47c..00000000 --- a/vendor/github.com/lacework/go-sdk/api/resource_groups_machine.go +++ /dev/null @@ -1,163 +0,0 @@ -// -// Author:: Darren Murray () -// Copyright:: Copyright 2021, Lacework Inc. -// License:: Apache License, Version 2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package api - -import ( - "encoding/json" - "strconv" - - "github.com/lacework/go-sdk/lwtime" - "github.com/pkg/errors" -) - -// Wildcard values for selecting all machine tags -var ( - MachineResourceGroupAllTags = []map[string]string{{"*": "*"}} -) - -// GetMachine gets a single Machine ResourceGroup matching the -// provided resource guid -func (svc *ResourceGroupsVersionService) GetMachine(guid string) ( - response MachineResourceGroupResponse, - err error, -) { - var rawResponse resourceGroupWorkaroundResponse - err = svc.get(guid, &rawResponse) - if err != nil { - return - } - - return setMachineAccountResponse(rawResponse) -} - -// UpdateMachine updates a single Machine ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) UpdateMachine(data ResourceGroup) ( - response MachineResourceGroupResponse, - err error, -) { - if data == nil { - err = errors.New("resource group must not be empty") - return - } - guid := data.ID() - data.ResetResourceGUID() - - err = svc.update(guid, data, &response) - if err != nil { - return - } - - return -} - -// CreateMachine creates a single Machine ResourceGroup on the Lacework Server -func (svc *ResourceGroupsVersionService) CreateMachine(data ResourceGroup) ( - response MachineResourceGroupResponse, - err error, -) { - err = svc.create(data, &response) - return -} - -func setMachineAccountResponse(response resourceGroupWorkaroundResponse) ( - machine MachineResourceGroupResponse, err error, -) { - var props MachineResourceGroupJsonStringProps - - isDefault, err := strconv.Atoi(response.Data.IsDefault) - if err != nil { - return - } - - machine = MachineResourceGroupResponse{ - Data: MachineResourceGroupData{ - Guid: response.Data.Guid, - IsDefault: isDefault, - ResourceGuid: response.Data.ResourceGuid, - Name: response.Data.Name, - Type: response.Data.Type, - Enabled: response.Data.Enabled, - }, - } - - propsString, ok := response.Data.Props.(string) - if !ok { - err = errors.New("unable to cast props field from API response") - return - } - - err = json.Unmarshal([]byte(propsString), &props) - if err != nil { - return - } - machine.Data.Props = MachineResourceGroupProps(props) - return -} - -type MachineResourceGroupResponse struct { - Data MachineResourceGroupData `json:"data"` -} - -type MachineResourceGroupData struct { - Guid string `json:"guid,omitempty"` - IsDefault int `json:"isDefault,omitempty"` - ResourceGuid string `json:"resourceGuid,omitempty"` - Name string `json:"resourceName"` - Type string `json:"resourceType"` - Enabled int `json:"enabled,omitempty"` - Props MachineResourceGroupProps `json:"props"` -} - -type MachineResourceGroupProps struct { - Description string `json:"description,omitempty"` - MachineTags []map[string]string `json:"machineTags"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated *lwtime.Epoch `json:"lastUpdated,omitempty"` -} - -// Workaround for props being returned as a json string -type MachineResourceGroupJsonStringProps struct { - Description string `json:"DESCRIPTION,omitempty"` - MachineTags []map[string]string `json:"MACHINE_TAGS"` - UpdatedBy string `json:"UPDATED_BY,omitempty"` - LastUpdated *lwtime.Epoch `json:"LAST_UPDATED,omitempty"` -} - -func (props MachineResourceGroupProps) GetBaseProps() ResourceGroupPropsBase { - return ResourceGroupPropsBase{ - Description: props.Description, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated, - } -} - -func (props MachineResourceGroupProps) MarshalJSON() ([]byte, error) { - res := struct { - Description string `json:"description,omitempty"` - MachineTags []map[string]string `json:"machineTags"` - UpdatedBy string `json:"updatedBy,omitempty"` - LastUpdated string `json:"lastUpdated,omitempty"` - }{ - Description: props.Description, - MachineTags: props.MachineTags, - UpdatedBy: props.UpdatedBy, - LastUpdated: props.LastUpdated.String(), - } - return json.Marshal(&res) -} diff --git a/vendor/github.com/lacework/go-sdk/api/resource_groups_v2.go b/vendor/github.com/lacework/go-sdk/api/resource_groups_v2.go deleted file mode 100644 index e438d187..00000000 --- a/vendor/github.com/lacework/go-sdk/api/resource_groups_v2.go +++ /dev/null @@ -1,185 +0,0 @@ -// -// Author:: Zeki Sherif() -// Copyright:: Copyright 2021, Lacework Inc. -// License:: Apache License, Version 2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package api - -import ( - "fmt" - "time" - - "github.com/pkg/errors" -) - -func (svc *ResourceGroupsV2Service) List() (response ResourceGroupsV2Response, err error) { - var rawResponse ResourceGroupsV2Response - err = svc.client.RequestDecoder("GET", apiV2ResourceGroups, nil, &rawResponse) - if err != nil { - return - } - - return -} - -func (svc *ResourceGroupsV2Service) Create(group ResourceGroupDataWithQuery) ( - response ResourceGroupV2Response, - err error, -) { - err = svc.create(group, &response) - return -} - -func (svc *ResourceGroupsV2Service) Update(data ResourceGroup) ( - response ResourceGroupV2Response, - err error, -) { - if data == nil { - err = errors.New("resource group must not be empty") - return - } - guid := data.ID() - data.ResetResourceGUID() - - err = svc.update(guid, data, &response) - if err != nil { - return - } - - return -} - -func (svc *ResourceGroupsV2Service) Delete(guid string) error { - if guid == "" { - return errors.New("specify a resourceGuid") - } - - return svc.client.RequestDecoder( - "DELETE", - fmt.Sprintf(apiV2ResourceGroupsFromGUID, guid), - nil, - nil, - ) -} - -func (svc *ResourceGroupsV2Service) Get(guid string, response interface{}) error { - var rawResponse resourceGroupWorkaroundResponse - err := svc.get(guid, &rawResponse) - if err != nil { - return err - } - - return castResourceGroupResponse(rawResponse.Data, &response) -} - -func (svc *ResourceGroupsV2Service) create(data interface{}, response interface{}) error { - return svc.client.RequestEncoderDecoder("POST", apiV2ResourceGroups, data, response) -} - -func (svc *ResourceGroupsV2Service) get(guid string, response interface{}) error { - if guid == "" { - return errors.New("specify an resourceGuid") - } - apiPath := fmt.Sprintf(apiV2ResourceGroupsFromGUID, guid) - return svc.client.RequestDecoder("GET", apiPath, nil, response) -} - -func (svc *ResourceGroupsV2Service) update(guid string, data interface{}, response interface{}) error { - if guid == "" { - return errors.New("specify a resource group guid") - } - - apiPath := fmt.Sprintf(apiV2ResourceGroupsFromGUID, guid) - return svc.client.RequestEncoderDecoder("PATCH", apiPath, data, response) -} - -type ResourceGroupV2Response struct { - Data ResourceGroupDataWithQuery `json:"data"` -} - -type ResourceGroupsV2Response struct { - Data []ResourceGroupDataWithQuery `json:"data"` -} - -type ResourceGroupsV2Service struct { - client *Client -} - -type RGExpression struct { - Operator string `json:"operator"` - Children []*RGChild `json:"children"` -} - -type RGChild struct { - Operator string `json:"operator,omitempty"` - FilterName string `json:"filterName,omitempty"` - Children []*RGChild `json:"children,omitempty"` -} - -type RGFilter struct { - Field string `json:"field"` - Operation string `json:"operation"` - Values []string `json:"values"` - Key string `json:"key,omitempty"` -} - -type RGQuery struct { - Filters map[string]*RGFilter `json:"filters"` - Expression *RGExpression `json:"expression"` -} -type ResourceGroupDataWithQuery struct { - Name string `json:"name"` - Type string `json:"resourceType"` - Query *RGQuery `json:"query"` - Description string `json:"description,omitempty"` - ResourceGroupGuid string `json:"resourceGroupGuid,omitempty"` - CreatedTime *time.Time `json:"lastUpdated,omitempty"` - CreatedBy string `json:"createdBy,omitempty"` - UpdatedTime *time.Time `json:"updatedTime,omitempty"` - UpdatedBy string `json:"updatedBy,omitempty"` - Enabled int `json:"enabled,omitempty"` - IsDefaultBoolean *bool `json:"isDefaultBoolean,omitempty"` - IsOrg *bool `json:"isOrg,omitempty"` -} - -func (group ResourceGroupDataWithQuery) GetProps() interface{} { - return nil -} - -func (group ResourceGroupDataWithQuery) GetQuery() *RGQuery { - return group.Query -} - -func (group ResourceGroupDataWithQuery) ResourceGroupType() resourceGroupType { - t, _ := FindResourceGroupType(group.Type) - return t -} - -func (group ResourceGroupDataWithQuery) ID() string { - return group.ResourceGroupGuid -} - -func (group *ResourceGroupDataWithQuery) ResetRGV2Fields() { - // no-op -} - -func (group *ResourceGroupDataWithQuery) ResetResourceGUID() { - group.ResourceGroupGuid = "" -} - -func (group ResourceGroupDataWithQuery) IsV2Group() bool { - return true -} diff --git a/vendor/github.com/lacework/go-sdk/api/resource_groups_version_service.go b/vendor/github.com/lacework/go-sdk/api/resource_groups_version_service.go deleted file mode 100644 index 8af98aa4..00000000 --- a/vendor/github.com/lacework/go-sdk/api/resource_groups_version_service.go +++ /dev/null @@ -1,373 +0,0 @@ -// -// Author:: Zeki Sherif() -// Copyright:: Copyright 2021, Lacework Inc. -// License:: Apache License, Version 2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -package api - -import ( - "encoding/json" - "fmt" - "strconv" - - "github.com/pkg/errors" -) - -type ResourceGroupsVersionService struct { - client *Client - v1ResourceGroupService *ResourceGroupsService - v2ResourceGroupService *ResourceGroupsV2Service - featureFlagService *FeatureFlagsService -} - -type ResourceGroupsInterfaceData interface { - GetProps() interface{} - GetQuery() *RGQuery -} - -func (group ResourceGroupData) GetProps() interface{} { - return group.Props -} - -func (group ResourceGroupData) GetQuery() *RGQuery { - return nil -} - -func NewResourceGroupsVersionService(c *Client) *ResourceGroupsVersionService { - return &ResourceGroupsVersionService{ - c, - &ResourceGroupsService{c}, - &ResourceGroupsV2Service{c}, - &FeatureFlagsService{c}, - } -} - -// NewResourceGroup returns an instance of the ResourceGroupData struct with the -// provided ResourceGroup type, name and the props field as an interface{}. -// -// NOTE: This function must be used by any ResourceGroup type. -// -// Basic usage: Initialize a new ContainerResourceGroup struct, then -// -// use the new instance to do CRUD operations -// -// client, err := api.NewClient("account") -// if err != nil { -// return err -// } -// -// group := api.NewResourceGroup("container resource group", -// api.ContainerResourceGroup, -// api.ContainerResourceGroupData{ -// Props: api.ContainerResourceGroupProps{ -// Description: "all containers, -// ContainerLabels: ContainerResourceGroupAllLabels, -// ContainerTags: ContainerResourceGroupAllTags, -// }, -// }, -// ) -// -// client.V2.ResourceGroups.Create(group) -func NewResourceGroup(name string, iType resourceGroupType, props interface{}) ResourceGroupData { - return ResourceGroupData{ - Name: name, - Type: iType.String(), - Enabled: 1, - Props: props, - } -} - -// NewResourceGroupWithQuery Only available with RGv2 beta -func NewResourceGroupWithQuery(name string, iType resourceGroupType, - description string, query *RGQuery) ResourceGroupDataWithQuery { - return ResourceGroupDataWithQuery{ - Name: name, - Type: iType.String(), - Enabled: 1, - Query: query, - Description: description, - } -} - -func isRGV2FlagEnabled(featureFlagService *FeatureFlagsService) bool { - response, err := featureFlagService.GetFeatureFlagsMatchingPrefix(ApiV2CliFeatureFlag) - - if err != nil { - return false - } - - return len(response.Data.Flags) >= 1 -} - -func (svc *ResourceGroupsVersionService) Get(guid string, response interface{}) error { - var rawResponse resourceGroupWorkaroundResponse - err := svc.get(guid, &rawResponse) - if err != nil { - return err - } - - if rawResponse.Data.Query != nil { - return castRGV2WorkAroundResponse(rawResponse, response) - } else { - return castRGV1WorkAroundResponse(rawResponse, response) - } -} - -func (svc *ResourceGroupsVersionService) Create(group ResourceGroupsInterfaceData) ( - response ResourceGroupResponse, - err error, -) { - isV2FlagEnabled := isRGV2FlagEnabled(svc.featureFlagService) - - if group.GetProps() == nil && !isV2FlagEnabled && group.GetQuery() == nil { - if isV2FlagEnabled { - err = errors.New("Invalid request. Missing `query` field.") - } else { - err = errors.New("Invalid request. Missing `props` field.") - } - - return - } - - if group.GetProps() != nil { - response, err = svc.v1ResourceGroupService.Create(group.(ResourceGroupData)) - return - } - - createResponse, createErr := svc.v2ResourceGroupService.Create(group.(ResourceGroupDataWithQuery)) - if createErr != nil { - err = createErr - return - } - - err = castResourceGroupV2Response(createResponse, &response) - return -} - -func (svc *ResourceGroupsVersionService) Update(group ResourceGroupsInterfaceData) ( - response ResourceGroupResponse, - err error, -) { - if group.GetProps() != nil { - response, err = svc.v1ResourceGroupService.Update(group.(ResourceGroup)) - return - } - - isV2FlagEnabled := isRGV2FlagEnabled(svc.featureFlagService) - - if isV2FlagEnabled { - updateResponse, updateErr := svc.v2ResourceGroupService.Update(group.(ResourceGroup)) - if updateErr != nil { - err = updateErr - return - } - - err = castResourceGroupV2Response(updateResponse, &response) - return - } - - err = errors.New("Unable to update resource group") - return -} - -func (svc *ResourceGroupsVersionService) Delete(guid string) error { - // It doesn't matcher which version of service we use as api-server handles - // delete for both v1 and v2 resource groups - err := svc.v1ResourceGroupService.Delete(guid) - - if err != nil { - return err - } - - return nil -} - -func (svc *ResourceGroupsVersionService) List() (response ResourceGroupsResponse, err error) { - var rawResponse resourceGroupsWorkaroundResponse - err = svc.client.RequestDecoder("GET", apiV2ResourceGroups, nil, &rawResponse) - - if err != nil { - return - } - - return setResourceGroupsVersionUnawareResponse(rawResponse) -} - -func castRGV1WorkAroundResponse(data resourceGroupWorkaroundResponse, response interface{}) error { - isDefault, err := strconv.Atoi(data.Data.IsDefault) - if err != nil { - return err - } - group := ResourceGroupResponse{ - Data: ResourceGroupData{ - Guid: data.Data.Guid, - IsDefault: isDefault, - ResourceGuid: data.Data.ResourceGuid, - Name: data.Data.Name, - Type: data.Data.Type, - Enabled: data.Data.Enabled, - Props: data.Data.Props, - }, - } - - j, err := json.Marshal(group) - if err != nil { - return err - } - - err = json.Unmarshal(j, &response) - if err != nil { - return err - } - - return nil -} - -func castRGV2WorkAroundResponse(data resourceGroupWorkaroundResponse, response interface{}) error { - group := ResourceGroupResponse{ - Data: ResourceGroupData{ - Type: data.Data.Type, - Enabled: data.Data.Enabled, - NameV2: data.Data.NameV2, - Query: data.Data.Query, - Description: data.Data.Description, - ResourceGroupGuid: data.Data.ResourceGroupGuid, - CreatedTime: data.Data.CreatedTime, - CreatedBy: data.Data.CreatedBy, - UpdatedTime: data.Data.UpdatedTime, - UpdatedBy: data.Data.UpdatedBy, - IsDefaultBoolean: data.Data.IsDefaultBoolean, - IsOrg: data.Data.IsOrg, - }, - } - - j, err := json.Marshal(group) - if err != nil { - return err - } - - err = json.Unmarshal(j, &response) - if err != nil { - return err - } - - return nil -} - -func castResourceGroupV2Response(data ResourceGroupV2Response, response interface{}) error { - group := ResourceGroupResponse{ - Data: ResourceGroupData{ - Type: data.Data.Type, - Enabled: data.Data.Enabled, - NameV2: data.Data.Name, - Query: data.Data.Query, - Description: data.Data.Description, - ResourceGroupGuid: data.Data.ResourceGroupGuid, - CreatedTime: data.Data.CreatedTime, - CreatedBy: data.Data.CreatedBy, - UpdatedTime: data.Data.UpdatedTime, - UpdatedBy: data.Data.UpdatedBy, - IsDefaultBoolean: data.Data.IsDefaultBoolean, - IsOrg: data.Data.IsOrg, - }, - } - - j, err := json.Marshal(group) - if err != nil { - return err - } - - err = json.Unmarshal(j, &response) - if err != nil { - return err - } - - return nil -} - -func (svc *ResourceGroupsVersionService) get(guid string, response interface{}) error { - if guid == "" { - return errors.New("specify an resourceGuid") - } - apiPath := fmt.Sprintf(apiV2ResourceGroupsFromGUID, guid) - return svc.client.RequestDecoder("GET", apiPath, nil, response) -} - -func (svc *ResourceGroupsVersionService) create(data interface{}, response interface{}) error { - return svc.client.RequestEncoderDecoder("POST", apiV2ResourceGroups, data, response) -} - -func (svc *ResourceGroupsVersionService) update(guid string, data interface{}, response interface{}) error { - if guid == "" { - return errors.New("specify a resource group guid") - } - - apiPath := fmt.Sprintf(apiV2ResourceGroupsFromGUID, guid) - return svc.client.RequestEncoderDecoder("PATCH", apiPath, data, response) -} - -func setResourceGroupResponse(response resourceGroupWorkaroundData) (ResourceGroupResponse, - error) { - - if response.Props != nil { - isDefault, err := strconv.Atoi(response.IsDefault) - if err != nil { - return ResourceGroupResponse{}, err - } - return ResourceGroupResponse{ - Data: ResourceGroupData{ - Guid: response.Guid, - IsDefault: isDefault, - ResourceGuid: response.ResourceGuid, - Name: response.Name, - Type: response.Type, - Enabled: response.Enabled, - Props: response.Props, - }, - }, nil - } else { - return ResourceGroupResponse{ - Data: ResourceGroupData{ - Type: response.Type, - Enabled: response.Enabled, - NameV2: response.NameV2, - Query: response.Query, - Description: response.Description, - ResourceGroupGuid: response.ResourceGroupGuid, - CreatedTime: response.CreatedTime, - CreatedBy: response.CreatedBy, - UpdatedTime: response.UpdatedTime, - UpdatedBy: response.UpdatedBy, - IsDefaultBoolean: response.IsDefaultBoolean, - IsOrg: response.IsOrg, - }, - }, nil - } -} - -func setResourceGroupsVersionUnawareResponse(workaround resourceGroupsWorkaroundResponse) ( - ResourceGroupsResponse, error) { - var data []ResourceGroupData - for _, r := range workaround.Data { - group, err := setResourceGroupResponse(r) - if err != nil { - return ResourceGroupsResponse{}, err - } - data = append(data, group.Data) - } - - return ResourceGroupsResponse{Data: data}, nil -} diff --git a/vendor/github.com/lacework/go-sdk/api/v2.go b/vendor/github.com/lacework/go-sdk/api/v2.go index bf47f1e2..cb44328f 100644 --- a/vendor/github.com/lacework/go-sdk/api/v2.go +++ b/vendor/github.com/lacework/go-sdk/api/v2.go @@ -43,7 +43,7 @@ type V2Endpoints struct { ContainerRegistries *ContainerRegistriesService Configs *v2ConfigService FeatureFlags *FeatureFlagsService - ResourceGroups *ResourceGroupsVersionService + ResourceGroups *ResourceGroupsService AgentAccessTokens *AgentAccessTokensService AgentInfo *AgentInfoService Inventory *InventoryService @@ -80,7 +80,7 @@ func NewV2Endpoints(c *Client) *V2Endpoints { &ContainerRegistriesService{c}, NewV2ConfigService(c), &FeatureFlagsService{c}, - NewResourceGroupsVersionService(c), + &ResourceGroupsService{c}, &AgentAccessTokensService{c}, &AgentInfoService{c}, &InventoryService{c}, diff --git a/vendor/github.com/lacework/go-sdk/api/v2_vulnerabilities.go b/vendor/github.com/lacework/go-sdk/api/v2_vulnerabilities.go index f6fb795a..0c9085b8 100644 --- a/vendor/github.com/lacework/go-sdk/api/v2_vulnerabilities.go +++ b/vendor/github.com/lacework/go-sdk/api/v2_vulnerabilities.go @@ -517,6 +517,21 @@ func (v *VulnerabilityHost) GetMachineTags() (machineTags VulnerabilityHostMachi return } +func (v *VulnerabilityHost) GetMachineTagsRaw() (map[string]interface{}, error) { + jsonTags, err := json.Marshal(v.MachineTags) + if err != nil { + return nil, err + } + + var rawTags map[string]interface{} + + if err := json.Unmarshal(jsonTags, &rawTags); err != nil { + return nil, err + } + + return rawTags, nil +} + type VulnerabilityHostMachineTags struct { Account string `json:"Account"` AmiID string `json:"AmiId"` diff --git a/vendor/github.com/lacework/go-sdk/api/version.go b/vendor/github.com/lacework/go-sdk/api/version.go index 992d36a8..3720821d 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: 20240322205700 +// File generated at: 20241017162419 // // <<< DO NOT EDIT >>> // @@ -7,4 +7,4 @@ package api // Version is the semver coming from the VERSION file -const Version = "1.49.0" +const Version = "1.54.1-dev" diff --git a/vendor/modules.txt b/vendor/modules.txt index 32e3e579..7d1381a2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -257,7 +257,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.49.0 +# github.com/lacework/go-sdk v1.54.1-0.20241030155210-2b0ffd411c65 ## explicit; go 1.21 github.com/lacework/go-sdk/api github.com/lacework/go-sdk/internal/array