ddb

package
v1.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ItemToIntegration added in v1.16.0

func ItemToIntegration(item *Integration) *models.SourceIntegration

Deprecated. This should not be exported but only be used by functions that directly interact with DynamoDB, in the ddb package. These functions should return our domain model `models.SourceIntegration`.

Types

type DDB

type DDB struct {
	Client    dynamodbiface.DynamoDBAPI
	TableName string
}

DDB is a struct containing the DynamoDB client, and the table name to retrieve data.

func New

func New(awsSession *session.Session, tableName string) *DDB

New instantiates a new client.

func (*DDB) DeleteItem added in v1.3.0

func (ddb *DDB) DeleteItem(integrationID string) error

DeleteItem deletes an integration from the database based on the integration ID

func (*DDB) GetItem added in v1.3.0

func (ddb *DDB) GetItem(integrationID string) (*Integration, error)

GetItem returns an integration by its ID

func (*DDB) ListS3SourcesWithBucket added in v1.16.0

func (ddb *DDB) ListS3SourcesWithBucket(ctx context.Context, bucket string) ([]models.SourceIntegration, error)

func (*DDB) PutItem added in v1.3.0

func (ddb *DDB) PutItem(input *Integration) error

PutItem adds a source integration to the database

func (*DDB) ScanIntegrations

func (ddb *DDB) ScanIntegrations(integrationType *string) ([]*Integration, error)

ScanIntegrations returns all enabled integrations based on type (if type is specified). It performs a DDB scan of the entire table with a filter expression.

func (*DDB) UpdateStatus added in v1.5.1

func (ddb *DDB) UpdateStatus(integrationID string, status IntegrationStatus) error

type Integration added in v1.5.1

type Integration struct {
	CreatedAtTime    time.Time `json:"createdAtTime,omitempty"`
	CreatedBy        string    `json:"createdBy,omitempty"`
	IntegrationID    string    `json:"integrationId,omitempty"`
	IntegrationLabel string    `json:"integrationLabel,omitempty"`
	IntegrationType  string    `json:"integrationType,omitempty"`

	AWSAccountID       string `json:"awsAccountId,omitempty"`
	RemediationEnabled *bool  `json:"remediationEnabled,omitempty"`
	CWEEnabled         *bool  `json:"cweEnabled,omitempty"`

	LastScanStartTime    *time.Time `json:"lastScanStartTime,omitempty"`
	LastScanEndTime      *time.Time `json:"lastScanEndTime,omitempty"`
	LastScanErrorMessage string     `json:"lastScanErrorMessage,omitempty"`
	ScanIntervalMins     int        `json:"scanIntervalMins,omitempty"`
	IntegrationStatus

	// fields for configurable cloud security sources
	Enabled                 *bool    `json:"enabled"`
	RegionIgnoreList        []string `json:"regionIgnoreList"`
	ResourceTypeIgnoreList  []string `json:"resourceTypeIgnoreList"`
	ResourceRegexIgnoreList []string `json:"resourceRegexIgnoreList"`

	// fields specific for an s3 integration (plus AWSAccountID, StackName)
	S3Bucket         string                  `json:"s3Bucket,omitempty"`
	S3PrefixLogTypes models.S3PrefixLogtypes `json:"s3PrefixLogTypes,omitempty"`
	// Deprecated. Use S3PrefixLogTypes. Kept for backwards compatibility. Don't use omitempty to overwrite to empty during writes.
	S3Prefix string `json:"s3Prefix"`
	// Deprecated. Use S3PrefixLogTypes. Kept for backwards compatibility.Don't use omitempty to overwrite to empty during writes.
	LogTypes                   []string `json:"logTypes" dynamodbav:",stringset"`
	KmsKey                     string   `json:"kmsKey,omitempty"`
	StackName                  string   `json:"stackName,omitempty"`
	LogProcessingRole          string   `json:"logProcessingRole,omitempty"`
	ManagedBucketNotifications bool     `json:"managedBucketNotifications,omitempty"`

	SqsConfig *SqsConfig `json:"sqsConfig,omitempty"`

	// The Panther version in which this source was created.
	PantherVersion string `json:"pantherVersion,omitempty"`
}

Integration represents an integration item as it is stored in DynamoDB.

type IntegrationStatus added in v1.5.1

type IntegrationStatus struct {
	ScanStatus        string     `json:"scanStatus,omitempty"`
	EventStatus       string     `json:"eventStatus,omitempty"`
	LastEventReceived *time.Time `json:"lastEventReceived,omitempty"`
}

type SqsConfig added in v1.6.0

type SqsConfig struct {
	S3Bucket             string   `json:"s3Bucket,omitempty"`
	LogProcessingRole    string   `json:"logProcessingRole,omitempty"`
	LogTypes             []string `json:"logTypes" dynamodbav:",stringset"`
	AllowedPrincipalArns []string `json:"allowedPrincipalArns" dynamodbav:",stringset"`
	AllowedSourceArns    []string `json:"allowedSourceArns" dynamodbav:",stringset"`
	QueueURL             string   `json:"queueUrl,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL