Documentation ¶
Overview ¶
bicep contains functionality for working with the Bicep compiler as well as ARM-JSON templates.
Package bicep is a generated GoMock package.
Index ¶
- Constants
- func Build(filePath string) (map[string]any, error)
- func ConvertToMapStringInterface(in map[string]map[string]any) map[string]any
- func DeleteBicep() error
- func DownloadBicep() error
- func InjectApplicationParam(deploymentTemplate map[string]any, parameters map[string]map[string]any, ...) error
- func InjectEnvironmentParam(deploymentTemplate map[string]any, parameters map[string]map[string]any, ...) error
- func IsBicepInstalled() (bool, error)
- func NewParameter(value any) map[string]any
- func ReadARMJSON(filePath string) (map[string]any, error)
- func Version() string
- type Impl
- type Interface
- type MockInterface
- type MockInterfaceMockRecorder
- type OSFileSystem
- type ParameterFile
- type ParameterParser
Constants ¶
const SemanticVersionRegex = `` /* 177-byte string literal not displayed */
Official regex for semver https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build() reads a Bicep file at the given file path and returns a map of the compiled output and an error if the compilation fails.
func ConvertToMapStringInterface ¶
ConvertToMapStringInterface takes in a map of strings to maps of strings to any type and returns a map of strings to any
type, with the values of the inner maps being the values of the returned map. No errors are returned.
func DownloadBicep ¶
func DownloadBicep() error
DownloadBicep() attempts to download a file from a given URI and save it to a local filepath, retrying up to 10 times if the download fails. If an error occurs, an error is returned.
func InjectApplicationParam ¶
func InjectApplicationParam(deploymentTemplate map[string]any, parameters map[string]map[string]any, applicationId string) error
InjectApplicationParam injects an argument for application into the parameters if required.
- parameters.application exists && param not passed in -> inject environmentId - parameters.application does not exist -> noop - input parameters already include application -> noop.
func InjectEnvironmentParam ¶
func InjectEnvironmentParam(deploymentTemplate map[string]any, parameters map[string]map[string]any, environmentId string) error
InjectEnvironmentParam injects an argument for environment into the parameters if required.
- parameters.environment exists && param not passed in -> inject environmentId - parameters.environment does not exist -> noop - input parameters already include environment -> noop.
func IsBicepInstalled ¶
IsBicepInstalled checks if the Bicep binary is installed on the local machine and returns a boolean and an error if one occurs.
func NewParameter ¶
NewParameter creates a map containing a single key-value pair, where the key is "value" and the value is the parameter passed to the function. If the parameter is invalid, an empty map is returned.
func ReadARMJSON ¶
ReadARMJSON reads a JSON file from the given file path and returns a map of strings to any type, or an error if the file
could not be read or unmarshalled.
Types ¶
type Impl ¶
type Impl struct { }
Impl is the implementation of Interface.
func (*Impl) PrepareTemplate ¶
PrepareTemplate checks if the file is a .json or .bicep file, downloads Bicep if it is not installed, checks if the file
exists, and builds the template if it does. It returns a map of strings to any and an error if one occurs.
type Interface ¶
Interface is the interface for preparing Bicep or ARM-JSON templates for deployment. This interface is designed to be called from the CLI and will print output to the console.
type MockInterface ¶
type MockInterface struct {
// contains filtered or unexported fields
}
MockInterface is a mock of Interface interface.
func NewMockInterface ¶
func NewMockInterface(ctrl *gomock.Controller) *MockInterface
NewMockInterface creates a new mock instance.
func (*MockInterface) EXPECT ¶
func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockInterface) PrepareTemplate ¶
func (m *MockInterface) PrepareTemplate(arg0 string) (map[string]interface{}, error)
PrepareTemplate mocks base method.
type MockInterfaceMockRecorder ¶
type MockInterfaceMockRecorder struct {
// contains filtered or unexported fields
}
MockInterfaceMockRecorder is the mock recorder for MockInterface.
func (*MockInterfaceMockRecorder) PrepareTemplate ¶
func (mr *MockInterfaceMockRecorder) PrepareTemplate(arg0 interface{}) *gomock.Call
PrepareTemplate indicates an expected call of PrepareTemplate.
type OSFileSystem ¶
type OSFileSystem struct { }
type ParameterFile ¶
type ParameterFile struct {
Parameters clients.DeploymentParameters `json:"parameters"`
}
type ParameterParser ¶
ParameterParser is used to parse the parameters as part of the `rad deploy` command. See the docs for `rad deploy` for examples of what we need to support here.
func (ParameterParser) Parse ¶
func (pp ParameterParser) Parse(inputs ...string) (clients.DeploymentParameters, error)
Parse takes in a variable number of strings and returns a DeploymentParameters object and an error, if any. It processes each string input and merges the parameters with the later ones taking precedence, and returns an error if any of the strings fail to be processed.
func (ParameterParser) ParseFileContents ¶
func (pp ParameterParser) ParseFileContents(input map[string]any) (clients.DeploymentParameters, error)
ParseFileContents takes in a map of strings and any type and returns a DeploymentParameters object and an error if one occurs during the process.