Documentation
¶
Index ¶
- Constants
- Variables
- func FindIntegrationType(t string) (integrationType, bool)
- type AwsIntegration
- type AwsIntegrationCreds
- type AwsIntegrationData
- type AwsIntegrationsResponse
- type AzureIntegration
- type AzureIntegrationCreds
- type AzureIntegrationData
- type AzureIntegrationsResponse
- type Client
- func (c *Client) ApiVersion() string
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) DoDecoder(req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) GenerateToken() (response tokenResponse, err error)
- func (c *Client) GenerateTokenWithKeys(keyID, secretKey string) (tokenResponse, error)
- func (c *Client) NewRequest(method string, apiURL string, body io.Reader) (*http.Request, error)
- func (c *Client) RequestDecoder(method, path string, body io.Reader, v interface{}) error
- func (c *Client) URL() string
- type GcpCredentials
- type GcpIntegration
- type GcpIntegrationData
- type GcpIntegrationsResponse
- type IntegrationsResponse
- type IntegrationsService
- func (svc *IntegrationsService) CreateAws(integration AwsIntegration) (response AwsIntegrationsResponse, err error)
- func (svc *IntegrationsService) CreateAzure(integration AzureIntegration) (response AzureIntegrationsResponse, err error)
- func (svc *IntegrationsService) CreateGcp(data GcpIntegration) (response GcpIntegrationsResponse, err error)
- func (svc *IntegrationsService) Delete(guid string) (response RawIntegrationsResponse, err error)
- func (svc *IntegrationsService) DeleteAws(guid string) (response AwsIntegrationsResponse, err error)
- func (svc *IntegrationsService) DeleteAzure(guid string) (response AzureIntegrationsResponse, err error)
- func (svc *IntegrationsService) DeleteGcp(guid string) (response GcpIntegrationsResponse, err error)
- func (svc *IntegrationsService) Get(guid string) (response RawIntegrationsResponse, err error)
- func (svc *IntegrationsService) GetAws(guid string) (response AwsIntegrationsResponse, err error)
- func (svc *IntegrationsService) GetAzure(guid string) (response AzureIntegrationsResponse, err error)
- func (svc *IntegrationsService) GetGcp(guid string) (response GcpIntegrationsResponse, err error)
- func (svc *IntegrationsService) GetSchema(iType integrationType) (response map[string]interface{}, err error)
- func (svc *IntegrationsService) List() (response IntegrationsResponse, err error)
- func (svc *IntegrationsService) ListAwsCfg() (response AwsIntegrationsResponse, err error)
- func (svc *IntegrationsService) ListAwsCloudTrail() (response AwsIntegrationsResponse, err error)
- func (svc *IntegrationsService) ListAzureActivityLog() (response AzureIntegrationsResponse, err error)
- func (svc *IntegrationsService) ListAzureCfg() (response AzureIntegrationsResponse, err error)
- func (svc *IntegrationsService) ListByType(iType integrationType) (response IntegrationsResponse, err error)
- func (svc *IntegrationsService) ListGcpAuditLog() (response GcpIntegrationsResponse, err error)
- func (svc *IntegrationsService) ListGcpCfg() (response GcpIntegrationsResponse, err error)
- func (svc *IntegrationsService) UpdateAws(data AwsIntegration) (response AwsIntegrationsResponse, err error)
- func (svc *IntegrationsService) UpdateAzure(data AzureIntegration) (response AzureIntegrationsResponse, err error)
- func (svc *IntegrationsService) UpdateGcp(data GcpIntegration) (response GcpIntegrationsResponse, err error)
- type Option
- type RawIntegration
- type RawIntegrationsResponse
Constants ¶
const ( // type that defines a non-existing integration NoneIntegration integrationType = iota // AWS Config integration type AwsCfgIntegration // AWS CloudTrail integration type AwsCloudTrailIntegration // GCP Config integration type GcpCfgIntegration // GCP Audit Log integration type GcpAuditLogIntegration // Azure Config integration type AzureCfgIntegration // Azure Activity Log integration type AzureActivityLogIntegration )
const ( // Project level integration with GCP GcpProjectIntegration gcpResourceLevel = iota // Organization level integration with GCP GcpOrganizationIntegration )
Variables ¶
var IntegrationTypes = map[integrationType]string{ NoneIntegration: "NONE", AwsCfgIntegration: "AWS_CFG", AwsCloudTrailIntegration: "AWS_CT_SQS", GcpCfgIntegration: "GCP_CFG", GcpAuditLogIntegration: "GCP_AT_SES", AzureCfgIntegration: "AZURE_CFG", AzureActivityLogIntegration: "AZURE_AL_SEQ", }
IntegrationTypes is the list of available integration types
Functions ¶
func FindIntegrationType ¶
FindIntegrationType looks up inside the list of available integration types the matching type from the provided string, if none, returns NoneIntegration
Types ¶
type AwsIntegration ¶
type AwsIntegration struct { Data AwsIntegrationData `json:"DATA"` // contains filtered or unexported fields }
func NewAwsCfgIntegration ¶
func NewAwsCfgIntegration(name string, data AwsIntegrationData) AwsIntegration
NewAwsCfgIntegration returns an instance of AwsIntegration of type AWS_CFG
func NewAwsCloudTrailIntegration ¶
func NewAwsCloudTrailIntegration(name string, data AwsIntegrationData) AwsIntegration
NewAwsCloudTrailIntegration returns an instance of AwsIntegration of type AWS_CT_SQS
func NewAwsIntegration ¶
func NewAwsIntegration(name string, iType integrationType, data AwsIntegrationData) AwsIntegration
NewAwsIntegration returns an instance of AwsIntegration with the provided integration type, name and data. The type can only be AwsCfgIntegration or AwsCloudTrailIntegration
Basic usage: Initialize a new AwsIntegration struct, then
use the new instance to do CRUD operations client, err := api.NewClient("account") if err != nil { return err } aws, err := api.NewAwsIntegration("foo", api.AwsCfgIntegration, api.AwsIntegrationData{ Credentials: api.AwsIntegrationCreds { RoleArn: "arn:aws:XYZ", ExternalId: "1", }, }, ) if err != nil { return err } client.Integrations.CreateAws(aws)
type AwsIntegrationCreds ¶
type AwsIntegrationData ¶
type AwsIntegrationData struct { Credentials AwsIntegrationCreds `json:"CROSS_ACCOUNT_CREDENTIALS"` // QueueUrl is a field that exists and is required for the AWS_CT_SQS integration, // though, it doesn't exist for AWS_CFG integrations, that's why we omit it if empty QueueUrl string `json:"QUEUE_URL,omitempty"` }
type AwsIntegrationsResponse ¶
type AwsIntegrationsResponse struct { Data []AwsIntegration `json:"data"` Ok bool `json:"ok"` Message string `json:"message"` }
type AzureIntegration ¶
type AzureIntegration struct { Data AzureIntegrationData `json:"DATA"` // contains filtered or unexported fields }
func NewAzureActivityLogIntegration ¶
func NewAzureActivityLogIntegration(name string, data AzureIntegrationData) AzureIntegration
NewAzureActivityLogIntegration returns an instance of AzureIntegration of type AZURE_AL_SEQ
func NewAzureCfgIntegration ¶
func NewAzureCfgIntegration(name string, data AzureIntegrationData) AzureIntegration
NewAzureCfgIntegration returns an instance of AzureIntegration of type AZURE_CFG
func NewAzureIntegration ¶
func NewAzureIntegration(name string, iType integrationType, data AzureIntegrationData) AzureIntegration
NewAzureIntegration returns an instance of AzureIntegration with the provided integration type, name and data. The type can only be AzureCfgIntegration or AzureActivityLogIntegration
Basic usage: Initialize a new AzureIntegration struct, then
use the new instance to do CRUD operations client, err := api.NewClient("account") if err != nil { return err } azure, err := api.NewAzureIntegration("bar", api.AzureActivityLogIntegration, api.AzureIntegrationData{ TenantID: "tenant_id", QueueUrl: "https://abc.queue.core.windows.net/123", Credentials: api.AzureIntegrationCreds{ ClientID: "client_id", ClientSecret: "secret", }, }, ) if err != nil { return err } client.Integrations.CreateAzure(azure)
type AzureIntegrationCreds ¶
type AzureIntegrationData ¶
type AzureIntegrationData struct { Credentials AzureIntegrationCreds `json:"CREDENTIALS"` TenantID string `json:"TENANT_ID"` // QueueUrl is a field that exists and is required for the AWS_CT_SQS integration, // though, it doesn't exist for AZURE_CFG integrations, that's why we omit it if empty QueueUrl string `json:"QUEUE_URL,omitempty"` }
type AzureIntegrationsResponse ¶
type AzureIntegrationsResponse struct { Data []AzureIntegration `json:"data"` Ok bool `json:"ok"` Message string `json:"message"` }
type Client ¶
type Client struct { Integrations *IntegrationsService // contains filtered or unexported fields }
func NewClient ¶
New generates a new Lacework API client
Example of basic usage
lacework, err := api.NewClient("demo") if err == nil { lacework.Integrations.List() }
func (*Client) ApiVersion ¶
ApiVersion returns the API client version
func (*Client) DoDecoder ¶
DoDecoder is used to execute (aka Do) the http request and decode it into the provided interface, all at once
func (*Client) GenerateToken ¶
GenerateToken generates a new access token
func (*Client) GenerateTokenWithKeys ¶
GenerateTokenWithKeys generates a new access token with the provided keys
func (*Client) NewRequest ¶
NewRequest generates a new http request
func (*Client) RequestDecoder ¶
RequestDecoder performs an http request on an endpoint, and decodes the response into the provided interface, all at once
type GcpCredentials ¶
type GcpIntegration ¶
type GcpIntegration struct { Data GcpIntegrationData `json:"DATA"` // contains filtered or unexported fields }
func NewGcpAuditLogIntegration ¶
func NewGcpAuditLogIntegration(name string, data GcpIntegrationData) GcpIntegration
NewGcpAuditLogIntegration returns an instance of GcpIntegration of type GCP_AT_SES
func NewGcpCfgIntegration ¶
func NewGcpCfgIntegration(name string, data GcpIntegrationData) GcpIntegration
NewGcpCfgIntegration returns an instance of GcpIntegration of type GCP_CFG
func NewGcpIntegration ¶
func NewGcpIntegration(name string, iType integrationType, data GcpIntegrationData) GcpIntegration
NewGcpIntegration returns an instance of GcpIntegration with the provided integration type, name and data. The type can only be GcpCfgIntegration or GcpAuditLogIntegration
Basic usage: Initialize a new GcpIntegration struct, then
use the new instance to do CRUD operations client, err := api.NewClient("account") if err != nil { return err } gcp, err := api.NewGcpIntegration("abc", api.GcpCfgIntegration, api.GcpIntegrationData{ ID: "1234", IdType: "id_type", Credentials: api.GcpCredentials{ ClientId: "id", ClientEmail: "email", PrivateKeyId: "key_id", PrivateKey: "key", }, }, ) if err != nil { return err } client.Integrations.CreateGcp(gcp)
type GcpIntegrationData ¶
type GcpIntegrationData struct { ID string `json:"ID"` IdType string `json:"ID_TYPE"` Credentials GcpCredentials `json:"CREDENTIALS"` // SubscriptionName is a field that exists and is required for the GCP_AT_SES // integration, though, it doesn't exist for GCP_CFG integrations, that's why // we omit it if empty SubscriptionName string `json:"SUBSCRIPTION_NAME,omitempty"` }
type GcpIntegrationsResponse ¶
type GcpIntegrationsResponse struct { Data []GcpIntegration `json:"data"` Ok bool `json:"ok"` Message string `json:"message"` }
type IntegrationsResponse ¶
type IntegrationsResponse struct { Data []commonIntegrationData `json:"data"` Ok bool `json:"ok"` Message string `json:"message"` }
func (*IntegrationsResponse) String ¶
func (integrations *IntegrationsResponse) String() string
type IntegrationsService ¶
type IntegrationsService struct {
// contains filtered or unexported fields
}
IntegrationsService is a service that interacts with the integrations endpoints from the Lacework Server
func (*IntegrationsService) CreateAws ¶
func (svc *IntegrationsService) CreateAws(integration AwsIntegration) ( response AwsIntegrationsResponse, err error, )
CreateAws creates a single AWS integration on the Lacework Server
func (*IntegrationsService) CreateAzure ¶
func (svc *IntegrationsService) CreateAzure(integration AzureIntegration) ( response AzureIntegrationsResponse, err error, )
CreateAzure creates a single Azure integration on the Lacework Server
func (*IntegrationsService) CreateGcp ¶
func (svc *IntegrationsService) CreateGcp(data GcpIntegration) ( response GcpIntegrationsResponse, err error, )
CreateGcp creates a single Gcp integration on the Lacework Server
func (*IntegrationsService) Delete ¶
func (svc *IntegrationsService) Delete(guid string) ( response RawIntegrationsResponse, err error, )
Delete deletes a single integration matching the integration guid on the Lacework Server the returned integration contains the 'Data' field raw (map of interfaces)
func (*IntegrationsService) DeleteAws ¶
func (svc *IntegrationsService) DeleteAws(guid string) ( response AwsIntegrationsResponse, err error, )
DeleteAws deletes a single AWS integration matching the integration guid on the Lacework Server
func (*IntegrationsService) DeleteAzure ¶
func (svc *IntegrationsService) DeleteAzure(guid string) ( response AzureIntegrationsResponse, err error, )
DeleteAzure deletes a single Azure integration matching the integration on the Lacework Server
func (*IntegrationsService) DeleteGcp ¶
func (svc *IntegrationsService) DeleteGcp(guid string) ( response GcpIntegrationsResponse, err error, )
DeleteGcp deletes a single Gcp integration matching the integration guid on the Lacework Server
func (*IntegrationsService) Get ¶
func (svc *IntegrationsService) Get(guid string) ( response RawIntegrationsResponse, err error, )
Get gets a single integration matching the integration guid on the Lacework Server, the returned integration contains the 'Data' field raw (map of interfaces)
func (*IntegrationsService) GetAws ¶
func (svc *IntegrationsService) GetAws(guid string) ( response AwsIntegrationsResponse, err error, )
GetAws gets a single AWS integration matching the integration guid on the Lacework Server
func (*IntegrationsService) GetAzure ¶
func (svc *IntegrationsService) GetAzure(guid string) ( response AzureIntegrationsResponse, err error, )
GetAzure gets a single Azure integration matching the integration guid on the Lacework Server
func (*IntegrationsService) GetGcp ¶
func (svc *IntegrationsService) GetGcp(guid string) ( response GcpIntegrationsResponse, err error, )
GetGcp gets a single Gcp integration matching the integration guid on the Lacework Server
func (*IntegrationsService) GetSchema ¶
func (svc *IntegrationsService) GetSchema(iType integrationType) ( response map[string]interface{}, err error, )
GetSchema get the integration schema for the provided integration type
func (*IntegrationsService) List ¶
func (svc *IntegrationsService) List() (response IntegrationsResponse, err error)
List lists the external integrations available on the Lacework Server
func (*IntegrationsService) ListAwsCfg ¶
func (svc *IntegrationsService) ListAwsCfg() (response AwsIntegrationsResponse, err error)
ListAwsCfg lists the AWS_CFG external integrations available on the Lacework Server
func (*IntegrationsService) ListAwsCloudTrail ¶
func (svc *IntegrationsService) ListAwsCloudTrail() (response AwsIntegrationsResponse, err error)
ListAwsCloudTrail lists the AWS_CT_SQS external integrations available on the Lacework Server
func (*IntegrationsService) ListAzureActivityLog ¶
func (svc *IntegrationsService) ListAzureActivityLog() ( response AzureIntegrationsResponse, err error, )
ListAzureActivityLog lists the AZURE_AL_SEQ external integrations available on the Lacework Server
func (*IntegrationsService) ListAzureCfg ¶
func (svc *IntegrationsService) ListAzureCfg() ( response AzureIntegrationsResponse, err error, )
ListAzureCfg lists the AZURE_CFG external integrations available on the Lacework Server
func (*IntegrationsService) ListByType ¶
func (svc *IntegrationsService) ListByType(iType integrationType) (response IntegrationsResponse, err error)
ListByType lists the external integrations from the provided type that are available on the Lacework Server
func (*IntegrationsService) ListGcpAuditLog ¶
func (svc *IntegrationsService) ListGcpAuditLog() (response GcpIntegrationsResponse, err error)
ListGcpAuditLog lists the GCP_AT_SES external integrations available on the Lacework Server
func (*IntegrationsService) ListGcpCfg ¶
func (svc *IntegrationsService) ListGcpCfg() (response GcpIntegrationsResponse, err error)
ListGcpCfg lists the GCP_CFG external integrations available on the Lacework Server
func (*IntegrationsService) UpdateAws ¶
func (svc *IntegrationsService) UpdateAws(data AwsIntegration) ( response AwsIntegrationsResponse, err error, )
UpdateAws updates a single AWS integration on the Lacework Server
func (*IntegrationsService) UpdateAzure ¶
func (svc *IntegrationsService) UpdateAzure(data AzureIntegration) ( response AzureIntegrationsResponse, err error, )
UpdateAzure updates a single Azure integration on the Lacework Server
func (*IntegrationsService) UpdateGcp ¶
func (svc *IntegrationsService) UpdateGcp(data GcpIntegration) ( response GcpIntegrationsResponse, err error, )
UpdateGcp updates a single Gcp integration on the Lacework Server
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithApiKeys ¶
WithApiKeys sets the key_id and secret used to generate API access tokens
func WithApiV2 ¶
func WithApiV2() Option
WithApiV2 configures the client to use the API version 2 (/api/v2)
func WithExpirationTime ¶
WithExpirationTime configures the token expiration time
func WithTokenFromKeys ¶
WithTokenFromKeys sets the API access keys and triggers a new token generation NOTE: Order matters when using this option, use it at the end of a NewClient() func
type RawIntegration ¶
type RawIntegration struct { Data map[string]interface{} `json:"DATA"` // contains filtered or unexported fields }
type RawIntegrationsResponse ¶
type RawIntegrationsResponse struct { Data []RawIntegration `json:"data"` Ok bool `json:"ok"` Message string `json:"message"` }