Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appropriate Structs to Represent an ARM Template #333

Closed
boumenot opened this issue May 24, 2016 · 2 comments
Closed

Appropriate Structs to Represent an ARM Template #333

boumenot opened this issue May 24, 2016 · 2 comments

Comments

@boumenot
Copy link
Member

There is no type that represents an ARM template in the SDK. I can approximate an ARM template type with a little bit of effort, and using the models (read types) that ship with the SDK.

This may be an issue that for Swagger...

I am approximating an ARM template using the following code.

package template

import (
    "github.com/Azure/azure-sdk-for-go/arm/compute"
    "github.com/Azure/azure-sdk-for-go/arm/network"
    //"github.com/Azure/azure-sdk-for-go/arm/resources/resources"
)

/////////////////////////////////////////////////
// Template
type Template struct {
    Schema         *string                `json:"$schema"`
    ContentVersion *string                `json:"contentVersion"`
    Parameters     *map[string]Parameters `json:"parameters"`
    Variables      *map[string]string     `json:"variables"`
    Resources      *[]Resource            `json:"resources"`
}

/////////////////////////////////////////////////
// Template > Parameters
type Parameters struct {
    Type         *string `json:"type"`
    DefaultValue *string `json:"defaultValue,omitempty"`
}

/////////////////////////////////////////////////
// Template > Resource
type Resource struct {
    ApiVersion *string     `json:"apiVersion"`
    Name       *string     `json:"name"`
    Type       *string     `json:"type"`
    Location   *string     `json:"location"`
    DependsOn  *[]string   `json:"dependsOn,omitempty"`
    Properties *Properties `json:"properties,omitempty"`
}

/////////////////////////////////////////////////
// Template > Resource > Properties
type Properties struct {
    AddressSpace            *network.AddressSpace               `json:"addressSpace,omitempty"`
    DiagnosticsProfile      *compute.DiagnosticsProfile         `json:"diagnosticsProfile,omitempty"`
    DNSSettings             *network.PublicIPAddressDNSSettings `json:"dnsSettings,omitempty"`
    HardwareProfile         *compute.HardwareProfile            `json:"hardwareProfile,omitempty"`
    IPConfigurations        *[]network.IPConfiguration          `json:"ipConfigurations,omitempty"`
    NetworkProfile          *compute.NetworkProfile             `json:"networkProfile,omitempty"`
    OsProfile               *compute.OSProfile                  `json:"osProfile,omitempty"`
    PublicIPAllocatedMethod *network.IPAllocationMethod         `json:"publicIPAllocationMethod,omitempty"`
    StorageProfile          *compute.StorageProfile             `json:"storageProfile,omitempty"`
    Subnets                 *[]network.Subnet                   `json:"subnets,omitempty"`
}
@brendandixon
Copy link
Contributor

@boumenot Yup, Swagger issue. :)

@ahmetb
Copy link
Contributor

ahmetb commented Jun 27, 2016

@boumenot closing this as this does not seem very much related to the Go SDK. It might make sense to start an internal discussion with ARM folks (lmk if u need contacts) to create Swagger spec(s) for the ARM templates.

in the meanwhile I suggest creating a personal repo to host these types or just embed them in the project you're using them.

@ahmetb ahmetb closed this as completed Jun 27, 2016
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants