From dd22403aef68323059f9e0758ffe8beb154e9639 Mon Sep 17 00:00:00 2001 From: Darren Murray Date: Wed, 17 Feb 2021 10:39:58 +0000 Subject: [PATCH] chore: Update go sdk dependencies Signed-off-by: Darren Murray --- go.mod | 2 +- go.sum | 2 + .../github.com/lacework/go-sdk/api/client.go | 9 ++ .../integration_alert_channels_cisco_webex.go | 96 +++++++++++++++ ...egration_alert_channels_microsoft_teams.go | 96 +++++++++++++++ .../integration_alert_channels_victorops.go | 114 ++++++++++++++++++ .../lacework/go-sdk/api/integrations.go | 48 +++++--- .../github.com/lacework/go-sdk/api/version.go | 4 +- vendor/modules.txt | 2 +- 9 files changed, 351 insertions(+), 22 deletions(-) create mode 100644 vendor/github.com/lacework/go-sdk/api/integration_alert_channels_cisco_webex.go create mode 100644 vendor/github.com/lacework/go-sdk/api/integration_alert_channels_microsoft_teams.go create mode 100644 vendor/github.com/lacework/go-sdk/api/integration_alert_channels_victorops.go diff --git a/go.mod b/go.mod index c431e5b44..241f26f5b 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/hashicorp/terraform-plugin-test v1.4.3 // indirect github.com/hashicorp/terraform-svchost v0.0.0-20191119180714-d2e4933b9136 // indirect github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect - github.com/lacework/go-sdk v0.2.18-0.20210205172138-8298022367d9 + github.com/lacework/go-sdk v0.2.20-0.20210216214810-cac9fc27f696 github.com/mattn/go-colorable v0.1.7 // indirect github.com/mitchellh/cli v1.1.1 // indirect github.com/mitchellh/go-homedir v1.1.0 diff --git a/go.sum b/go.sum index 8ff106c49..a33a760d0 100644 --- a/go.sum +++ b/go.sum @@ -364,6 +364,8 @@ github.com/lacework/go-sdk v0.2.17 h1:YfM4CwlmLE4ijArTKmnHv+x1JZdb00o9ptqvMr6FNr github.com/lacework/go-sdk v0.2.17/go.mod h1:yiEjWVHT4TjkZZ1pa9eS8fIfnnoVuzj1VNTIVEIsSKE= github.com/lacework/go-sdk v0.2.18-0.20210205172138-8298022367d9 h1:MPyhrKjrilbcc7NzWx8u3sg3jf1QIotCtkJN6WU5MOM= github.com/lacework/go-sdk v0.2.18-0.20210205172138-8298022367d9/go.mod h1:yiEjWVHT4TjkZZ1pa9eS8fIfnnoVuzj1VNTIVEIsSKE= +github.com/lacework/go-sdk v0.2.20-0.20210216214810-cac9fc27f696 h1:jd6J6ZjehkBH0MuO9Ttz7jyqTAcC2et5DxM4hV7LI28= +github.com/lacework/go-sdk v0.2.20-0.20210216214810-cac9fc27f696/go.mod h1:yiEjWVHT4TjkZZ1pa9eS8fIfnnoVuzj1VNTIVEIsSKE= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= diff --git a/vendor/github.com/lacework/go-sdk/api/client.go b/vendor/github.com/lacework/go-sdk/api/client.go index 84c417625..a71b67087 100644 --- a/vendor/github.com/lacework/go-sdk/api/client.go +++ b/vendor/github.com/lacework/go-sdk/api/client.go @@ -117,6 +117,15 @@ func NewClient(account string, opts ...Option) (*Client, error) { return c, nil } +// WithTimeout changes the default client timeout +func WithTimeout(timeout time.Duration) Option { + return clientFunc(func(c *Client) error { + c.log.Debug("setting up client", zap.Reflect("timeout", timeout)) + c.c.Timeout = timeout + 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/integration_alert_channels_cisco_webex.go b/vendor/github.com/lacework/go-sdk/api/integration_alert_channels_cisco_webex.go new file mode 100644 index 000000000..99ee45b0b --- /dev/null +++ b/vendor/github.com/lacework/go-sdk/api/integration_alert_channels_cisco_webex.go @@ -0,0 +1,96 @@ +// +// Author:: Darren Murray() +// Copyright:: Copyright 2020, 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 + +// NewCiscoWebexAlertChannel returns an instance of CiscoWebexAlertChannel +// with the provided name and data. +// +// Basic usage: Initialize a new CiscoWebexAlertChannel struct, then +// use the new instance to do CRUD operations +// +// client, err := api.NewClient("account") +// if err != nil { +// return err +// } +// +// ciscoWebexChannel := api.NewCiscoWebexAlertChannel("foo", +// api.CiscoWebexChannelData{ +// WebhookURL: "https://webexapis.com/v1/webhooks/incoming/api-token", +// }, +// ) +// +// client.Integrations.CreateCiscoWebexAlertChannel(ciscoWebexChannel) +// +func NewCiscoWebexAlertChannel(name string, data CiscoWebexChannelData) CiscoWebexAlertChannel { + return CiscoWebexAlertChannel{ + commonIntegrationData: commonIntegrationData{ + Name: name, + Type: CiscoWebexChannelIntegration.String(), + Enabled: 1, + }, + Data: data, + } +} + +// CreateCiscoWebexAlertChannel creates a ciscoWebex alert channel integration on the Lacework Server +func (svc *IntegrationsService) CreateCiscoWebexAlertChannel(integration CiscoWebexAlertChannel) ( + response CiscoWebexAlertChannelResponse, + err error, +) { + err = svc.create(integration, &response) + return +} + +// GetCiscoWebexAlertChannel gets a ciscoWebex alert channel integration that matches with +// the provided integration guid on the Lacework Server +func (svc *IntegrationsService) GetCiscoWebexAlertChannel(guid string) (response CiscoWebexAlertChannelResponse, + err error) { + err = svc.get(guid, &response) + return +} + +// UpdateCiscoWebexAlertChannel updates a single ciscoWebex alert channel integration +func (svc *IntegrationsService) UpdateCiscoWebexAlertChannel(data CiscoWebexAlertChannel) ( + response CiscoWebexAlertChannelResponse, + err error, +) { + err = svc.update(data.IntgGuid, data, &response) + return +} + +// ListCiscoWebexAlertChannel lists the WEBHOOK external integrationS available on the Lacework Server +func (svc *IntegrationsService) ListCiscoWebexAlertChannel() (response CiscoWebexAlertChannelResponse, err error) { + err = svc.listByType(CiscoWebexChannelIntegration, &response) + return +} + +type CiscoWebexAlertChannelResponse struct { + Data []CiscoWebexAlertChannel `json:"data"` + Ok bool `json:"ok"` + Message string `json:"message"` +} + +type CiscoWebexAlertChannel struct { + commonIntegrationData + Data CiscoWebexChannelData `json:"DATA"` +} + +type CiscoWebexChannelData struct { + WebhookURL string `json:"WEBHOOK" mapstructure:"WEBHOOK"` +} diff --git a/vendor/github.com/lacework/go-sdk/api/integration_alert_channels_microsoft_teams.go b/vendor/github.com/lacework/go-sdk/api/integration_alert_channels_microsoft_teams.go new file mode 100644 index 000000000..3b91d7a62 --- /dev/null +++ b/vendor/github.com/lacework/go-sdk/api/integration_alert_channels_microsoft_teams.go @@ -0,0 +1,96 @@ +// +// Author:: Darren Murray() +// Copyright:: Copyright 2020, 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 + +// NewMicrosoftTeamsAlertChannel returns an instance of MicrosoftTeamsAlertChannel +// with the provided name and data. +// +// Basic usage: Initialize a new MicrosoftTeamsAlertChannel struct, then +// use the new instance to do CRUD operations +// +// client, err := api.NewClient("account") +// if err != nil { +// return err +// } +// +// microsoftTeamsChannel := api.NewMicrosoftTeamsAlertChannel("foo", +// api.MicrosoftTeamsChannelData{ +// WebhookURL: "https://outlook.office.com/webhook/api-token", +// }, +// ) +// +// client.Integrations.CreateMicrosoftTeamsAlertChannel(microsoftTeamsChannel) +// +func NewMicrosoftTeamsAlertChannel(name string, data MicrosoftTeamsChannelData) MicrosoftTeamsAlertChannel { + return MicrosoftTeamsAlertChannel{ + commonIntegrationData: commonIntegrationData{ + Name: name, + Type: MicrosoftTeamsChannelIntegration.String(), + Enabled: 1, + }, + Data: data, + } +} + +// CreateMicrosoftTeamsAlertChannel creates a msTeams alert channel integration on the Lacework Server +func (svc *IntegrationsService) CreateMicrosoftTeamsAlertChannel(integration MicrosoftTeamsAlertChannel) ( + response MicrosoftTeamsAlertChannelResponse, + err error, +) { + err = svc.create(integration, &response) + return +} + +// GetMicrosoftTeamsAlertChannel gets a msTeams alert channel integration that matches with +// the provided integration guid on the Lacework Server +func (svc *IntegrationsService) GetMicrosoftTeamsAlertChannel(guid string) (response MicrosoftTeamsAlertChannelResponse, + err error) { + err = svc.get(guid, &response) + return +} + +// UpdateMicrosoftTeamsAlertChannel updates a single msTeams alert channel integration +func (svc *IntegrationsService) UpdateMicrosoftTeamsAlertChannel(data MicrosoftTeamsAlertChannel) ( + response MicrosoftTeamsAlertChannelResponse, + err error, +) { + err = svc.update(data.IntgGuid, data, &response) + return +} + +// ListMicrosoftTeamsAlertChannel lists the Microsoft Teams external integrations available on the Lacework Server +func (svc *IntegrationsService) ListMicrosoftTeamsAlertChannel() (response MicrosoftTeamsAlertChannelResponse, err error) { + err = svc.listByType(MicrosoftTeamsChannelIntegration, &response) + return +} + +type MicrosoftTeamsAlertChannelResponse struct { + Data []MicrosoftTeamsAlertChannel `json:"data"` + Ok bool `json:"ok"` + Message string `json:"message"` +} + +type MicrosoftTeamsAlertChannel struct { + commonIntegrationData + Data MicrosoftTeamsChannelData `json:"DATA"` +} + +type MicrosoftTeamsChannelData struct { + WebhookURL string `json:"TEAMS_URL" mapstructure:"TEAMS_URL"` +} diff --git a/vendor/github.com/lacework/go-sdk/api/integration_alert_channels_victorops.go b/vendor/github.com/lacework/go-sdk/api/integration_alert_channels_victorops.go new file mode 100644 index 000000000..d53e8dfad --- /dev/null +++ b/vendor/github.com/lacework/go-sdk/api/integration_alert_channels_victorops.go @@ -0,0 +1,114 @@ +// +// Author:: Darren Murray() +// Copyright:: Copyright 2020, 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 "github.com/pkg/errors" + +// NewVictorOpsAlertChannel returns an instance of VictorOpsAlertChannel +// with the provided name and data. +// +// Basic usage: Initialize a new VictorOpsAlertChannel struct, then +// use the new instance to do CRUD operations +// +// client, err := api.NewClient("account") +// if err != nil { +// return err +// } +// +// datadog := api.NewVictorOpsAlertChannel("foo", +// api.VictorOpsChannelData{ +// WebhookURL: "https://alert.victorops.com/integrations/generic/20131114/alert/31e945ee-5cad-44e7-afb0-97c20ea80dd8/database, +// }, +// ) +// +// client.Integrations.CreateVictorOpsAlertChannel(datadogChannel) +// +func NewVictorOpsAlertChannel(name string, data VictorOpsChannelData) VictorOpsAlertChannel { + return VictorOpsAlertChannel{ + commonIntegrationData: commonIntegrationData{ + Name: name, + Type: VictorOpsChannelIntegration.String(), + Enabled: 1, + }, + Data: data, + } +} + +// CreateVictorOpsAlertChannel creates a datadog alert channel integration on the Lacework Server +func (svc *IntegrationsService) CreateVictorOpsAlertChannel(integration VictorOpsAlertChannel) ( + response VictorOpsAlertChannelResponse, + err error, +) { + err = svc.create(integration, &response) + return +} + +// GetVictorOpsAlertChannel gets a datadog alert channel integration that matches with +// the provided integration guid on the Lacework Server +func (svc *IntegrationsService) GetVictorOpsAlertChannel(guid string) (response VictorOpsAlertChannelResponse, + err error) { + err = svc.get(guid, &response) + return +} + +// UpdateVictorOpsAlertChannel updates a single datadog alert channel integration +func (svc *IntegrationsService) UpdateVictorOpsAlertChannel(data VictorOpsAlertChannel) ( + response VictorOpsAlertChannelResponse, + err error, +) { + err = svc.update(data.IntgGuid, data, &response) + return +} + +// ListVictorOpsAlertChannel lists the datadog alert channel integrations available on the Lacework Server +func (svc *IntegrationsService) ListVictorOpsAlertChannel() (response VictorOpsAlertChannelResponse, err error) { + err = svc.listByType(VictorOpsChannelIntegration, &response) + return +} + +type VictorOpsAlertChannelResponse struct { + Data []VictorOpsAlertChannel `json:"data"` + Ok bool `json:"ok"` + Message string `json:"message"` +} + +// VictorOpsSite returns the datadogSite type for the corresponding string input +func VictorOpsSite(site string) (datadogSite, error) { + if val, ok := datadogSites[site]; ok { + return val, nil + } + return "", errors.Errorf("%v is not a valid VictorOps Site", site) +} + +// VictorOpsService returns the datadogService type for the corresponding string input +func VictorOpsService(service string) (datadogService, error) { + if val, ok := datadogServices[service]; ok { + return val, nil + } + return "", errors.Errorf("%v is not a valid VictorOps Service", service) +} + +type VictorOpsAlertChannel struct { + commonIntegrationData + Data VictorOpsChannelData `json:"DATA"` +} + +type VictorOpsChannelData struct { + WebhookURL string `json:"INTG_URL" mapstructure:"INTG_URL"` +} diff --git a/vendor/github.com/lacework/go-sdk/api/integrations.go b/vendor/github.com/lacework/go-sdk/api/integrations.go index bdeefb4d9..427a1cefb 100644 --- a/vendor/github.com/lacework/go-sdk/api/integrations.go +++ b/vendor/github.com/lacework/go-sdk/api/integrations.go @@ -61,9 +61,15 @@ const ( // Azure Activity Log integration type AzureActivityLogIntegration + // Cisco Webex integration type + CiscoWebexChannelIntegration + // Container registry integration type ContainerRegistryIntegration + // Microsoft Teams channel integration type + MicrosoftTeamsChannelIntegration + // Slack channel integration type SlackChannelIntegration @@ -82,30 +88,36 @@ const ( // Jira integration type JiraIntegration + // VictorOps channel integration type + VictorOpsChannelIntegration + // Webhook channel integration type WebhookIntegration ) // IntegrationTypes is the list of available integration types var IntegrationTypes = map[integrationType]string{ - NoneIntegration: "NONE", - AwsCfgIntegration: "AWS_CFG", - AwsCloudTrailIntegration: "AWS_CT_SQS", - AwsS3ChannelIntegration: "AWS_S3", - DatadogChannelIntegration: "DATADOG", - GcpCfgIntegration: "GCP_CFG", - GcpAuditLogIntegration: "GCP_AT_SES", - GcpPubSubChannelIntegration: "GCP_PUBSUB", - AzureCfgIntegration: "AZURE_CFG", - AzureActivityLogIntegration: "AZURE_AL_SEQ", - ContainerRegistryIntegration: "CONT_VULN_CFG", - SlackChannelIntegration: "SLACK_CHANNEL", - SplunkIntegration: "SPLUNK_HEC", - ServiceNowChannelIntegration: "SERVICE_NOW_REST", - AwsCloudWatchIntegration: "CLOUDWATCH_EB", - PagerDutyIntegration: "PAGER_DUTY_API", - JiraIntegration: "JIRA", - WebhookIntegration: "WEBHOOK", + NoneIntegration: "NONE", + AwsCfgIntegration: "AWS_CFG", + AwsCloudTrailIntegration: "AWS_CT_SQS", + AwsS3ChannelIntegration: "AWS_S3", + CiscoWebexChannelIntegration: "CISCO_SPARK_WEBHOOK", + DatadogChannelIntegration: "DATADOG", + GcpCfgIntegration: "GCP_CFG", + GcpAuditLogIntegration: "GCP_AT_SES", + GcpPubSubChannelIntegration: "GCP_PUBSUB", + AzureCfgIntegration: "AZURE_CFG", + AzureActivityLogIntegration: "AZURE_AL_SEQ", + ContainerRegistryIntegration: "CONT_VULN_CFG", + MicrosoftTeamsChannelIntegration: "MICROSOFT_TEAMS", + SlackChannelIntegration: "SLACK_CHANNEL", + SplunkIntegration: "SPLUNK_HEC", + ServiceNowChannelIntegration: "SERVICE_NOW_REST", + AwsCloudWatchIntegration: "CLOUDWATCH_EB", + PagerDutyIntegration: "PAGER_DUTY_API", + JiraIntegration: "JIRA", + VictorOpsChannelIntegration: "VICTOR_OPS", + WebhookIntegration: "WEBHOOK", } // String returns the string representation of an integration type diff --git a/vendor/github.com/lacework/go-sdk/api/version.go b/vendor/github.com/lacework/go-sdk/api/version.go index 777a35955..cf9e42e9c 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: 20210128233528 +// File generated at: 20210216214810 // // <<< DO NOT EDIT >>> // @@ -7,4 +7,4 @@ package api // Version is the semver coming from the VERSION file -const Version = "0.2.18-dev" +const Version = "0.2.20-dev" diff --git a/vendor/modules.txt b/vendor/modules.txt index d25ad3a00..515e0aaf8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -286,7 +286,7 @@ github.com/jstemmer/go-junit-report/formatter github.com/jstemmer/go-junit-report/parser # github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd github.com/kevinburke/ssh_config -# github.com/lacework/go-sdk v0.2.18-0.20210205172138-8298022367d9 +# github.com/lacework/go-sdk v0.2.20-0.20210216214810-cac9fc27f696 ## explicit github.com/lacework/go-sdk/api github.com/lacework/go-sdk/internal/array