github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/provider/azure/internal/armtemplates/template.go (about) 1 package armtemplates 2 3 import "github.com/Azure/azure-sdk-for-go/arm/storage" 4 5 const ( 6 schema = "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#" 7 contentVersion = "1.0.0.0" 8 ) 9 10 // Template represents an Azure Resource Manager (ARM) Template. 11 // See: https://azure.microsoft.com/en-us/documentation/articles/resource-group-authoring-templates/ 12 type Template struct { 13 // Resources contains the definitions of resources that will 14 // be created by the template. 15 Resources []Resource `json:"resources"` 16 } 17 18 // Map returns the template as a map, suitable for use in 19 // azure-sdk-for-go/arm/resources/resources/DeploymentProperties.Template. 20 func (t *Template) Map() (map[string]interface{}, error) { 21 m := map[string]interface{}{ 22 "$schema": schema, 23 "contentVersion": contentVersion, 24 "resources": t.Resources, 25 } 26 return m, nil 27 } 28 29 // Resource describes a template resource. For information on the 30 // individual fields, see https://azure.microsoft.com/en-us/documentation/articles/resource-group-authoring-templates/. 31 type Resource struct { 32 APIVersion string `json:"apiVersion"` 33 Type string `json:"type"` 34 Name string `json:"name"` 35 Location string `json:"location,omitempty"` 36 Tags map[string]string `json:"tags,omitempty"` 37 Comments string `json:"comments,omitempty"` 38 DependsOn []string `json:"dependsOn,omitempty"` 39 Properties interface{} `json:"properties,omitempty"` 40 Resources []Resource `json:"resources,omitempty"` 41 42 // Non-uniform attributes. 43 StorageSku *storage.Sku `json:"sku,omitempty"` 44 }