Documentation ¶
Index ¶
- func AlphaSnakeUpper(name string) string
- func BicepName(name string) string
- func ContainerAppInfix(name string) string
- func ContainerAppName(name string) string
- func ContainerAppSecretName(name string) string
- func CopyBase(targetDir string) error
- func EnvFormat(src string) string
- func ExecInfra(t *template.Template, spec InfraSpec, target string) error
- func Execute(t *template.Template, name string, data any, dest string) error
- func FormatParameter(prefix string, indent string, value any) (string, error)
- func Load() (*template.Template, error)
- type Backend
- type DatabaseCosmosMongo
- type DatabasePostgres
- type DatabaseReference
- type Frontend
- type InfraSpec
- type Parameter
- type ServiceReference
- type ServiceSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlphaSnakeUpper ¶
UpperSnakeAlpha returns a name in upper-snake case alphanumeric name separated only by underscores.
Non-alphanumeric characters are discarded, while consecutive separators ('-', '_', and '.') are treated as a single underscore separator.
func BicepName ¶
BicepName returns a name suitable for use as a bicep variable name.
The name is converted to camel case, with treatment for underscore or dash separators, and all non-alphanumeric characters are removed.
func ContainerAppInfix ¶
ContainerAppInfix returns a suitable infix for a container app resource.
The name is treated to only contain alphanumeric and dash characters, with no repeated dashes, and no dashes as the first or last character.
func ContainerAppName ¶
ContainerAppName returns a suitable name a container app resource.
The name is treated to only contain alphanumeric and dash characters, with no repeated dashes, and no dashes as the first or last character.
func ContainerAppSecretName ¶
ContainerAppSecretName returns a suitable name a container app secret name.
The name is treated to only contain lowercase alphanumeric and dash characters, and must start and end with an alphanumeric character
func EnvFormat ¶
EnvFormat takes an input parameter like `fooParam` which is expected to be in camel case and returns it in upper snake case with env var template, like `${AZURE_FOO_PARAM}`.
func ExecInfra ¶
ExecInfra scaffolds infrastructure files for the given spec, using the loaded templates in t. The resulting files are written to the target directory.
func Execute ¶
Execute applies the template associated with t that has the given name to the specified data object and writes the output to the dest path on the filesystem.
func FormatParameter ¶
Formats a parameter value for use in a bicep file. If the value is a string, it is quoted inline with no indentation. Otherwise, the value is marshaled with indentation specified by prefix and indent.
Types ¶
type Backend ¶
type Backend struct {
Frontends []ServiceReference
}
type DatabaseCosmosMongo ¶
type DatabaseCosmosMongo struct {
DatabaseName string
}
type DatabasePostgres ¶
type DatabaseReference ¶
type DatabaseReference struct {
DatabaseName string
}
type Frontend ¶
type Frontend struct {
Backends []ServiceReference
}
type InfraSpec ¶
type InfraSpec struct { Parameters []Parameter Services []ServiceSpec // Databases to create DbPostgres *DatabasePostgres DbCosmosMongo *DatabaseCosmosMongo }
type ServiceReference ¶
type ServiceReference struct {
Name string
}
type ServiceSpec ¶
type ServiceSpec struct { Name string Port int // Front-end properties. Frontend *Frontend // Back-end properties Backend *Backend // Connection to a database DbPostgres *DatabaseReference DbCosmosMongo *DatabaseReference DbRedis *DatabaseReference }