Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareVersions ¶ added in v0.12.0
CompareVersions compares two versions in the format "X.Y.Z" and returns: -1 if version1 is less than version2 0 if version1 is equal to version2 1 if version1 is greater than version2
func GetStringFromTemplateWithData ¶
func GetStringFromTemplateWithData(templateName string, templateStr string, templateData TemplateData) string
GetStringFromTemplateWithData returns a string from a template with data.
Here is the example usage: templateStr := GetStringFromTemplateWithData(
"testAccResourceApplicationWithRevisionAndConfig", ` resource "juju_model" "this" { name = "{{.ModelName}}" } resource "juju_application" "{{.AppName}}" { name = "{{.AppName}}" model = juju_model.this.name charm { name = "{{.AppName}}" revision = {{.Revision}} channel = "latest/edge" } {{ if ne .ConfigParamName "" }} config = { {{.ConfigParamName}} = "{{.ConfigParamName}}-value" } {{ end }} units = 1 } `, utils.TemplateData{ "ModelName": "test-model", "AppName": "test-app" "Revision": fmt.Sprintf("%d", 7), "ConfigParamName": "test-config-param-name", })
The templateStr will be:
resource "juju_model" "this" { name = "test-model" } resource "juju_application" "test-app" { name = "test-app" model = juju_model.this.name charm { name = "test-app" revision = 7 channel = "latest/edge" } config = { test-config-param-name = "test-config-param-name-value" } units = 1 }
Types ¶
type TemplateData ¶
TemplateData is a map of string to any that is used to pass data to a template.
Click to show internal directories.
Click to hide internal directories.