Documentation
¶
Overview ¶
Package template renders the static files under the "/templates/" directory.
Index ¶
- func DashReplacedLogicalIDToOriginal(safeLogicalID string) string
- func EnvVarNameFunc(s string) string
- func FmtSliceFunc(elems []string) string
- func IncFunc(i int) int
- func QuotePSliceFunc(elems []*string) []string
- func QuoteSliceFunc(elems []string) []string
- func ReplaceDashesFunc(logicalID string) string
- func StripNonAlphaNumFunc(s string) string
- func ToSnakeCaseFunc(s string) string
- type AutoscalingOpts
- type Content
- type EnvOpts
- type HTTPHealthCheckOpts
- type LogConfigOpts
- type ParseOption
- type Parser
- type ReadParser
- type SidecarOpts
- type StateMachineOpts
- type Template
- func (t *Template) Parse(path string, data interface{}, options ...ParseOption) (*Content, error)
- func (t *Template) ParseBackendService(data WorkloadOpts) (*Content, error)
- func (t *Template) ParseEnv(data *EnvOpts, options ...ParseOption) (*Content, error)
- func (t *Template) ParseLoadBalancedWebService(data WorkloadOpts) (*Content, error)
- func (t *Template) ParseScheduledJob(data WorkloadOpts) (*Content, error)
- func (t *Template) Read(path string) (*Content, error)
- type WorkloadNestedStackOpts
- type WorkloadOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DashReplacedLogicalIDToOriginal ¶
DashReplacedLogicalIDToOriginal takes a "sanitized" logical ID and converts it back to its original form, with dashes.
func EnvVarNameFunc ¶
EnvVarNameFunc converts an input resource name to LogicalIDSafe, then appends "Name" to the end.
func FmtSliceFunc ¶
FmtSliceFunc renders a string representation of a go string slice, surrounded by brackets and joined by commas.
func QuotePSliceFunc ¶
QuotePSliceFunc places quotation marks around all dereferenced elements of elems and returns a []string slice.
func QuoteSliceFunc ¶
QuoteSliceFunc places quotation marks around all elements of a go string slice.
func ReplaceDashesFunc ¶
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 StripNonAlphaNumFunc ¶
StripNonAlphaNumFunc strips non-alphanumeric characters from an input string.
func ToSnakeCaseFunc ¶
ToSnakeCaseFunc transforms a CamelCase input string s into an upper SNAKE_CASE string and returns it. For example, "usersDdbTableName" becomes "USERS_DDB_TABLE_NAME".
Types ¶
type AutoscalingOpts ¶ added in v0.4.0
type AutoscalingOpts struct { MinCapacity *int MaxCapacity *int CPU *float64 Memory *float64 Requests *float64 ResponseTime *float64 }
AutoscalingOpts holds configuration that's needed for Auto Scaling.
type Content ¶
Content represents the parsed template.
func (*Content) MarshalBinary ¶
MarshalBinary returns the contents as binary and implements the encoding.BinaryMarshaler interface.
type EnvOpts ¶ added in v0.3.0
type EnvOpts struct { Version string // The template version to use for the environment. If empty uses the "legacy" template. DNSDelegationLambda string ACMValidationLambda string EnableLongARNFormatLambda string ImportVPC *config.ImportVPC VPCConfig *config.AdjustVPC }
EnvOpts holds data that can be provided to enable features in an environment stack template.
type HTTPHealthCheckOpts ¶ added in v0.6.0
type HTTPHealthCheckOpts struct { HealthCheckPath string HealthyThreshold *int64 UnhealthyThreshold *int64 Interval *int64 Timeout *int64 }
HTTPHealthCheckOpts holds configuration that's needed for HTTP Health Check.
type LogConfigOpts ¶
type LogConfigOpts struct { Image *string Destination map[string]string EnableMetadata *string SecretOptions map[string]string ConfigFile *string }
LogConfigOpts holds configuration that's needed if the service is configured with Firelens to route its logs.
type ParseOption ¶
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 ReadParser ¶
ReadParser is the interface that wraps the Read and Parse methods.
type SidecarOpts ¶
type SidecarOpts struct { Name *string Image *string Port *string Protocol *string CredsParam *string }
SidecarOpts holds configuration that's needed if the service has sidecar containers.
type StateMachineOpts ¶ added in v0.5.0
StateMachineOpts holds configuration neeed for State Machine retries and timeout.
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, options ...ParseOption) (*Content, error)
ParseEnv parses an environment's CloudFormation template 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) ParseScheduledJob ¶ added in v0.5.0
func (t *Template) ParseScheduledJob(data WorkloadOpts) (*Content, error)
ParseScheduledJob parses a scheduled job's Cloudformation Template
type WorkloadNestedStackOpts ¶ added in v0.5.0
type WorkloadNestedStackOpts struct { StackName string VariableOutputs []string SecretOutputs []string PolicyOutputs []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 { // Additional options that are common between **all** workload templates. Variables map[string]string Secrets map[string]string NestedStack *WorkloadNestedStackOpts // Outputs from nested stacks such as the addons stack. Sidecars []*SidecarOpts LogConfig *LogConfigOpts Autoscaling *AutoscalingOpts // Additional options for service templates. HealthCheck *ecs.HealthCheck HTTPHealthCheck HTTPHealthCheckOpts AllowedSourceIps []string RulePriorityLambda string DesiredCountLambda string EnvControllerLambda string // Additional options for job templates. ScheduleExpression string StateMachine *StateMachineOpts }
WorkloadOpts holds optional data that can be provided to enable features in a workload stack template.