Documentation ¶
Overview ¶
Package clcdk contains reusable infrastructruce components using AWS CDK.
Index ¶
- func BaseZoneAndCerts(scope constructs.Construct, name ScopeName, cfg Config) (awsroute53.IHostedZone, awscertificatemanager.ICertificate, ...)
- func EnvironmentFromScope(s constructs.Construct) string
- func InstanceFromScope(s constructs.Construct) int
- func NewInstancedStack(app awscdk.App) awscdk.Stack
- func NewInstancedStackV1(scope constructs.Construct, conv Conventions) awscdk.Stack
- func NewRegionalInstancedStack(app awscdk.App, region, idSuffix string) awscdk.Stack
- func NewRegionalSingletonStack(app awscdk.App, region, idSuffix string) awscdk.Stack
- func NewSingletonStackV1(scope constructs.Construct, conv Conventions) awscdk.Stack
- func QualifierFromScope(s constructs.Construct) string
- func WithGatewayDomain(scope constructs.Construct, name ScopeName, cfg Config, ...) awsapigateway.IDomainName
- func WithNativeLambda(scope constructs.Construct, name ScopeName, cfg Config, ...) awslambda.IFunction
- func WithNetwork(scope constructs.Construct, name ScopeName, cfg Config) awsec2.IVpc
- func WithNodeLambbda(scope constructs.Construct, name ScopeName, cfg Config, ...) awslambda.IFunction
- func WithOpenApiGateway(scope constructs.Construct, name ScopeName, cfg Config, ...) awsapigateway.IRestApi
- func WithPostgresInstance(scope constructs.Construct, name ScopeName, cfg Config, vpc awsec2.IVpc, ...) (awsrds.IDatabaseInstance, awssecretsmanager.ISecret)
- func WithProxyGateway(scope constructs.Construct, name ScopeName, cfg Config, ...) awsapigateway.IRestApi
- type Config
- type ConfigOpt
- func WithDeletionProtection(v *bool) ConfigOpt
- func WithDomainRecordTTL(v awscdk.Duration) ConfigOpt
- func WithEdgeCertificateArn(v *string) ConfigOpt
- func WithGatewayDisableExecuteApi(v *bool) ConfigOpt
- func WithGatewayThrottlingBurstLimit(v *float64) ConfigOpt
- func WithGatewayThrottlingRateLimit(v *float64) ConfigOpt
- func WithLambdaApplicationLogLevel(v *string) ConfigOpt
- func WithLambdaProvisionedConcurrency(v *float64) ConfigOpt
- func WithLambdaReservedConcurrency(v *float64) ConfigOpt
- func WithLambdaSystemLogLevel(v *string) ConfigOpt
- func WithLambdaTimeout(v awscdk.Duration) ConfigOpt
- func WithLogRetention(v awslogs.RetentionDays) ConfigOpt
- func WithMainDomainHostedZoneID(v *string) ConfigOpt
- func WithMainDomainName(v *string) ConfigOpt
- func WithMainIPSpace(v awsec2.IIpAddresses) ConfigOpt
- func WithRegionalCertificateArn(v *string) ConfigOpt
- func WithRemovalPolicy(v awscdk.RemovalPolicy) ConfigOpt
- func WithRemovalPolicyIfSnapshotable(v awscdk.RemovalPolicy) ConfigOpt
- type Conventions
- type PostgresTenant
- type ScopeName
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
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
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
WithDeletionProtection config.
func WithDomainRecordTTL ¶ added in v0.15.4
func WithDomainRecordTTL(v awscdk.Duration) ConfigOpt
WithDomainRecordTTL config.
func WithEdgeCertificateArn ¶ added in v0.15.4
WithEdgeCertificateArn config.
func WithGatewayDisableExecuteApi ¶ added in v0.15.4
WithGatewayDisableExecuteApi config.
func WithGatewayThrottlingBurstLimit ¶ added in v0.15.4
WithGatewayThrottlingBurstLimit config.
func WithGatewayThrottlingRateLimit ¶ added in v0.15.4
WithGatewayThrottlingRateLimit config.
func WithLambdaApplicationLogLevel ¶ added in v0.15.4
WithLambdaApplicationLogLevel config.
func WithLambdaProvisionedConcurrency ¶ added in v0.15.4
WithLambdaProvisionedConcurrency config.
func WithLambdaReservedConcurrency ¶ added in v0.15.4
WithLambdaReservedConcurrency config.
func WithLambdaSystemLogLevel ¶ added in v0.15.4
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
WithMainDomainHostedZoneID config.
func WithMainDomainName ¶ added in v0.15.4
WithMainDomainName config.
func WithMainIPSpace ¶ added in v0.15.9
func WithMainIPSpace(v awsec2.IIpAddresses) ConfigOpt
WithMainIPSpace config.
func WithRegionalCertificateArn ¶ added in v0.15.4
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
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.