clcdk

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package clcdk contains reusable infrastructruce components using AWS CDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseZoneAndCerts added in v0.16.10

func BaseZoneAndCerts(scope constructs.Construct, name ScopeName, cfg Config) (
	awsroute53.IHostedZone,
	awscertificatemanager.ICertificate,
	awscertificatemanager.ICertificate,
)

BaseZoneAndCerts implements the logic for returing HostedZone and certificate constructs from just attrbutes (without lookups).

func EnvironmentFromScope added in v0.15.6

func EnvironmentFromScope(s constructs.Construct) string

EnvironmentFromScope retrieves the instance name from the context or an empty string.

func InstanceFromScope

func InstanceFromScope(s constructs.Construct) int

InstanceFromScope retrieves the instance name from the context or an empty string.

func NewInstancedStack

func NewInstancedStack(app awscdk.App) awscdk.Stack

NewInstancedStack standardizes the creation of a stack based on three context string parameters: qualifier, instance and environment.

func NewInstancedStackV1 added in v0.17.1

func NewInstancedStackV1(scope constructs.Construct, conv Conventions) awscdk.Stack

NewInstancedStackV1 requires a "instance" context variable to allow different copies of the stack to exist in the same AWS account. Deprecated: use NewInstancedStack.

func NewRegionalInstancedStack added in v0.23.7

func NewRegionalInstancedStack(app awscdk.App, region, idSuffix string) awscdk.Stack

NewRegionalInstancedStack represents a stack of which multiple may exist per region.

func NewRegionalSingletonStack added in v0.23.5

func NewRegionalSingletonStack(app awscdk.App, region, idSuffix string) awscdk.Stack

NewRegionalSingletonStack represents a stack of which only one exists per region but multiple may exist per account.

func NewSingletonStackV1 added in v0.23.4

func NewSingletonStackV1(scope constructs.Construct, conv Conventions) awscdk.Stack

NewSingletonStackV1 requires a "instance" context variable to allow different copies of the stack to exist in the same AWS account.

func QualifierFromScope added in v0.17.1

func QualifierFromScope(s constructs.Construct) string

QualifierFromScope retrieves the qualifier from the context or an empty string.

func WithGatewayDomain

func WithGatewayDomain(
	scope constructs.Construct,
	name ScopeName,
	cfg Config,
	gateway awsapigateway.IRestApi,
	zone awsroute53.IHostedZone,
	cert awscertificatemanager.ICertificate,
	subDomain string,
	basePath *string,
) awsapigateway.IDomainName

WithGatewayDomain will setup a domain for the gateway on the provided hosted zone.

func WithNativeLambda

func WithNativeLambda(
	scope constructs.Construct,
	name ScopeName,
	cfg Config,
	code awslambda.AssetCode,
	env *map[string]*string,
	logs awslogs.ILogGroup,
) awslambda.IFunction

WithNativeLambda creates a lambda for code that compiles Natively (such as Go).

func WithNetwork added in v0.15.9

func WithNetwork(
	scope constructs.Construct,
	name ScopeName,
	cfg Config,
) awsec2.IVpc

WithNetwork sets up our vpc and other networking.

func WithNodeLambbda

func WithNodeLambbda(
	scope constructs.Construct,
	name ScopeName,
	cfg Config,
	code awslambda.AssetCode,
	env *map[string]*string,
	logs awslogs.ILogGroup,
) awslambda.IFunction

WithNodeLambbda creates a NodeJS lambda with a default alias.

func WithOpenApiGateway

func WithOpenApiGateway(
	scope constructs.Construct,
	name ScopeName,
	cfg Config,
	handler awslambda.IFunction,
	schemaTmpl string,
) awsapigateway.IRestApi

WithOpenApiGateway creates a gateway that is defined by an OpenAPI definition while proxying all requests to a single Lambda Handler. This is done by treating the schema a template that will have certain values replaced. It will pick up changes to this schema and trigger a re-deploy, but changes to the templated values are not picked up (because they are still Cloudformation tokens at this stage.

func WithPostgresInstance added in v0.15.10

func WithPostgresInstance(
	scope constructs.Construct, name ScopeName, cfg Config, vpc awsec2.IVpc,
	allocatedStorageGib, maxAllocatedStorageGib float64,
) (awsrds.IDatabaseInstance, awssecretsmanager.ISecret)

withPostgresInstance will ensure an AWS RDS postgres instance is either created or imported.

func WithProxyGateway

func WithProxyGateway(
	scope constructs.Construct, name ScopeName, cfg Config, handler awslambda.IFunction,
) awsapigateway.IRestApi

WithProxyGateway will setup a gateway that proxies all requests to a Lambda, with logging and tracing enabled.

Types

type Config added in v0.15.2

type Config interface {
	Copy(opts ...ConfigOpt) Config

	LogRetention() awslogs.RetentionDays
	DomainRecordTTL() awscdk.Duration

	GatewayThrottlingRateLimit() *float64
	GatewayThrottlingBurstLimit() *float64
	GatewayDisableExecuteApi() *bool

	LambdaTimeout() awscdk.Duration
	LambdaReservedConcurrency() *float64
	LambdaProvisionedConcurrency() *float64
	LambdaApplicationLogLevel() *string
	LambdaSystemLogLevel() *string

	MainDomainName() *string
	MainDomainHostedZoneID() *string
	RegionalCertificateArn() *string
	EdgeCertificateArn() *string
	MainIPSpace() awsec2.IIpAddresses

	RemovalPolicyIfSnapshotable() awscdk.RemovalPolicy
	RemovalPolicy() awscdk.RemovalPolicy
	DeletionProtection() *bool
}

Config describes the providing of resource configuration that is often convenient to be shared between branches of the resource tree.

func NewConfig added in v0.15.2

func NewConfig(opts ...ConfigOpt) Config

NewConfig initializes a config implementation given the provided values.

func NewStagingConfig added in v0.15.2

func NewStagingConfig() Config

NewStagingConfig provides a config that provides easy-to-use defeaults for a staging environment.

type ConfigOpt added in v0.15.4

type ConfigOpt func(*config)

ConfigOpts describes a configuration option.

func WithDeletionProtection added in v0.15.19

func WithDeletionProtection(v *bool) ConfigOpt

WithDeletionProtection config.

func WithDomainRecordTTL added in v0.15.4

func WithDomainRecordTTL(v awscdk.Duration) ConfigOpt

WithDomainRecordTTL config.

func WithEdgeCertificateArn added in v0.15.4

func WithEdgeCertificateArn(v *string) ConfigOpt

WithEdgeCertificateArn config.

func WithGatewayDisableExecuteApi added in v0.15.4

func WithGatewayDisableExecuteApi(v *bool) ConfigOpt

WithGatewayDisableExecuteApi config.

func WithGatewayThrottlingBurstLimit added in v0.15.4

func WithGatewayThrottlingBurstLimit(v *float64) ConfigOpt

WithGatewayThrottlingBurstLimit config.

func WithGatewayThrottlingRateLimit added in v0.15.4

func WithGatewayThrottlingRateLimit(v *float64) ConfigOpt

WithGatewayThrottlingRateLimit config.

func WithLambdaApplicationLogLevel added in v0.15.4

func WithLambdaApplicationLogLevel(v *string) ConfigOpt

WithLambdaApplicationLogLevel config.

func WithLambdaProvisionedConcurrency added in v0.15.4

func WithLambdaProvisionedConcurrency(v *float64) ConfigOpt

WithLambdaProvisionedConcurrency config.

func WithLambdaReservedConcurrency added in v0.15.4

func WithLambdaReservedConcurrency(v *float64) ConfigOpt

WithLambdaReservedConcurrency config.

func WithLambdaSystemLogLevel added in v0.15.4

func WithLambdaSystemLogLevel(v *string) ConfigOpt

WithLambdaSystemLogLevel config.

func WithLambdaTimeout added in v0.15.4

func WithLambdaTimeout(v awscdk.Duration) ConfigOpt

WithLambdaTimeout config.

func WithLogRetention added in v0.15.4

func WithLogRetention(v awslogs.RetentionDays) ConfigOpt

WithLogRetention config.

func WithMainDomainHostedZoneID added in v0.16.10

func WithMainDomainHostedZoneID(v *string) ConfigOpt

WithMainDomainHostedZoneID config.

func WithMainDomainName added in v0.15.4

func WithMainDomainName(v *string) ConfigOpt

WithMainDomainName config.

func WithMainIPSpace added in v0.15.9

func WithMainIPSpace(v awsec2.IIpAddresses) ConfigOpt

WithMainIPSpace config.

func WithRegionalCertificateArn added in v0.15.4

func WithRegionalCertificateArn(v *string) ConfigOpt

WithRegionalCertificateArn config.

func WithRemovalPolicy added in v0.15.19

func WithRemovalPolicy(v awscdk.RemovalPolicy) ConfigOpt

WithRemovalPolicy config.

func WithRemovalPolicyIfSnapshotable added in v0.15.19

func WithRemovalPolicyIfSnapshotable(v awscdk.RemovalPolicy) ConfigOpt

WithRemovalPolicyIfSnapshotable config.

type Conventions

type Conventions interface {
	InstancedStackName(instance int) string
	SingletonStackName() string
	Qualifier() string
	MainRegion() string
	Account() string
	EnvSecretName() string
}

Conventions describes the interface for retrieving info that needs to be consistent between the stack and the other programs, i.e: magefiles. Conventions are shared between all stacks, instances, accounts and regions.

func NewConventions

func NewConventions(qual, mainRegion, account string) Conventions

NewConventions inits a convention instance.

type PostgresTenant added in v0.15.17

type PostgresTenant interface {
	DatabaseName() *string
	DatabaseUser() *string
}

PostgresTenant provides an interface to retrieve information on a unique tenant in a postgres database.

func WithPostgresTenant added in v0.15.17

func WithPostgresTenant(
	scope constructs.Construct,
	name ScopeName,
	providerToken *string,
	dbSecret awssecretsmanager.ISecret,
	tenantName string,
) PostgresTenant

WithPostgresTenant creates a tenant with.

type ScopeName

type ScopeName string

ScopeName is the name of a scope.

func (ScopeName) ChildScope

func (sn ScopeName) ChildScope(parent constructs.Construct) constructs.Construct

ChildScope returns a new scope named 'name'.

func (ScopeName) String

func (sn ScopeName) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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