template

package
v1.33.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package template renders the static files under the "/templates/" directory.

Index

Constants

View Source
const (
	SecretInitMinEnvVersion    = "v1.4.0"
	JobRunMinEnvVersion        = "v1.12.0"
	RunLocalProxyMinEnvVersion = "v1.32.0"
)

The minimum required environment template version for various features.

View Source
const (
	ALBFeatureName                     = "ALBWorkloads"
	EFSFeatureName                     = "EFSWorkloads"
	NATFeatureName                     = "NATWorkloads"
	InternalALBFeatureName             = "InternalALBWorkloads"
	AliasesFeatureName                 = "Aliases"
	AppRunnerPrivateServiceFeatureName = "AppRunnerPrivateWorkloads"
)

Available env-controller managed feature names.

View Source
const (
	DNSCertValidatorFileName            = "dns-cert-validator"
	CertReplicatorFileName              = "cert-replicator"
	DNSDelegationFileName               = "dns-delegation"
	CustomDomainFileName                = "custom-domain"
	AppRunnerCustomDomainLambdaFileName = "custom-domain-app-runner"
)

File names under "templates/".

View Source
const (
	// AWS VPC networking configuration.
	EnablePublicIP          = "ENABLED"
	DisablePublicIP         = "DISABLED"
	PublicSubnetsPlacement  = "PublicSubnets"
	PrivateSubnetsPlacement = "PrivateSubnets"

	// RuntimePlatform configuration.
	OSLinux                 = "LINUX"
	OSWindowsServerFull     = OSWindowsServer2019Full // Alias 2019 as Default WindowsSever Full platform.
	OSWindowsServerCore     = OSWindowsServer2019Core // Alias 2019 as Default WindowsSever Core platform.
	OSWindowsServer2019Full = "WINDOWS_SERVER_2019_FULL"
	OSWindowsServer2019Core = "WINDOWS_SERVER_2019_CORE"
	OSWindowsServer2022Full = "WINDOWS_SERVER_2022_FULL"
	OSWindowsServer2022Core = "WINDOWS_SERVER_2022_CORE"

	ArchX86   = "X86_64"
	ArchARM64 = "ARM64"
)

Constants for workload options.

View Source
const AddonsStackLogicalID = "AddonsStack"

AddonsStackLogicalID is the logical ID for the addon stack resource in the main template.

View Source
const LastForceDeployIDOutputName = "LastForceDeployID"

LastForceDeployIDOutputName is the logical ID of the deployment controller output.

View Source
const (
	LogicalIDHTTPListenerRuleWithDomain = "HTTPListenerRuleWithDomain"
)

Constants for stack resource logical IDs

View Source
const (
	// NoExposedContainerPort indicates no port should be exposed for the service container.
	NoExposedContainerPort = "-1"
)

Variables

This section is empty.

Functions

func AvailableEnvFeatures added in v1.19.0

func AvailableEnvFeatures() []string

AvailableEnvFeatures returns a list of the latest available feature, named after their corresponding parameter names.

func DashReplacedLogicalIDToOriginal

func DashReplacedLogicalIDToOriginal(safeLogicalID string) string

DashReplacedLogicalIDToOriginal takes a "sanitized" logical ID and converts it back to its original form, with dashes.

func EnvVarNameFunc

func EnvVarNameFunc(s string) string

EnvVarNameFunc converts an input resource name to LogicalIDSafe, then appends "Name" to the end.

func EnvVarSecretFunc added in v1.5.0

func EnvVarSecretFunc(s string) string

EnvVarSecretFunc converts an input resource name to LogicalIDSafe, then appends "Secret" to the end.

func FmtSliceFunc

func FmtSliceFunc(elems []string) string

FmtSliceFunc renders a string representation of a go string slice, surrounded by brackets and joined by commas.

func FriendlyEnvFeatureName added in v1.19.0

func FriendlyEnvFeatureName(feature string) string

FriendlyEnvFeatureName returns a user-friendly feature name given a env-controller managed parameter name. If there isn't one, it returns the parameter name that it is given.

func IncFunc

func IncFunc(i int) int

IncFunc increments an integer value and returns the result.

func IsARNFunc added in v1.16.0

func IsARNFunc(value string) bool

IsARNFunc takes a string value and determines if it's an ARN or not.

func LeastVersionForFeature added in v1.19.0

func LeastVersionForFeature(feature string) string

LeastVersionForFeature maps each feature to the least environment template version it requires.

func QuoteSliceFunc

func QuoteSliceFunc(elems []string) []string

QuoteSliceFunc places quotation marks around all elements of a go string slice.

func ReplaceDashesFunc

func ReplaceDashesFunc(logicalID string) string

ReplaceDashesFunc takes a CloudFormation logical ID, and sanitizes it by removing "-" characters (not allowed) and replacing them with "DASH" (allowed by CloudFormation but not permitted in ecs-cli generated resource names).

func SecretFromImportedSSMOrARN added in v1.25.0

func SecretFromImportedSSMOrARN(value string) importedSSMorSecretARN

SecretFromImportedSSMOrARN returns a Secret that refers to imported name of SSM parameter or a secret ARN.

func SecretFromPlainSSMOrARN added in v1.25.0

func SecretFromPlainSSMOrARN(value string) plainSSMOrSecretARN

SecretFromPlainSSMOrARN returns a Secret that refers to an SSM parameter or a secret ARN.

func SecretFromSecretsManager added in v1.15.0

func SecretFromSecretsManager(value string) secretsManagerName

SecretFromSecretsManager returns a Secret that refers to SecretsManager secret name.

func StrconvUint16 added in v1.26.0

func StrconvUint16(val uint16) string

StrconvUint16 returns string converted from uint16.

func StripNonAlphaNumFunc

func StripNonAlphaNumFunc(s string) string

StripNonAlphaNumFunc strips non-alphanumeric characters from an input string.

func ToSnakeCaseFunc

func ToSnakeCaseFunc(s string) string

ToSnakeCaseFunc transforms a CamelCase input string s into an upper SNAKE_CASE string and returns it. For example, "usersDdbTableName" becomes "USERS_DDB_TABLE_NAME".

func TrimSlashPrefix added in v1.16.0

func TrimSlashPrefix(value string) string

TrimSlashPrefix takes a string value and removes slash prefix from the string if present.

func URLSafeVersion added in v1.29.1

func URLSafeVersion(version string) string

URLSafeVersion takes a Copilot version and replaces the '+' character with the URL-safe '%2B'.

Types

type ALBListener added in v1.27.0

type ALBListener struct {
	Rules             []ALBListenerRule
	HostedZoneAliases AliasesForHostedZone
	IsHTTPS           bool // True if the listener listening on port 443.
	MainContainerPort string
}

ALBListener holds configuration that's needed for an Application Load Balancer Listener.

func (*ALBListener) Aliases added in v1.27.0

func (cfg *ALBListener) Aliases() []string

Aliases return all the unique aliases specified across all the routing rules in ALB.

func (*ALBListener) RulePaths added in v1.27.0

func (cfg *ALBListener) RulePaths() []string

RulePaths returns a slice consisting of all the routing paths mentioned across multiple listener rules.

type ALBListenerRule added in v1.27.0

type ALBListenerRule struct {
	// The path that the Application Load Balancer listens to.
	Path string
	// The target container and port to which the traffic is routed to from the Application Load Balancer.
	TargetContainer string
	TargetPort      string

	Aliases             []string
	AllowedSourceIps    []string
	Stickiness          string
	HTTPHealthCheck     HTTPHealthCheckOpts
	HTTPVersion         string
	RedirectToHTTPS     bool // Only relevant if HTTPSListener is true.
	DeregistrationDelay *int64
}

ALBListenerRule holds configuration that's needed for an Application Load Balancer listener rule.

func (ALBListenerRule) HealthCheckProtocol added in v1.27.0

func (lr ALBListenerRule) HealthCheckProtocol() string

HealthCheckProtocol returns the protocol for the Load Balancer health check, or an empty string if it shouldn't be configured, defaulting to the target protocol. (which is what happens, even if it isn't documented as such :)) https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-healthcheckprotocol

type Addons added in v1.25.0

type Addons struct {
	URL         string
	ExtraParams string
}

Addons holds data about an aggregated addons stack.

type AdvancedCount added in v1.6.0

type AdvancedCount struct {
	Spot        *int
	Autoscaling *AutoscalingOpts
	Cps         []*CapacityProviderStrategy
}

AdvancedCount holds configuration for autoscaling and capacity provider parameters.

type AliasesForHostedZone added in v1.19.0

type AliasesForHostedZone map[string][]string

AliasesForHostedZone maps hosted zone IDs to aliases that belong to it.

type AutoscalingOpts added in v0.4.0

type AutoscalingOpts struct {
	MinCapacity        *int
	MaxCapacity        *int
	CPU                *float64
	Memory             *float64
	Requests           *float64
	ResponseTime       *float64
	CPUCooldown        Cooldown
	MemCooldown        Cooldown
	ReqCooldown        Cooldown
	RespTimeCooldown   Cooldown
	QueueDelayCooldown Cooldown
	QueueDelay         *AutoscalingQueueDelayOpts
}

AutoscalingOpts holds configuration that's needed for Auto Scaling.

type AutoscalingQueueDelayOpts added in v1.11.0

type AutoscalingQueueDelayOpts struct {
	AcceptableBacklogPerTask int
}

AutoscalingQueueDelayOpts holds configuration to scale SQS queues.

type CDKImport added in v1.27.0

type CDKImport interface {
	ImportName() string
	ImportShortRename() string
}

CDKImport is the interface to import a CDK package.

type CDNConfig added in v1.20.0

type CDNConfig struct {
	ImportedCertificate *string
	TerminateTLS        bool
	Static              *CDNStaticAssetConfig
}

CDNConfig represents a Content Delivery Network deployed by CloudFront.

type CDNStaticAssetConfig added in v1.25.0

type CDNStaticAssetConfig struct {
	Path           string
	ImportedBucket string
	Alias          string
}

CDNStaticAssetConfig represents static assets config for a Content Delivery Network.

type CFNResource added in v1.25.0

type CFNResource struct {
	Type      CFNType
	LogicalID string
}

CFNResource represents a resource rendered in a CloudFormation template.

type CFNType added in v1.25.0

type CFNType string

CFNType is a CloudFormation resource type such as "AWS::ECS::Service".

func (CFNType) ImportName added in v1.25.0

func (t CFNType) ImportName() string

ImportName returns the name of the CDK package for the given CloudFormation type.

func (CFNType) ImportShortRename added in v1.25.0

func (t CFNType) ImportShortRename() string

ImportShortRename returns a human-friendly shortened rename of the CDK package for the given CloudFormation type.

func (CFNType) L1ConstructName added in v1.25.0

func (t CFNType) L1ConstructName() string

L1ConstructName returns the name of the L1 construct representing the CloudFormation type.

type CapacityProviderStrategy added in v1.6.0

type CapacityProviderStrategy struct {
	Base             *int
	Weight           *int
	CapacityProvider string
}

CapacityProviderStrategy holds the configuration needed for a CapacityProviderStrategyItem on a Service

type ContainerHealthCheck added in v1.11.0

type ContainerHealthCheck struct {
	Command     []string
	Interval    *int64
	Retries     *int64
	StartPeriod *int64
	Timeout     *int64
}

ContainerHealthCheck holds configuration for container health check.

type Content

type Content struct {
	*bytes.Buffer
}

Content represents the parsed template.

func (*Content) MarshalBinary

func (c *Content) MarshalBinary() ([]byte, error)

MarshalBinary returns the contents as binary and implements the encoding.BinaryMarshaler interface.

type Cooldown added in v1.20.0

type Cooldown struct {
	ScaleInCooldown  *float64
	ScaleOutCooldown *float64
}

Cooldown holds configuration needed for autoscaling cooldown fields.

type DeadLetterQueue added in v1.9.0

type DeadLetterQueue struct {
	Tries *uint16
}

DeadLetterQueue holds information needed to render a dead-letter SQS Queue in a container definition.

type DeploymentConfigurationOpts added in v1.18.0

type DeploymentConfigurationOpts struct {
	// The lower limit on the number of tasks that should be running during a service deployment or when a container instance is draining.
	MinHealthyPercent int
	// The upper limit on the number of tasks that should be running during a service deployment or when a container instance is draining.
	MaxPercent int
	Rollback   RollingUpdateRollbackConfig
}

DeploymentConfigurationOpts holds configuration for rolling deployments.

type EFSPermission added in v1.3.0

type EFSPermission struct {
	FilesystemID  FileSystemID
	Write         bool
	AccessPointID *string
}

EFSPermission holds information needed to render an IAM policy statement.

type EFSVolumeConfiguration added in v1.5.0

type EFSVolumeConfiguration struct {
	// EFSVolumeConfiguration
	Filesystem    FileSystemID
	RootDirectory *string // "/" or empty are equivalent

	// Authorization Config
	AccessPointID *string
	IAM           *string // ENABLED or DISABLED
}

EFSVolumeConfiguration contains information about how to specify externally managed file systems.

type ELBAccessLogs added in v1.21.0

type ELBAccessLogs struct {
	BucketName string
	Prefix     string
}

ELBAccessLogs represents configuration for ELB access logs S3 bucket.

func (*ELBAccessLogs) ShouldCreateBucket added in v1.21.0

func (elb *ELBAccessLogs) ShouldCreateBucket() bool

ShouldCreateBucket returns true if copilot should create bucket on behalf of customer.

type EnvOpts added in v0.3.0

type EnvOpts struct {
	AppName       string // The application name. Needed to create default value for svc discovery endpoint for upgraded environments.
	EnvName       string
	LatestVersion string

	// Custom Resources backed by Lambda functions.
	CustomResources           map[string]S3ObjectLocation
	DNSDelegationLambda       string
	DNSCertValidatorLambda    string
	EnableLongARNFormatLambda string
	CustomDomainLambda        string

	Addons               *Addons
	ScriptBucketName     string
	PermissionsBoundary  string
	ArtifactBucketARN    string
	ArtifactBucketKeyARN string

	VPCConfig         VPCConfig
	PublicHTTPConfig  PublicHTTPConfig
	PrivateHTTPConfig PrivateHTTPConfig
	Telemetry         *Telemetry
	CDNConfig         *CDNConfig

	SerializedManifest string // Serialized manifest used to render the environment template.
	ForceUpdateID      string

	DelegateDNS bool
}

EnvOpts holds data that can be provided to enable features in an environment stack template.

func (*EnvOpts) HasImportedCerts added in v1.22.1

func (e *EnvOpts) HasImportedCerts() bool

HasImportedCerts returns true if any https certificates have been imported to the environment.

type ExecuteCommandOpts added in v1.4.0

type ExecuteCommandOpts struct{}

ExecuteCommandOpts holds configuration that's needed for ECS Execute Command.

type FIFOQueueConfig added in v1.22.0

type FIFOQueueConfig struct {
	FIFOThroughputLimit       *string
	ContentBasedDeduplication *bool
	DeduplicationScope        *string
}

FIFOQueueConfig holds information needed to render a FIFO SQS Queue in a container definition.

type FIFOTopicConfig added in v1.22.0

type FIFOTopicConfig struct {
	ContentBasedDeduplication *bool
}

FIFOTopicConfig holds configuration needed if the topic is FIFO.

type FileSystemID added in v1.30.0

type FileSystemID importableValue

FileSystemID represnts the EFS FilesystemID.

func ImportedFileSystemID added in v1.30.0

func ImportedFileSystemID(value string) FileSystemID

ImportedFileSystemID returns a EFS FilesystemID that is imported from a stack.

func PlainFileSystemID added in v1.30.0

func PlainFileSystemID(value string) FileSystemID

PlainFileSystemID returns a EFS FilesystemID that is a plain string value.

type HTTPConfig added in v1.21.0

type HTTPConfig struct {
	SSLPolicy        *string
	ImportedCertARNs []string
}

HTTPConfig represents configuration for a Load Balancer.

type HTTPHealthCheckOpts added in v0.6.0

type HTTPHealthCheckOpts struct {
	// Fields with defaults always set.
	HealthCheckPath string
	GracePeriod     int64

	// Optional.
	Port                string
	SuccessCodes        string
	HealthyThreshold    *int64
	UnhealthyThreshold  *int64
	Interval            *int64
	Timeout             *int64
	DeregistrationDelay *int64
}

HTTPHealthCheckOpts holds configuration that's needed for HTTP Health Check.

type ImportVPC added in v1.18.0

type ImportVPC struct {
	ID               string
	PublicSubnetIDs  []string
	PrivateSubnetIDs []string
}

ImportVPC holds the fields to import VPC resources.

type ImportedALB added in v1.32.0

type ImportedALB struct {
	Name         string
	ARN          string
	DNSName      string
	HostedZoneID string

	Listeners      []LBListener
	SecurityGroups []LBSecurityGroup
}

ImportedALB holds the fields to import an existing ALB.

func (*ImportedALB) HTTPListenerARN added in v1.32.0

func (alb *ImportedALB) HTTPListenerARN() string

HTTPListenerARN returns the listener ARN if the protocol is HTTP.

func (*ImportedALB) HTTPSListenerARN added in v1.32.0

func (alb *ImportedALB) HTTPSListenerARN() string

HTTPSListenerARN returns the listener ARN if the protocol is HTTPS.

type LBListener added in v1.32.0

type LBListener struct {
	ARN      string
	Port     int64
	Protocol string
}

LBListener struct represents the listener of a load balancer. // TODO(jwh): instead, reuse ALBListener

type LBSecurityGroup added in v1.32.0

type LBSecurityGroup struct {
	ID string
}

LBSecurityGroup struct represents the security group of a load balancer.

type LogConfigOpts

type LogConfigOpts struct {
	Image          *string
	Destination    map[string]string
	EnableMetadata *string
	SecretOptions  map[string]Secret
	ConfigFile     *string
	Variables      map[string]Variable
	Secrets        map[string]Secret
}

LogConfigOpts holds configuration that's needed if the service is configured with Firelens to route its logs.

type ManagedVPC added in v1.18.0

type ManagedVPC struct {
	CIDR               string
	AZs                []string
	PublicSubnetCIDRs  []string
	PrivateSubnetCIDRs []string
}

ManagedVPC holds the fields to configure a managed VPC.

type ManagedVolumeCreationInfo added in v1.5.0

type ManagedVolumeCreationInfo struct {
	Name    *string
	DirName *string
	UID     *uint32
	GID     *uint32
}

ManagedVolumeCreationInfo holds information about how to create Copilot-managed access points.

type MountPoint added in v1.3.0

type MountPoint struct {
	ContainerPath *string
	ReadOnly      *bool
	SourceVolume  *string
}

MountPoint holds information needed to render a MountPoint in a containerdefinition.

type NLBHealthCheck added in v1.14.0

type NLBHealthCheck struct {
	Port               string // The port to which health check requests made from Network Load Balancer are routed to.
	HealthyThreshold   *int64
	UnhealthyThreshold *int64
	Timeout            *int64
	Interval           *int64
	GracePeriod        *int64
}

NLBHealthCheck holds configuration for Network Load Balancer health check.

type NetworkLoadBalancer added in v1.13.0

type NetworkLoadBalancer struct {
	Listener            []NetworkLoadBalancerListener
	MainContainerPort   string
	CertificateRequired bool
	Aliases             []string
}

NetworkLoadBalancer holds configuration that's needed for a Network Load Balancer.

type NetworkLoadBalancerListener added in v1.13.0

type NetworkLoadBalancerListener struct {
	// The port and protocol that the Network Load Balancer listens to.
	Port     string
	Protocol string

	// The target container and port to which the traffic is routed to from the Network Load Balancer.
	TargetContainer string
	TargetPort      string

	SSLPolicy *string // The SSL policy applied when using TLS protocol.

	Stickiness          *bool
	HealthCheck         NLBHealthCheck
	DeregistrationDelay *int64
}

NetworkLoadBalancerListener holds configuration that's need for a Network Load Balancer listener.

type NetworkOpts added in v1.3.0

type NetworkOpts struct {
	SecurityGroups []SecurityGroup
	AssignPublicIP string
	// SubnetsType and SubnetIDs are mutually exclusive. They won't be set together.
	SubnetsType              string
	SubnetIDs                []string
	DenyDefaultSecurityGroup bool
}

NetworkOpts holds AWS networking configuration for the workloads.

type ObservabilityOpts added in v1.16.0

type ObservabilityOpts struct {
	Tracing string // The name of the vendor used for tracing.
}

ObservabilityOpts holds configurations for observability.

type ParseOption

type ParseOption func(t *template.Template) *template.Template

ParseOption represents a functional option for the Parse method.

func WithFuncs

func WithFuncs(fns map[string]interface{}) ParseOption

WithFuncs returns a template that can parse additional custom functions.

type Parser

type Parser interface {
	Parse(path string, data interface{}, options ...ParseOption) (*Content, error)
}

Parser is the interface that wraps the Parse method.

type PortMapping added in v1.26.0

type PortMapping struct {
	Protocol      string
	ContainerPort uint16
	ContainerName string
}

PortMapping holds container port mapping configuration.

type PrivateHTTPConfig added in v1.23.0

type PrivateHTTPConfig struct {
	HTTPConfig
	CustomALBSubnets []string
}

PrivateHTTPConfig represents configuration for an internal Load Balancer.

type PublicHTTPConfig added in v1.23.0

type PublicHTTPConfig struct {
	HTTPConfig
	PublicALBSourceIPs []string
	CIDRPrefixListIDs  []string
	ELBAccessLogs      *ELBAccessLogs
}

PublicHTTPConfig represents configuration for a public facing Load Balancer.

func (*PublicHTTPConfig) HasCustomIngress added in v1.23.0

func (cfg *PublicHTTPConfig) HasCustomIngress() bool

HasCustomIngress returns true if there is any ingress specified by the customer.

type PublishOpts added in v1.8.3

type PublishOpts struct {
	Topics []*Topic
}

PublishOpts holds configuration needed if the service has publishers.

type ReadParser

type ReadParser interface {
	Reader
	Parser
}

ReadParser is the interface that wraps the Read and Parse methods.

type Reader added in v1.19.0

type Reader interface {
	Read(path string) (*Content, error)
}

Reader is the interface that wraps the Read method.

type RollingUpdateRollbackConfig added in v1.25.0

type RollingUpdateRollbackConfig struct {
	AlarmNames []string // Names of existing alarms.

	// Custom alarms to create.
	CPUUtilization    *float64
	MemoryUtilization *float64
	MessagesDelayed   *int
}

RollingUpdateRollbackConfig holds config for rollback alarms.

func (RollingUpdateRollbackConfig) HasCustomAlarms added in v1.25.0

func (cfg RollingUpdateRollbackConfig) HasCustomAlarms() bool

HasCustomAlarms returns true if the client is using Copilot-generated alarms for alarm-based rollbacks.

func (RollingUpdateRollbackConfig) HasRollbackAlarms added in v1.25.0

func (cfg RollingUpdateRollbackConfig) HasRollbackAlarms() bool

HasRollbackAlarms returns true if the client is using ABR.

func (RollingUpdateRollbackConfig) TruncateAlarmName added in v1.25.0

func (cfg RollingUpdateRollbackConfig) TruncateAlarmName(app, env, svc, alarmType string) string

TruncateAlarmName ensures that alarm names don't exceed the 255 character limit.

type RuntimePlatformOpts added in v1.12.0

type RuntimePlatformOpts struct {
	OS   string
	Arch string
}

RuntimePlatformOpts holds configuration needed for Platform configuration.

func (RuntimePlatformOpts) IsDefault added in v1.12.0

func (p RuntimePlatformOpts) IsDefault() bool

IsDefault returns true if the platform matches the default docker image platform of "linux/amd64".

func (RuntimePlatformOpts) Version added in v1.12.0

func (p RuntimePlatformOpts) Version() string

Version returns the Fargate platform version based on the selected os family.

type S3ObjectLocation added in v1.20.0

type S3ObjectLocation struct {
	Bucket string // Name of the bucket.
	Key    string // Key of the object.
}

S3ObjectLocation represents an object stored in an S3 bucket.

type SQSQueue added in v1.9.0

type SQSQueue struct {
	Retention       *int64
	Delay           *int64
	Timeout         *int64
	DeadLetter      *DeadLetterQueue
	FIFOQueueConfig *FIFOQueueConfig
}

SQSQueue holds information needed to render a SQS Queue in a container definition.

func (SQSQueue) IsFIFO added in v1.22.0

func (s SQSQueue) IsFIFO() bool

IsFIFO checks if the given queue has FIFO config.

type Secret added in v1.15.0

type Secret importableSubValueFrom

A Secret represents an SSM or SecretsManager secret that can be rendered in CloudFormation.

type SecurityGroup added in v1.25.0

type SecurityGroup importableValue

SecurityGroup represents the ID of an additional security group associated with the tasks.

func ImportedSecurityGroup added in v1.25.0

func ImportedSecurityGroup(name string) SecurityGroup

ImportedSecurityGroup returns a SecurityGroup that should be imported from a stack.

func PlainSecurityGroup added in v1.25.0

func PlainSecurityGroup(value string) SecurityGroup

PlainSecurityGroup returns a SecurityGroup that is a plain string value.

type SecurityGroupConfig added in v1.21.0

type SecurityGroupConfig struct {
	Ingress []SecurityGroupRule
	Egress  []SecurityGroupRule
}

SecurityGroupConfig holds the fields to import security group config

type SecurityGroupRule added in v1.21.0

type SecurityGroupRule struct {
	CidrIP     string
	FromPort   int
	IpProtocol string
	ToPort     int
}

SecurityGroupRule holds the fields to import security group rule

type ServiceConnectOpts added in v1.31.0

type ServiceConnectOpts struct {
	Server *ServiceConnectServer
	Client bool
}

ServiceConnectOpts defines the options for service connect. If Client is false, logically Server must be nil.

type ServiceConnectServer added in v1.31.0

type ServiceConnectServer struct {
	Name  string
	Port  string
	Alias string
}

ServiceConnectServer defines the container name and port which a service routes Service Connect through.

type SidecarOpts

type SidecarOpts struct {
	Name         string
	Image        *string
	Essential    *bool
	CredsParam   *string
	Variables    map[string]Variable
	Secrets      map[string]Secret
	Storage      SidecarStorageOpts
	DockerLabels map[string]string
	DependsOn    map[string]string
	EntryPoint   []string
	Command      []string
	HealthCheck  *ContainerHealthCheck
	PortMappings []*PortMapping
}

SidecarOpts holds configuration that's needed if the service has sidecar containers.

type SidecarStorageOpts added in v1.12.0

type SidecarStorageOpts struct {
	MountPoints []*MountPoint
}

SidecarStorageOpts holds data structures for rendering Mount Points inside of a sidecar.

type StateMachineOpts added in v0.5.0

type StateMachineOpts struct {
	Timeout *int
	Retries *int
}

StateMachineOpts holds configuration needed for State Machine retries and timeout.

type StorageOpts added in v1.3.0

type StorageOpts struct {
	Ephemeral         *int
	ReadonlyRootFS    *bool
	Volumes           []*Volume
	MountPoints       []*MountPoint
	EFSPerms          []*EFSPermission
	ManagedVolumeInfo *ManagedVolumeCreationInfo // Used for delegating CreationInfo for Copilot-managed EFS.
}

StorageOpts holds data structures for rendering Volumes and Mount Points

type SubscribeOpts added in v1.9.0

type SubscribeOpts struct {
	Topics []*TopicSubscription
	Queue  *SQSQueue
}

SubscribeOpts holds configuration needed if the service has subscriptions.

func (*SubscribeOpts) HasTopicQueues added in v1.10.0

func (s *SubscribeOpts) HasTopicQueues() bool

HasTopicQueues returns true if any individual subscription has a dedicated queue.

type Telemetry added in v1.18.0

type Telemetry struct {
	EnableContainerInsights bool
}

Telemetry represents optional observability and monitoring configuration.

type Template

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

Template represents the "/templates/" directory that holds static files to be embedded in the binary.

func New

func New() *Template

New returns a Template object that can be used to parse files under the "/templates/" directory.

func (*Template) Parse

func (t *Template) Parse(path string, data interface{}, options ...ParseOption) (*Content, error)

Parse parses the template under "/templates/{path}" with the specified data object and returns its content.

func (*Template) ParseBackendService

func (t *Template) ParseBackendService(data WorkloadOpts) (*Content, error)

ParseBackendService parses a backend service's CloudFormation template with the specified data object and returns its content.

func (*Template) ParseEnv added in v0.3.0

func (t *Template) ParseEnv(data *EnvOpts) (*Content, error)

ParseEnv parses an environment's CloudFormation template with the specified data object and returns its content.

func (*Template) ParseEnvBootstrap added in v1.20.0

func (t *Template) ParseEnvBootstrap(data *EnvOpts, options ...ParseOption) (*Content, error)

ParseEnvBootstrap parses the CloudFormation template that bootstrap IAM resources with the specified data object and returns its content.

func (*Template) ParseLoadBalancedWebService

func (t *Template) ParseLoadBalancedWebService(data WorkloadOpts) (*Content, error)

ParseLoadBalancedWebService parses a load balanced web service's CloudFormation template with the specified data object and returns its content.

func (*Template) ParsePipeline added in v1.29.1

func (t *Template) ParsePipeline(data interface{}) (*Content, error)

ParsePipeline parses a pipeline's CloudFormation template with the specified data object and returns its content.

func (*Template) ParseRequestDrivenWebService added in v1.7.0

func (t *Template) ParseRequestDrivenWebService(data WorkloadOpts) (*Content, error)

ParseRequestDrivenWebService parses a request-driven web service's CloudFormation template with the specified data object and returns its content.

func (*Template) ParseScheduledJob added in v0.5.0

func (t *Template) ParseScheduledJob(data WorkloadOpts) (*Content, error)

ParseScheduledJob parses a scheduled job's Cloudformation Template

func (*Template) ParseStaticSite added in v1.27.0

func (t *Template) ParseStaticSite(data WorkloadOpts) (*Content, error)

ParseStaticSite parses a static site service's CloudFormation template with the specified data object and returns its content.

func (*Template) ParseWorkerService added in v1.9.0

func (t *Template) ParseWorkerService(data WorkloadOpts) (*Content, error)

ParseWorkerService parses a worker service's CloudFormation template with the specified data object and returns its content.

func (*Template) Read

func (t *Template) Read(path string) (*Content, error)

Read returns the contents of the template under "/templates/{path}".

func (*Template) UploadEnvironmentCustomResources added in v1.4.0

func (t *Template) UploadEnvironmentCustomResources(upload s3.CompressAndUploadFunc) (map[string]string, error)

UploadEnvironmentCustomResources uploads the environment custom resource scripts.

func (*Template) WalkOverridesCDKDir added in v1.25.0

func (t *Template) WalkOverridesCDKDir(resources []CFNResource, fn WalkDirFunc, requiresEnv bool) error

WalkOverridesCDKDir walks through the overrides/cdk templates and calls fn for each parsed template file.

func (*Template) WalkOverridesPatchDir added in v1.27.0

func (t *Template) WalkOverridesPatchDir(fn WalkDirFunc) error

WalkOverridesPatchDir walks through the overrides/yamlpatch templates and calls fn for each parsed template file.

type Topic added in v1.9.0

type Topic struct {
	Name            *string
	FIFOTopicConfig *FIFOTopicConfig

	Region    string
	Partition string
	AccountID string
	App       string
	Env       string
	Svc       string
}

Topic holds information needed to render a SNSTopic in a container definition.

func (Topic) ARN added in v1.9.0

func (t Topic) ARN() string

ARN determines the arn for a topic using the SNSTopic name and account information

type TopicSubscription added in v1.9.0

type TopicSubscription struct {
	Name         *string
	Service      *string
	FilterPolicy *string
	Queue        *SQSQueue
}

TopicSubscription holds information needed to render a SNS Topic Subscription in a container definition.

type Uploadable added in v1.4.0

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

Uploadable is an uploadable file.

func (Uploadable) Content added in v1.4.0

func (e Uploadable) Content() []byte

Content returns the content of the custom resource script.

func (Uploadable) Name added in v1.4.0

func (e Uploadable) Name() string

Name returns the name of the custom resource script.

type VPCConfig added in v1.18.0

type VPCConfig struct {
	Imported            *ImportVPC // If not-nil, use the imported VPC resources instead of the Managed VPC.
	Managed             ManagedVPC
	AllowVPCIngress     bool
	SecurityGroupConfig *SecurityGroupConfig
	FlowLogs            *VPCFlowLogs
}

VPCConfig represents the VPC configuration.

type VPCFlowLogs added in v1.24.0

type VPCFlowLogs struct {
	Retention *int
}

VPCFlowLogs holds the fields to configure logging IP traffic using VPC flow logs.

type Variable added in v1.25.0

type Variable importableValue

Variable represents the value of an environment variable.

func ImportedVariable added in v1.25.0

func ImportedVariable(name string) Variable

ImportedVariable returns a Variable that should be imported from a stack.

func PlainVariable added in v1.25.0

func PlainVariable(value string) Variable

PlainVariable returns a Variable that is a plain string value.

type Volume added in v1.3.0

type Volume struct {
	Name *string

	EFS *EFSVolumeConfiguration
}

Volume contains fields that render a volume, its name, and EFSVolumeConfiguration

type WalkDirFunc added in v1.25.0

type WalkDirFunc func(name string, content *Content) error

WalkDirFunc is the type of the function called by any Walk functions while visiting each file under a directory.

type WorkloadNestedStackOpts added in v0.5.0

type WorkloadNestedStackOpts struct {
	StackName string

	VariableOutputs      []string
	SecretOutputs        []string
	PolicyOutputs        []string
	SecurityGroupOutputs []string
}

WorkloadNestedStackOpts holds configuration that's needed if the workload stack has a nested stack.

type WorkloadOpts added in v0.5.0

type WorkloadOpts struct {
	AppName            string
	EnvName            string
	WorkloadName       string
	SerializedManifest string // Raw manifest file used to deploy the workload.
	EnvVersion         string
	Version            string

	// Configuration for the main container.
	PortMappings []*PortMapping
	Variables    map[string]Variable
	Secrets      map[string]Secret
	EntryPoint   []string
	Command      []string
	ImportedALB  *ImportedALB

	// Additional options that are common between **all** workload templates.
	Tags                     map[string]string        // Used by App Runner workloads to tag App Runner service resources
	NestedStack              *WorkloadNestedStackOpts // Outputs from nested stacks such as the addons stack.
	AddonsExtraParams        string                   // Additional user defined Parameters for the addons stack.
	Sidecars                 []*SidecarOpts
	LogConfig                *LogConfigOpts
	Autoscaling              *AutoscalingOpts
	CapacityProviders        []*CapacityProviderStrategy
	DesiredCountOnSpot       *int
	Storage                  *StorageOpts
	Network                  NetworkOpts
	ExecuteCommand           *ExecuteCommandOpts
	Platform                 RuntimePlatformOpts
	DockerLabels             map[string]string
	DependsOn                map[string]string
	Publish                  *PublishOpts
	ServiceDiscoveryEndpoint string
	ALBEnabled               bool
	CredentialsParameter     string
	PermissionsBoundary      string

	// Additional options for service templates.
	WorkloadType            string
	HealthCheck             *ContainerHealthCheck
	GracePeriod             *int64
	NLB                     *NetworkLoadBalancer
	ALBListener             *ALBListener
	DeploymentConfiguration DeploymentConfigurationOpts
	ServiceConnectOpts      ServiceConnectOpts

	// Custom Resources backed by Lambda functions.
	CustomResources map[string]S3ObjectLocation

	// Additional options for job templates.
	ScheduleExpression string
	StateMachine       *StateMachineOpts

	// Additional options for request driven web service templates.
	StartCommand         *string
	EnableHealthCheck    bool
	Observability        ObservabilityOpts
	Private              bool
	AppRunnerVPCEndpoint *string
	Count                *string

	// Input needed for the custom resource that adds a custom domain to the service.
	Alias                *string
	AWSSDKLayer          *string
	AppDNSDelegationRole *string
	AppDNSName           *string

	// Additional options for worker service templates.
	Subscribe *SubscribeOpts

	// Additional options for static site template.
	AssetMappingFileBucket string
	AssetMappingFilePath   string
	StaticSiteAlias        string
	StaticSiteCert         string
}

WorkloadOpts holds optional data that can be provided to enable features in a workload stack template.

Directories

Path Synopsis
Package artifactpath holds functions to generate the S3 object path for artifacts.
Package artifactpath holds functions to generate the S3 object path for artifacts.
Package diff provides functionalities to compare two YAML documents.
Package diff provides functionalities to compare two YAML documents.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package override provides functionality to replace content from vended templates.
Package override provides functionality to replace content from vended templates.
Package templatetest provides test doubles for embedded templates.
Package templatetest provides test doubles for embedded templates.

Jump to

Keyboard shortcuts

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