Skip to content

Commit

Permalink
feat(api): List integrations by type
Browse files Browse the repository at this point in the history
Signed-off-by: Salim Afiune Maya <[email protected]>
  • Loading branch information
afiune committed Mar 20, 2020
1 parent d0cbf9f commit f96a15b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ package api
import "fmt"

const (
//apiIntegrationsByType = "external/integrations/type/%s"
apiIntegrations = "external/integrations"
apiIntegrationByGUID = "external/integrations/%s"
apiIntegrationSchema = "external/integrations/schema/%s"
apiTokens = "access/tokens"
apiIntegrations = "external/integrations"
apiIntegrationsByType = "external/integrations/type/%s"
apiIntegrationByGUID = "external/integrations/%s"
apiIntegrationSchema = "external/integrations/schema/%s"
apiTokens = "access/tokens"
)

// WithApiV2 configures the client to use the API version 2 (/api/v2)
Expand Down
9 changes: 9 additions & 0 deletions api/integrations_aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package api

import "fmt"

// NewAwsConfigIntegration returns an instance of awsConfigIntegration
//
// Basic usage: Initialize a new awsConfigIntegration struct, then
Expand Down Expand Up @@ -91,6 +93,13 @@ func (svc *IntegrationsService) DeleteAwsConfig(guid string) (
return
}

// ListAwsConfig lists the AWS_CFG external integrations available on the Lacework Server
func (svc *IntegrationsService) ListAwsConfig() (response awsIntegrationsResponse, err error) {
apiPath := fmt.Sprintf(apiIntegrationsByType, AwsCfgIntegration.String())
err = svc.client.RequestDecoder("GET", apiPath, nil, &response)
return
}

type awsIntegrationsResponse struct {
Data []awsConfigIntegration `json:"data"`
Ok bool `json:"ok"`
Expand Down
10 changes: 10 additions & 0 deletions api/integrations_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package api

import "fmt"

// NewAzureConfigIntegration returns an instance of azureConfigIntegration
//
// Basic usage: Initialize a new azureConfigIntegration struct, then
Expand Down Expand Up @@ -84,6 +86,14 @@ func (svc *IntegrationsService) DeleteAzureConfig(guid string) (
) {
err = svc.delete(guid, &response)
return

}

// ListAzureConfig lists the AZURE_CFG external integrations available on the Lacework Server
func (svc *IntegrationsService) ListAzureConfig() (response azureIntegrationsResponse, err error) {
apiPath := fmt.Sprintf(apiIntegrationsByType, AzureCfgIntegration.String())
err = svc.client.RequestDecoder("GET", apiPath, nil, &response)
return
}

type azureIntegrationsResponse struct {
Expand Down
9 changes: 9 additions & 0 deletions api/integrations_gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package api

import "fmt"

// gcpResourceLevel determines Project or Organization level integration
type gcpResourceLevel int

Expand Down Expand Up @@ -114,6 +116,13 @@ func (svc *IntegrationsService) DeleteGcpConfig(guid string) (
return
}

// ListGcpConfig lists the CFG_CFG external integrations available on the Lacework Server
func (svc *IntegrationsService) ListGcpConfig() (response gcpIntegrationsResponse, err error) {
apiPath := fmt.Sprintf(apiIntegrationsByType, GcpCfgIntegration.String())
err = svc.client.RequestDecoder("GET", apiPath, nil, &response)
return
}

type gcpIntegrationsResponse struct {
Data []gcpConfigIntegration `json:"data"`
Ok bool `json:"ok"`
Expand Down

0 comments on commit f96a15b

Please sign in to comment.