diff --git a/api/cloud_accounts_gcp_sidekick.go b/api/cloud_accounts_gcp_sidekick.go index a46316d0d..bca1cd3a8 100644 --- a/api/cloud_accounts_gcp_sidekick.go +++ b/api/cloud_accounts_gcp_sidekick.go @@ -27,6 +27,15 @@ func (svc *CloudAccountsService) GetGcpSidekick(guid string) ( return } +// CreateGcpSidekick creates an GcpSidekick Cloud Account integration +func (svc *CloudAccountsService) CreateGcpSidekick(data CloudAccount) ( + response GcpSidekickIntegrationResponse, + err error, +) { + err = svc.create(data, &response) + return +} + // UpdateGcpSidekick updates a single GcpSidekick integration on the Lacework Server func (svc *CloudAccountsService) UpdateGcpSidekick(data CloudAccount) ( response GcpSidekickIntegrationResponse, @@ -40,9 +49,15 @@ type GcpSidekickIntegrationResponse struct { Data V2GcpSidekickIntegration `json:"data"` } +type GcpSidekickToken struct { + ServerToken string `json:"serverToken"` + Uri string `json:"uri"` +} + type V2GcpSidekickIntegration struct { v2CommonIntegrationData - Data GcpSidekickData `json:"data"` + GcpSidekickToken `json:"serverToken"` + Data GcpSidekickData `json:"data"` } type GcpSidekickData struct { diff --git a/api/cloud_accounts_gcp_sidekick_test.go b/api/cloud_accounts_gcp_sidekick_test.go index 440752b25..77ba741d9 100644 --- a/api/cloud_accounts_gcp_sidekick_test.go +++ b/api/cloud_accounts_gcp_sidekick_test.go @@ -139,6 +139,7 @@ func TestCloudAccountsGcpSidekickGet(t *testing.T) { assert.Equal(t, "tokenTest", integrationData.Credentials.TokenUri) assert.Equal(t, "proj1,proj2", integrationData.FilterList) assert.Equal(t, "queryText", integrationData.QueryText) + assert.Equal(t, "token_"+integration.IntgGuid, integration.ServerToken) } func TestCloudAccountsGcpSidekickUpdate(t *testing.T) { @@ -268,7 +269,10 @@ func getGcpData(id string, data api.GcpSidekickData) string { "scanFrequency": ` + scanFrequency + `, "scanContainers": ` + scanContainers + `, "scanHostVulnerabilities": ` + scanHostVulnerabilities + ` - } + }, + "serverToken": { + "serverToken": "token_` + id + `" + } } ` }