addon

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package addon contains the service to manage addons.

Package addon contains the service to manage addons.

Index

Constants

View Source
const (
	// Engine types for RDS Aurora Serverless.
	RDSEngineTypeMySQL      = "MySQL"
	RDSEngineTypePostgreSQL = "PostgreSQL"
)
View Source
const (
	// StackName is the name of the addons nested stack resource.
	StackName = "AddonsStack"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DDBAttribute

type DDBAttribute struct {
	Name     *string
	DataType *string // Must be one of "N", "S", "B"
}

DDBAttribute holds the attribute definition of a DynamoDB attribute (keys, local secondary indices).

func DDBAttributeFromKey

func DDBAttributeFromKey(input string) (DDBAttribute, error)

DDBAttributeFromKey parses the DDB type and name out of keys specified in the form "Email:S"

type DDBLocalSecondaryIndex

type DDBLocalSecondaryIndex struct {
	PartitionKey *string
	SortKey      *string
	Name         *string
}

DDBLocalSecondaryIndex holds a representation of an LSI.

type DynamoDBProps

type DynamoDBProps struct {
	*StorageProps
	Attributes   []DDBAttribute
	LSIs         []DDBLocalSecondaryIndex
	SortKey      *string
	PartitionKey *string
	HasLSI       bool
}

DynamoDBProps contains DynamoDB-specific properties for addon.NewDDBTemplate().

func (*DynamoDBProps) BuildLocalSecondaryIndex

func (p *DynamoDBProps) BuildLocalSecondaryIndex(noLSI bool, lsiSorts []string) (bool, error)

BuildLocalSecondaryIndex generates the correct LocalSecondaryIndex property configuration based on customer input to ensure that the CF template is valid. BuildLocalSecondaryIndex should be called last, after BuildPartitionKey && BuildSortKey

func (*DynamoDBProps) BuildPartitionKey

func (p *DynamoDBProps) BuildPartitionKey(partitionKey string) error

BuildPartitionKey generates the properties required to specify the partition key based on customer inputs.

func (*DynamoDBProps) BuildSortKey

func (p *DynamoDBProps) BuildSortKey(noSort bool, sortKey string) (bool, error)

BuildSortKey generates the correct property configuration based on customer inputs.

type DynamoDBTemplate added in v1.13.0

type DynamoDBTemplate struct {
	DynamoDBProps
	// contains filtered or unexported fields
}

DynamoDBTemplate contains configuration options which fully describe a DynamoDB table. Implements the encoding.BinaryMarshaler interface.

func NewDDBTemplate added in v1.13.0

func NewDDBTemplate(input *DynamoDBProps) *DynamoDBTemplate

NewDDBTemplate creates a DynamoDB cloudformation template specifying attributes, primary key schema, and local secondary index configuration.

func (*DynamoDBTemplate) MarshalBinary added in v1.13.0

func (d *DynamoDBTemplate) MarshalBinary() ([]byte, error)

MarshalBinary serializes the content of the template into binary.

type EnvironmentStack added in v1.25.0

type EnvironmentStack struct {
	// contains filtered or unexported fields
}

EnvironmentStack represents a CloudFormation stack for environment addons.

func ParseFromEnv added in v1.25.0

func ParseFromEnv(ws WorkspaceAddonsReader) (*EnvironmentStack, error)

ParseFromEnv parses the 'addon/' directory for environments and returns a Stack created by merging the CloudFormation templates files found there. If no addons are found, ParseFromWorkload returns a nil Stack and ErrAddonsNotFound.

func (*EnvironmentStack) Package added in v1.25.0

func (s *EnvironmentStack) Package(cfg PackageConfig) error

Package finds references to local files in Stack's template, uploads the files to S3, and replaces the file path with the S3 location.

func (*EnvironmentStack) Parameters added in v1.25.0

func (s *EnvironmentStack) Parameters() (string, error)

Parameters returns Stack's CloudFormation parameters as a yaml string.

func (*EnvironmentStack) Template added in v1.25.0

func (s *EnvironmentStack) Template() (string, error)

Template returns Stack's CloudFormation template as a yaml string.

type ErrAddonsNotFound added in v1.8.2

type ErrAddonsNotFound struct {
	ParentErr error
}

ErrAddonsNotFound occurs when an addons directory for a workload is either not found or empty.

func (*ErrAddonsNotFound) Error added in v1.8.2

func (e *ErrAddonsNotFound) Error() string

type Output

type Output struct {
	// Name is the Logical ID of the output.
	Name string
	// IsSecret is true if the output value refers to a SecretsManager ARN. Otherwise, false.
	IsSecret bool
	// IsManagedPolicy is true if the output value refers to an IAM ManagedPolicy ARN. Otherwise, false.
	IsManagedPolicy bool
	// SecurityGroup is true if the output value refers a SecurityGroup ARN. Otherwise, false.
	IsSecurityGroup bool
}

Output represents an output from a CloudFormation template.

func Outputs

func Outputs(template string) ([]Output, error)

Outputs parses the Outputs section of a CloudFormation template to extract logical IDs and returns them.

type PackageConfig added in v1.21.0

type PackageConfig struct {
	Bucket        string
	Uploader      uploader
	WorkspacePath string
	FS            afero.Fs
	// contains filtered or unexported fields
}

PackageConfig contains data needed to package a Stack.

type RDSParams added in v1.13.0

type RDSParams struct {
	// contains filtered or unexported fields
}

RDSParams represents the addons.parameters.yml file for a RDS Aurora Serverless cluster.

func NewRDSParams added in v1.13.0

func NewRDSParams() *RDSParams

NewRDSParams creates a new RDS parameters marshaler.

func (*RDSParams) MarshalBinary added in v1.13.0

func (r *RDSParams) MarshalBinary() ([]byte, error)

MarshalBinary serializes the content of the params file into binary.

type RDSProps added in v1.5.0

type RDSProps struct {
	WorkloadType string // The type of the workload associated with the RDS addon.
	ClusterName  string // The name of the cluster.

	Engine         string   // The engine type of the RDS Aurora Serverless cluster.
	InitialDBName  string   // The name of the initial database created inside the cluster.
	ParameterGroup string   // The parameter group to use for the cluster.
	Envs           []string // The copilot environments found inside the current app.
	// contains filtered or unexported fields
}

RDSProps holds RDS-specific properties for addon.NewRDSTemplate().

type RDSTemplate added in v1.13.0

type RDSTemplate struct {
	RDSProps
	// contains filtered or unexported fields
}

RDSTemplate contains configuration options which fully describe a RDS Aurora Serverless cluster. Implements the encoding.BinaryMarshaler interface.

func NewServerlessV1Template added in v1.23.0

func NewServerlessV1Template(input RDSProps) *RDSTemplate

NewServerlessV1Template creates a new RDS marshaler which can be used to write an Aurora Serverless v1 CloudFormation template.

func NewServerlessV2Template added in v1.23.0

func NewServerlessV2Template(input RDSProps) *RDSTemplate

NewServerlessV2Template creates a new RDS marshaler which can be used to write an Aurora Serverless v2 CloudFormation template.

func (*RDSTemplate) MarshalBinary added in v1.13.0

func (r *RDSTemplate) MarshalBinary() ([]byte, error)

MarshalBinary serializes the content of the template into binary.

type S3Props

type S3Props struct {
	*StorageProps
}

S3Props contains S3-specific properties for addon.NewS3Template().

type S3Template added in v1.13.0

type S3Template struct {
	S3Props
	// contains filtered or unexported fields
}

S3Template contains configuration options which fully describe an S3 bucket. Implements the encoding.BinaryMarshaler interface.

func NewS3Template added in v1.13.0

func NewS3Template(input *S3Props) *S3Template

NewS3Template creates a new S3 marshaler which can be used to write CF via addonWriter.

func (*S3Template) MarshalBinary added in v1.13.0

func (s *S3Template) MarshalBinary() ([]byte, error)

MarshalBinary serializes the content of the template into binary.

type StorageProps

type StorageProps struct {
	Name string
}

StorageProps holds basic input properties for addon.NewDDBTemplate() or addon.NewS3Template().

type WorkloadStack added in v1.25.0

type WorkloadStack struct {
	// contains filtered or unexported fields
}

WorkloadStack represents a CloudFormation stack for workload addons.

func ParseFromWorkload added in v1.25.0

func ParseFromWorkload(workloadName string, ws WorkspaceAddonsReader) (*WorkloadStack, error)

ParseFromWorkload parses the 'addon/' directory for the given workload and returns a Stack created by merging the CloudFormation templates files found there. If no addons are found, ParseFromWorkload returns a nil Stack and ErrAddonsNotFound.

func (*WorkloadStack) Package added in v1.25.0

func (s *WorkloadStack) Package(cfg PackageConfig) error

Package finds references to local files in Stack's template, uploads the files to S3, and replaces the file path with the S3 location.

func (*WorkloadStack) Parameters added in v1.25.0

func (s *WorkloadStack) Parameters() (string, error)

Parameters returns Stack's CloudFormation parameters as a yaml string.

func (*WorkloadStack) Template added in v1.25.0

func (s *WorkloadStack) Template() (string, error)

Template returns Stack's CloudFormation template as a yaml string.

type WorkspaceAddonsReader added in v1.25.0

type WorkspaceAddonsReader interface {
	WorkloadAddonsPath(name string) string
	WorkloadAddonFilePath(wkldName, fName string) string
	EnvAddonsPath() string
	EnvAddonFilePath(fName string) string
	ListFiles(dirPath string) ([]string, error)
	ReadFile(fPath string) ([]byte, error)
}

WorkspaceAddonsReader finds and reads addons from a workspace.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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