arm

package
v0.0.0-...-b534984 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeployTemplate

func DeployTemplate(ctx context.Context, log *logrus.Entry, deployments features.DeploymentsClient, resourceGroupName string, deploymentName string, template *Template, parameters map[string]interface{}) error

Types

type ArmResource

type ArmResource struct {
	SubscriptionID string
	ResourceGroup  string
	Provider       string
	ResourceName   string
	ResourceType   string
	SubResource    SubResource
}

ArmResource represents a resource and its child resources. Typically we would use the autorest package for this, but It does not have support for subresources

func ParseArmResourceId

func ParseArmResourceId(resourceId string) (*ArmResource, error)

ParseArmResourceId takes in an ARM resource ID and returns an ArmResource object representing that resource. It supports up to two levels of subresource nesting.

func (ArmResource) ParentResource

func (r ArmResource) ParentResource() string

ParentResourcetoString returns a string of the parent object in form of azureResourceID

func (ArmResource) String

func (r ArmResource) String() string

String function returns a string in form of azureResourceID

type Copy

type Copy struct {
	Name      string `json:"name,omitempty"`
	Count     int    `json:"count,omitempty"`
	Mode      string `json:"mode,omitempty"`
	BatchSize int    `json:"batchSize,omitempty"`
}

Copy represents an ARM template copy stanza

type Deployment

type Deployment struct {
	Name       string                `json:"name,omitempty"`
	Type       string                `json:"type,omitempty"`
	Location   string                `json:"location,omitempty"`
	APIVersion string                `json:"apiVersion,omitempty"`
	DependsOn  []string              `json:"dependsOn,omitempty"`
	Condition  interface{}           `json:"condition,omitempty"`
	Properties *DeploymentProperties `json:"properties,omitempty"`
}

Deployment represents a nested ARM deployment in a deployment

type DeploymentProperties

type DeploymentProperties struct {
	Mode                        string                                          `json:"mode,omitempty"`
	ExpressionEvaluationOptions map[string]*string                              `json:"expressionEvaluationOptions,omitempty"`
	Parameters                  map[string]*DeploymentTemplateResourceParameter `json:"parameters,omitempty"`
	Variables                   map[string]interface{}                          `json:"variables,omitempty"`
	Template                    *DeploymentTemplate                             `json:"template,omitempty"`
}

DeploDeploymentProperties represents the propertioes of a nested ARM deployment

type DeploymentTemplate

type DeploymentTemplate struct {
	Schema         string                        `json:"$schema,omitempty"`
	APIProfile     string                        `json:"apiProfile,omitempty"`
	ContentVersion string                        `json:"contentVersion,omitempty"`
	Variables      map[string]interface{}        `json:"variables,omitempty"`
	Parameters     map[string]*TemplateParameter `json:"parameters,omitempty"`
	Functions      []interface{}                 `json:"functions,omitempty"`
	Resources      []*DeploymentTemplateResource `json:"resources,omitempty"`
}

DeploymentTemplate represents the inner template of a nested ARM deployment

type DeploymentTemplateResource

type DeploymentTemplateResource struct {
	Name       string      `json:"name,omitempty"`
	Type       string      `json:"type,omitempty"`
	APIVersion string      `json:"apiVersion,omitempty"`
	Properties interface{} `json:"properties,omitempty"`
}

DeploymentTemplateResource represents the inner template's resource of a nested ARM deployment

type DeploymentTemplateResourceParameter

type DeploymentTemplateResourceParameter struct {
	Value string `json:"value,omitempty"`
}

DeploymentTemplateResourceParameter represents a nested ARM deployment's resource parameter

type Output

type Output struct {
	Condition bool        `json:"condition,omitempty"`
	Type      string      `json:"type,omitempty"`
	Value     interface{} `json:"value,omitempty"`
}

Output represents an ARM template output

type Parameters

type Parameters struct {
	Schema         string                          `json:"$schema,omitempty"`
	ContentVersion string                          `json:"contentVersion,omitempty"`
	Parameters     map[string]*ParametersParameter `json:"parameters,omitempty"`
}

Parameters represents ARM parameters

type ParametersParameter

type ParametersParameter struct {
	Ref      string                 `json:"$ref,omitempty"`
	Value    interface{}            `json:"value,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

ParametersParameter represents an ARM parameters parameter

type Resource

type Resource struct {
	Resource interface{} `json:"-"`

	Name       string                 `json:"name,omitempty"`
	Type       string                 `json:"type,omitempty"`
	Condition  interface{}            `json:"condition,omitempty"`
	APIVersion string                 `json:"apiVersion,omitempty"`
	DependsOn  []string               `json:"dependsOn,omitempty"`
	Location   string                 `json:"location,omitempty"`
	Tags       map[string]interface{} `json:"tags,omitempty"`
	Copy       *Copy                  `json:"copy,omitempty"`
	Comments   string                 `json:"comments,omitempty"`
	// Etag is required to omit Etag member when it's not set.
	// arm* SDK uses its own MarshalJSON, and empty members are converted to nil,
	// but Etag: nil fails the ARM template validation.
	Etag string `json:"etag,omitempty"`
}

Resource represents an ARM template resource

func (*Resource) MarshalJSON

func (r *Resource) MarshalJSON() ([]byte, error)

MarshalJSON marshals the nested r.Resource ignoring any MarshalJSON() methods on its types. It then merges remaining fields of r over the result

func (*Resource) UnmarshalJSON

func (r *Resource) UnmarshalJSON(b []byte) error

UnmarshalJSON is not implemented

type SubResource

type SubResource struct {
	ResourceName string
	ResourceType string
	SubResource  *SubResource
}

SubResource represents an ARM Proxy Resource ARM supports up to 3 levels of nested resources https://eng.ms/docs/products/arm/api_contracts/guidelines/rpc#rpc030-avoid-excessive-resource-type-nesting

type Template

type Template struct {
	Schema         string                        `json:"$schema,omitempty"`
	APIProfile     string                        `json:"apiProfile,omitempty"`
	ContentVersion string                        `json:"contentVersion,omitempty"`
	Variables      map[string]interface{}        `json:"variables,omitempty"`
	Parameters     map[string]*TemplateParameter `json:"parameters,omitempty"`
	Functions      []interface{}                 `json:"functions,omitempty"`
	Resources      []*Resource                   `json:"resources,omitempty"`
	Outputs        map[string]*Output            `json:"outputs,omitempty"`
}

Template represents an ARM template

type TemplateParameter

type TemplateParameter struct {
	Type          string                 `json:"type,omitempty"`
	DefaultValue  interface{}            `json:"defaultValue,omitempty"`
	AllowedValues []interface{}          `json:"allowedValues,omitempty"`
	Metadata      map[string]interface{} `json:"metadata,omitempty"`
	MinValue      int                    `json:"minValue,omitempty"`
	MaxValue      int                    `json:"maxValue,omitempty"`
	MinLength     int                    `json:"minLength,omitempty"`
	MaxLength     int                    `json:"maxLength,omitempty"`
}

TemplateParameter represents an ARM template parameter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL