Documentation
¶
Index ¶
- func AlphaSnakeUpper(name string) string
- func BicepName(name string) string
- func ContainerAppName(name string) string
- func ContainerAppSecretName(name string) string
- func EnvFormat(src string) string
- func ExecInfra(t *template.Template, spec InfraSpec, target string) error
- func ExecInfraFs(t *template.Template, spec InfraSpec) (*memfs.FS, 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)
- func RemoveDotAndDash(name string) string
- type AIModel
- type AIModelModel
- type AIModelReference
- type Backend
- type DatabaseCosmosMongo
- type DatabaseMysql
- type DatabasePostgres
- type DatabaseRedis
- type DatabaseReference
- type EventHubs
- type Frontend
- type InfraSpec
- type Parameter
- type ServiceBus
- type ServiceReference
- type ServiceSpec
- type StorageAccount
- type StorageReference
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 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 ExecInfraFs ¶
ExecInfraFs scaffolds infrastructure files for the given spec, using the loaded templates in t. The resulting files are written to the in-memory filesystem.
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.
func Load ¶
Load loads all templates as a template.Template.
To execute a named template, call Execute with the defined name.
func RemoveDotAndDash ¶
Types ¶
type AIModel ¶
type AIModel struct { Name string Model AIModelModel }
AIModel represents a deployed, ready to use AI model.
type AIModelModel ¶
type AIModelModel struct { // The name of the underlying model. Name string // The version of the underlying model. Version string }
AIModelModel represents a model that backs the AIModel.
type AIModelReference ¶
type AIModelReference struct {
Name string
}
type Backend ¶
type Backend struct {
Frontends []ServiceReference
}
type DatabaseCosmosMongo ¶
type DatabaseCosmosMongo struct {
DatabaseName string
}
type DatabaseMysql ¶
type DatabaseMysql struct {
DatabaseName string
}
type DatabasePostgres ¶
type DatabasePostgres struct {
DatabaseName string
}
type DatabaseRedis ¶
type DatabaseRedis struct { }
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 DbMySql *DatabaseMysql DbCosmosMongo *DatabaseCosmosMongo DbRedis *DatabaseRedis // Messaging services ServiceBus *ServiceBus EventHubs *EventHubs // Storage account StorageAccount *StorageAccount // ai models AIModels []AIModel }
type ServiceBus ¶
type ServiceReference ¶
type ServiceReference struct {
Name string
}
type ServiceSpec ¶
type ServiceSpec struct { Name string Port int Env map[string]string // Front-end properties. Frontend *Frontend // Back-end properties Backend *Backend // Connection to a database DbPostgres *DatabaseReference DbMySql *DatabaseReference DbCosmosMongo *DatabaseReference DbRedis *DatabaseReference StorageAccount *StorageReference // AI model connections AIModels []AIModelReference // Messaging services ServiceBus *ServiceBus EventHubs *EventHubs }
type StorageAccount ¶
type StorageAccount struct {
Containers []string
}
type StorageReference ¶
type StorageReference struct { }