...

Source file src/github.com/Azure/azure-sdk-for-go/services/classic/management/virtualmachine/entities.go

Documentation: github.com/Azure/azure-sdk-for-go/services/classic/management/virtualmachine

     1  // +build go1.7
     2  
     3  package virtualmachine
     4  
     5  // Copyright (c) Microsoft Corporation. All rights reserved.
     6  // Licensed under the MIT License. See License.txt in the project root for license information.
     7  
     8  import (
     9  	"encoding/xml"
    10  
    11  	"github.com/Azure/azure-sdk-for-go/services/classic/management"
    12  	vmdisk "github.com/Azure/azure-sdk-for-go/services/classic/management/virtualmachinedisk"
    13  )
    14  
    15  // VirtualMachineClient is used to perform operations on Azure Virtual Machines
    16  type VirtualMachineClient struct {
    17  	client management.Client
    18  }
    19  
    20  // DeploymentRequest is the type for creating a deployment and Virtual Machine
    21  // in the deployment based on the specified configuration. See
    22  // https://msdn.microsoft.com/en-us/library/azure/jj157194.aspx
    23  type DeploymentRequest struct {
    24  	XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Deployment"`
    25  	// Required parameters:
    26  	Name           string ``            // Specifies a name for the deployment. The deployment name must be unique among other deployments for the cloud service.
    27  	DeploymentSlot string ``            // Specifies the environment in which the Virtual Machine is to be deployed. The only allowable value is Production.
    28  	Label          string ``            // Specifies an identifier for the deployment. The label can be up to 100 characters long. The label can be used for tracking purposes.
    29  	RoleList       []Role `xml:">Role"` // Contains information about the Virtual Machines that are to be deployed.
    30  	// Optional parameters:
    31  	VirtualNetworkName string         `xml:",omitempty"`                         // Specifies the name of an existing virtual network to which the deployment will belong.
    32  	DNSServers         []DNSServer    `xml:"Dns>DnsServers>DnsServer,omitempty"` // Contains a list of DNS servers to associate with the Virtual Machine.
    33  	LoadBalancers      []LoadBalancer `xml:">LoadBalancer,omitempty"`            // Contains a list of internal load balancers that can be assigned to input endpoints.
    34  	ReservedIPName     string         `xml:",omitempty"`                         // Specifies the name of a reserved IP address that is to be assigned to the deployment.
    35  }
    36  
    37  // DeploymentResponse is the type for receiving deployment information
    38  // See https://msdn.microsoft.com/en-us/library/azure/ee460804.aspx
    39  type DeploymentResponse struct {
    40  	XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Deployment"`
    41  
    42  	Name                   string
    43  	DeploymentSlot         string
    44  	PrivateID              string
    45  	Status                 DeploymentStatus
    46  	Label                  string
    47  	URL                    string `xml:"Url"`
    48  	Configuration          string
    49  	RoleInstanceList       []RoleInstance `xml:">RoleInstance"`
    50  	UpgradeStatus          UpgradeStatus
    51  	UpgradeDomainCount     int
    52  	RoleList               []Role `xml:">Role"`
    53  	SdkVersion             string
    54  	Locked                 bool
    55  	RollbackAllowed        bool
    56  	CreatedTime            string
    57  	LastModifiedTime       string
    58  	VirtualNetworkName     string
    59  	DNSServers             []DNSServer        `xml:"Dns>DnsServers>DnsServer"`
    60  	LoadBalancers          []LoadBalancer     `xml:">LoadBalancer"`
    61  	ExtendedProperties     []ExtendedProperty `xml:">ExtendedProperty"`
    62  	PersistentVMDowntime   PersistentVMDowntime
    63  	VirtualIPs             []VirtualIP `xml:">VirtualIP"`
    64  	ExtensionConfiguration ExtensionConfiguration
    65  	ReservedIPName         string
    66  	InternalDNSSuffix      string `xml:"InternalDnsSuffix"`
    67  }
    68  
    69  type DeploymentStatus string
    70  
    71  const (
    72  	DeploymentStatusRunning                DeploymentStatus = "Running"
    73  	DeploymentStatusSuspended              DeploymentStatus = "Suspended"
    74  	DeploymentStatusRunningTransitioning   DeploymentStatus = "RunningTransitioning"
    75  	DeploymentStatusSuspendedTransitioning DeploymentStatus = "SuspendedTransitioning"
    76  	DeploymentStatusStarting               DeploymentStatus = "Starting"
    77  	DeploymentStatusSuspending             DeploymentStatus = "Suspending"
    78  	DeploymentStatusDeploying              DeploymentStatus = "Deploying"
    79  	DeploymentStatusDeleting               DeploymentStatus = "Deleting"
    80  )
    81  
    82  // DeploymentSlot for cloud services are either Production or Staging Slots
    83  type DeploymentSlot string
    84  
    85  const (
    86  	// DeploymentSlotProduction represents the Production slot of a cloud service
    87  	DeploymentSlotProduction DeploymentSlot = "Production"
    88  	// DeploymentSlotStaging represents the Staging slot of a cloud service
    89  	DeploymentSlotStaging DeploymentSlot = "Staging"
    90  )
    91  
    92  type RoleInstance struct {
    93  	RoleName                          string
    94  	InstanceName                      string
    95  	InstanceStatus                    InstanceStatus
    96  	ExtendedInstanceStatus            string
    97  	InstanceUpgradeDomain             int
    98  	InstanceFaultDomain               int
    99  	InstanceSize                      string
   100  	InstanceStateDetails              string
   101  	InstanceErrorCode                 string
   102  	IPAddress                         string             `xml:"IpAddress"`
   103  	InstanceEndpoints                 []InstanceEndpoint `xml:">InstanceEndpoint"`
   104  	PowerState                        PowerState
   105  	HostName                          string
   106  	RemoteAccessCertificateThumbprint string
   107  	GuestAgentStatus                  string                    // todo: implement
   108  	ResourceExtensionStatusList       []ResourceExtensionStatus `xml:">ResourceExtensionStatus"`
   109  	PublicIPs                         []PublicIP                `xml:">PublicIP"`
   110  }
   111  
   112  type InstanceStatus string
   113  
   114  const (
   115  	InstanceStatusUnknown            = "Unknown"
   116  	InstanceStatusCreatingVM         = "CreatingVM"
   117  	InstanceStatusStartingVM         = "StartingVM"
   118  	InstanceStatusCreatingRole       = "CreatingRole"
   119  	InstanceStatusStartingRole       = "StartingRole"
   120  	InstanceStatusReadyRole          = "ReadyRole"
   121  	InstanceStatusBusyRole           = "BusyRole"
   122  	InstanceStatusStoppingRole       = "StoppingRole"
   123  	InstanceStatusStoppingVM         = "StoppingVM"
   124  	InstanceStatusDeletingVM         = "DeletingVM"
   125  	InstanceStatusStoppedVM          = "StoppedVM"
   126  	InstanceStatusRestartingRole     = "RestartingRole"
   127  	InstanceStatusCyclingRole        = "CyclingRole"
   128  	InstanceStatusFailedStartingRole = "FailedStartingRole"
   129  	InstanceStatusFailedStartingVM   = "FailedStartingVM"
   130  	InstanceStatusUnresponsiveRole   = "UnresponsiveRole"
   131  	InstanceStatusStoppedDeallocated = "StoppedDeallocated"
   132  	InstanceStatusPreparing          = "Preparing"
   133  )
   134  
   135  type InstanceEndpoint struct {
   136  	Name       string
   137  	Vip        string
   138  	PublicPort int
   139  	LocalPort  int
   140  	Protocol   InputEndpointProtocol
   141  }
   142  
   143  type PowerState string
   144  
   145  const (
   146  	PowerStateStarting PowerState = "Starting"
   147  	PowerStateStarted  PowerState = "Started"
   148  	PowerStateStopping PowerState = "Stopping"
   149  	PowerStateStopped  PowerState = "Stopped"
   150  	PowerStateUnknown  PowerState = "Unknown"
   151  )
   152  
   153  type ResourceExtensionStatus struct {
   154  	HandlerName            string
   155  	Version                string
   156  	Status                 ResourceExtensionState
   157  	Code                   string
   158  	FormattedMessage       FormattedMessage
   159  	ExtensionSettingStatus ExtensionSettingStatus
   160  }
   161  
   162  type ResourceExtensionState string
   163  
   164  const (
   165  	ResourceExtensionStateInstalling   ResourceExtensionState = "Installing"
   166  	ResourceExtensionStateReady        ResourceExtensionState = "Ready"
   167  	ResourceExtensionStateNotReady     ResourceExtensionState = "NotReady"
   168  	ResourceExtensionStateUnresponsive ResourceExtensionState = "Unresponsive"
   169  )
   170  
   171  type FormattedMessage struct {
   172  	Language string
   173  	Message  string
   174  }
   175  
   176  type ExtensionSettingStatus struct {
   177  	Timestamp        string
   178  	Name             string
   179  	Operation        string
   180  	Status           ExtensionSettingState
   181  	Code             string
   182  	FormattedMessage FormattedMessage
   183  	SubStatusList    []SubStatus `xml:">SubStatus"`
   184  }
   185  
   186  type ExtensionSettingState string
   187  
   188  const (
   189  	ExtensionSettingStateTransitioning ExtensionSettingState = "transitioning"
   190  	ExtensionSettingStateError         ExtensionSettingState = "error"
   191  	ExtensionSettingStateSuccess       ExtensionSettingState = "success"
   192  	ExtensionSettingStateWarning       ExtensionSettingState = "warning"
   193  )
   194  
   195  type SubStatus struct {
   196  	Name             string
   197  	Status           ExtensionSettingState
   198  	FormattedMessage FormattedMessage
   199  }
   200  
   201  type UpgradeStatus struct {
   202  	UpgradeType               UpgradeType
   203  	CurrentUpgradeDomainState CurrentUpgradeDomainState
   204  	CurrentUpgradeDomain      int
   205  }
   206  
   207  type UpgradeType string
   208  
   209  const (
   210  	UpgradeTypeAuto         UpgradeType = "Auto"
   211  	UpgradeTypeManual       UpgradeType = "Manual"
   212  	UpgradeTypeSimultaneous UpgradeType = "Simultaneous"
   213  )
   214  
   215  type CurrentUpgradeDomainState string
   216  
   217  const (
   218  	CurrentUpgradeDomainStateBefore CurrentUpgradeDomainState = "Before"
   219  	CurrentUpgradeDomainStateDuring CurrentUpgradeDomainState = "During"
   220  )
   221  
   222  type ExtendedProperty struct {
   223  	Name  string
   224  	Value string
   225  }
   226  
   227  type PersistentVMDowntime struct {
   228  	StartTime string
   229  	EndTime   string
   230  	Status    string
   231  }
   232  
   233  type VirtualIP struct {
   234  	Address        string
   235  	IsReserved     bool
   236  	ReservedIPName string
   237  	Type           IPAddressType
   238  }
   239  
   240  // Role contains the configuration sets that are used to create virtual
   241  // machines.
   242  type Role struct {
   243  	RoleName                    string                        `xml:",omitempty"` // Specifies the name for the Virtual Machine.
   244  	RoleType                    string                        `xml:",omitempty"` // Specifies the type of role to use. For Virtual Machines, this must be PersistentVMRole.
   245  	ConfigurationSets           []ConfigurationSet            `xml:"ConfigurationSets>ConfigurationSet,omitempty"`
   246  	ResourceExtensionReferences *[]ResourceExtensionReference `xml:"ResourceExtensionReferences>ResourceExtensionReference,omitempty"`
   247  	VMImageName                 string                        `xml:",omitempty"`                                         // Specifies the name of the VM Image that is to be used to create the Virtual Machine. If this element is used, the ConfigurationSets element is not used.
   248  	MediaLocation               string                        `xml:",omitempty"`                                         // Required if the Virtual Machine is being created from a published VM Image. Specifies the location of the VHD file that is created when VMImageName specifies a published VM Image.
   249  	AvailabilitySetName         string                        `xml:",omitempty"`                                         // Specifies the name of a collection of Virtual Machines. Virtual Machines specified in the same availability set are allocated to different nodes to maximize availability.
   250  	DataVirtualHardDisks        []DataVirtualHardDisk         `xml:"DataVirtualHardDisks>DataVirtualHardDisk,omitempty"` // Contains the parameters that are used to add a data disk to a Virtual Machine. If you are creating a Virtual Machine by using a VM Image, this element is not used.
   251  	OSVirtualHardDisk           *OSVirtualHardDisk            `xml:",omitempty"`                                         // Contains the parameters that are used to create the operating system disk for a Virtual Machine. If you are creating a Virtual Machine by using a VM Image, this element is not used.
   252  	RoleSize                    string                        `xml:",omitempty"`                                         // Specifies the size of the Virtual Machine. The default size is Small.
   253  	ProvisionGuestAgent         bool                          `xml:",omitempty"`                                         // Indicates whether the VM Agent is installed on the Virtual Machine. To run a resource extension in a Virtual Machine, this service must be installed.
   254  	VMImageInput                *VMImageInput                 `xml:",omitempty"`                                         // When a VM Image is used to create a new PersistentVMRole, the DiskConfigurations in the VM Image are used to create new Disks for the new VM. This parameter can be used to resize the newly created Disks to a larger size than the underlying DiskConfigurations in the VM Image.
   255  
   256  	UseCertAuth bool   `xml:"-"`
   257  	CertPath    string `xml:"-"`
   258  }
   259  
   260  // VMImageInput is for when a VM Image is used to create a new PersistantVMRole,
   261  // the DiskConfigurations in the VM Image are used to create new Disks for the
   262  // new VM. This parameter can be used to resize the newly created Disks to a
   263  // larger size than the underlying DiskConfigurations in the VM Image.
   264  type VMImageInput struct {
   265  	OSDiskConfiguration    *OSDiskConfiguration    `xml:",omitempty"`                       // This corresponds to the OSDiskConfiguration of the VM Image used to create a new role. The OSDiskConfiguration element is only available using version 2014-10-01 or higher.
   266  	DataDiskConfigurations []DataDiskConfiguration `xml:">DataDiskConfiguration,omitempty"` // This corresponds to the DataDiskConfigurations of the VM Image used to create a new role. The DataDiskConfigurations element is only available using version 2014-10-01 or higher.
   267  }
   268  
   269  // OSDiskConfiguration is used to resize the OS disk of a new VM created from a
   270  // previously saved VM image.
   271  type OSDiskConfiguration struct {
   272  	ResizedSizeInGB int
   273  }
   274  
   275  // DataDiskConfiguration is used to resize the data disks of a new VM created
   276  // from a previously saved VM image.
   277  type DataDiskConfiguration struct {
   278  	OSDiskConfiguration
   279  	Name string // The Name of the DataDiskConfiguration being referenced to.
   280  
   281  }
   282  
   283  // ExtensionConfiguration Contains extensions that are added to the cloud service.
   284  // https://docs.microsoft.com/en-us/rest/api/compute/cloudservices/rest-get-deployment#bk_extensionconfig
   285  type ExtensionConfiguration struct {
   286  	NamedRoles []NamedRole `xml:"NamedRoles>Role,omitempty"`
   287  }
   288  
   289  // NamedRole specifies a list of extensions that are applied to specific roles in a deployment.
   290  // https://docs.microsoft.com/en-us/rest/api/compute/cloudservices/rest-get-deployment#bk_namedroles
   291  type NamedRole struct {
   292  	RoleName   string      `xml:",omitempty"`
   293  	Extensions []Extension `xml:"Extensions>Extension,omitempty"`
   294  }
   295  
   296  // Extension Specifies an extension that is to be deployed to a role in a cloud service.
   297  // https://docs.microsoft.com/en-us/rest/api/compute/cloudservices/rest-get-deployment#bk_extension
   298  type Extension struct {
   299  	ID    string `xml:"Id"`
   300  	State string
   301  }
   302  
   303  // ResourceExtensionReference contains a collection of resource extensions that
   304  // are to be installed on the Virtual Machine. The VM Agent must be installed on
   305  // the Virtual Machine to install resource extensions. For more information, see
   306  // Manage Extensions:
   307  //
   308  // https://msdn.microsoft.com/en-us/library/dn606311.aspx.
   309  type ResourceExtensionReference struct {
   310  	ReferenceName   string
   311  	Publisher       string
   312  	Name            string
   313  	Version         string
   314  	ParameterValues []ResourceExtensionParameter `xml:"ResourceExtensionParameterValues>ResourceExtensionParameterValue,omitempty"`
   315  	State           string
   316  }
   317  
   318  // ResourceExtensionParameter specifies the key, value, and type of a parameter that is passed to the
   319  // resource extension when it is installed.
   320  type ResourceExtensionParameter struct {
   321  	Key   string
   322  	Value string
   323  	Type  ResourceExtensionParameterType // If this value is set to Private, the parameter will not be returned by Get Deployment ().
   324  }
   325  
   326  type ResourceExtensionParameterType string
   327  
   328  // Enum values for ResourceExtensionParameterType
   329  const (
   330  	ResourceExtensionParameterTypePublic  ResourceExtensionParameterType = "Public"
   331  	ResourceExtensionParameterTypePrivate ResourceExtensionParameterType = "Private"
   332  )
   333  
   334  // DataVirtualHardDisk specifies the properties that are used to create a data
   335  // disk.
   336  type DataVirtualHardDisk struct {
   337  	HostCaching         vmdisk.HostCachingType `xml:",omitempty"` // Specifies the caching mode of the data disk. The default value is None.
   338  	DiskLabel           string                 `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is ignored. If a new disk is being created, this element is used to provide a description of the disk. The value of this element is only obtained programmatically and does not appear in the Management Portal.
   339  	DiskName            string                 `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is used to identify the disk to add. If a new disk and the associated VHD are being created by Azure, this element is not used and Azure assigns a unique name that is a combination of the deployment name, role name, and identifying number. The name of the disk must contain only alphanumeric characters, underscores, periods, or dashes. The name must not be longer than 256 characters. The name must not end with period or dash.
   340  	Lun                 int                    `xml:",omitempty"` // Specifies the Logical Unit Number (LUN) for the data disk. If the disk is the first disk that is added, this element is optional and the default value of 0 is used. If more than one disk is being added, this element is required. Valid LUN values are 0 through 31.
   341  	LogicalDiskSizeInGB int                    `xml:",omitempty"` // Specifies the size, in GB, of an empty disk to be attached to the Virtual Machine. If the disk that is being added is already registered in the subscription, this element is ignored. If the disk and VHD is being created by Azure as it is added, this element defines the size of the new disk.
   342  	MediaLink           string                 `xml:",omitempty"` // If the disk that is being added is already registered in the subscription or the VHD for the disk already exists in blob storage, this element is ignored. If a VHD file does not exist in blob storage, this element defines the location of the new VHD that is created when the new disk is added.
   343  	SourceMediaLink     string                 `xml:",omitempty"` // If the disk that is being added is already registered in the subscription or the VHD for the disk does not exist in blob storage, this element is ignored. If the VHD file exists in blob storage, this element defines the path to the VHD and a disk is registered from it and attached to the virtual machine.
   344  }
   345  
   346  // OSVirtualHardDisk specifies the properties that are used to create an OS
   347  // disk.
   348  type OSVirtualHardDisk struct {
   349  	HostCaching           vmdisk.HostCachingType `xml:",omitempty"` // Specifies the caching mode of the data disk. The default value is None.
   350  	DiskLabel             string                 `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is ignored. If a new disk is being created, this element is used to provide a description of the disk. The value of this element is only obtained programmatically and does not appear in the Management Portal.
   351  	DiskName              string                 `xml:",omitempty"` // If the disk that is being added is already registered in the subscription, this element is used to identify the disk to add. If a new disk and the associated VHD are being created by Azure, this element is not used and Azure assigns a unique name that is a combination of the deployment name, role name, and identifying number. The name of the disk must contain only alphanumeric characters, underscores, periods, or dashes. The name must not be longer than 256 characters. The name must not end with period or dash.
   352  	MediaLink             string                 `xml:",omitempty"` // If the disk that is being added is already registered in the subscription or the VHD for the disk already exists in blob storage, this element is ignored. If a VHD file does not exist in blob storage, this element defines the location of the new VHD that is created when the new disk is added.
   353  	SourceImageName       string                 `xml:",omitempty"`
   354  	OS                    string                 `xml:",omitempty"`
   355  	RemoteSourceImageLink string                 `xml:",omitempty"` // Specifies a publicly accessible URI or a SAS URI to the location where an OS image is stored that is used to create the Virtual Machine. This location can be a different location than the user or platform image repositories in Azure. An image is always associated with a VHD, which is a .vhd file stored as a page blob in a storage account in Azure. If you specify the path to an image with this element, an associated VHD is created and you must use the MediaLink element to specify the location in storage where the VHD will be located. If this element is used, SourceImageName is not used.
   356  	ResizedSizeInGB       int                    `xml:",omitempty"`
   357  }
   358  
   359  // ConfigurationSet specifies the configuration elements of the Virtual Machine.
   360  // The type attribute is required to prevent the administrator password from
   361  // being written to the operation history file.
   362  type ConfigurationSet struct {
   363  	ConfigurationSetType ConfigurationSetType
   364  
   365  	// Windows provisioning:
   366  	ComputerName              string               `xml:",omitempty"`                          // Optional. Specifies the computer name for the Virtual Machine. If you do not specify a computer name, one is assigned that is a combination of the deployment name, role name, and identifying number. Computer names must be 1 to 15 characters long.
   367  	AdminPassword             string               `xml:",omitempty"`                          // Optional. Specifies the password to use for an administrator account on the Virtual Machine that is being created. If you are creating a Virtual Machine using an image, you must specify a name of an administrator account to be created on the machine using the AdminUsername element. You must use the AdminPassword element to specify the password of the administrator account that is being created. If you are creating a Virtual Machine using an existing specialized disk, this element is not used because the account should already exist on the disk.
   368  	EnableAutomaticUpdates    bool                 `xml:",omitempty"`                          // Optional. Specifies whether automatic updates are enabled for the Virtual Machine. The default value is true.
   369  	TimeZone                  string               `xml:",omitempty"`                          // Optional. Specifies the time zone for the Virtual Machine.
   370  	DomainJoin                *DomainJoin          `xml:",omitempty"`                          // Optional. Contains properties that define a domain to which the Virtual Machine will be joined.
   371  	StoredCertificateSettings []CertificateSetting `xml:">StoredCertificateSetting,omitempty"` // Optional. Contains a list of service certificates with which to provision to the new Virtual Machine.
   372  	WinRMListeners            *[]WinRMListener     `xml:"WinRM>Listeners>Listener,omitempty"`  // Optional. Contains configuration settings for the Windows Remote Management service on the Virtual Machine. This enables remote Windows PowerShell.
   373  	AdminUsername             string               `xml:",omitempty"`                          // Optional. Specifies the name of the administrator account that is created to access the Virtual Machine. If you are creating a Virtual Machine using an image, you must specify a name of an administrator account to be created by using this element. You must use the AdminPassword element to specify the password of the administrator account that is being created. If you are creating a Virtual Machine using an existing specialized disk, this element is not used because the account should already exist on the disk.
   374  	AdditionalUnattendContent string               `xml:",omitempty"`                          // Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup.
   375  
   376  	// Linux provisioning:
   377  	HostName                         string `xml:",omitempty"`                                 // Required. Specifies the host name for the Virtual Machine. Host names must be 1 to 64 characters long.
   378  	UserName                         string `xml:",omitempty"`                                 // Required. Specifies the name of a user account to be created in the sudoer group of the Virtual Machine. User account names must be 1 to 32 characters long.
   379  	UserPassword                     string `xml:",omitempty"`                                 // Required. Specifies the password for the user account. Passwords must be 6 to 72 characters long.
   380  	DisableSSHPasswordAuthentication string `xml:"DisableSshPasswordAuthentication,omitempty"` // Optional. Specifies whether SSH password authentication is disabled. By default this value is set to true.
   381  	SSH                              *SSH   `xml:",omitempty"`                                 // Optional. Specifies the SSH public keys and key pairs to use with the Virtual Machine.
   382  
   383  	// In WindowsProvisioningConfiguration: The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. The file is saved to %SYSTEMDRIVE%\AzureData\CustomData.bin. If the file exists, it is overwritten. The security on directory is set to System:Full Control and Administrators:Full Control.
   384  	// In LinuxProvisioningConfiguration: The base-64 encoded string is located in the ovf-env.xml file on the ISO of the Virtual Machine. The file is copied to /var/lib/waagent/ovf-env.xml by the Azure Linux Agent. The Azure Linux Agent will also place the base-64 encoded data in /var/lib/waagent/CustomData during provisioning. The maximum length of the binary array is 65535 bytes.
   385  	CustomData string `xml:",omitempty"` // Specifies a base-64 encoded string of custom data.
   386  
   387  	// Network configuration:
   388  	InputEndpoints                []InputEndpoint `xml:">InputEndpoint,omitempty"` // Optional in NetworkConfiguration. Contains a collection of external endpoints for the Virtual Machine.
   389  	SubnetNames                   []string        `xml:">SubnetName,omitempty"`    // Required if StaticVirtualNetworkIPAddress is specified; otherwise, optional in NetworkConfiguration. Contains a list of subnets to which the Virtual Machine will belong.
   390  	StaticVirtualNetworkIPAddress string          `xml:",omitempty"`               // Specifies the internal IP address for the Virtual Machine in a Virtual Network. If you specify this element, you must also specify the SubnetNames element with only one subnet defined. The IP address specified in this element must belong to the subnet that is defined in SubnetNames and it should not be the one of the first four IP addresses or the last IP address in the subnet. Deploying web roles or worker roles into a subnet that has Virtual Machines with StaticVirtualNetworkIPAddress defined is not supported.
   391  	NetworkSecurityGroup          string          `xml:",omitempty"`               // Optional in NetworkConfiguration. Represents the name of the Network Security Group that will be associated with the Virtual Machine. Network Security Group must exist in the context of subscription and be created in same region to which the virtual machine will be deployed.
   392  	PublicIPs                     []PublicIP      `xml:">PublicIP,omitempty"`      // Contains a public IP address that can be used in addition to the default virtual IP address for the Virtual Machine.
   393  }
   394  
   395  type ConfigurationSetType string
   396  
   397  // Enum values for ConfigurationSetType
   398  const (
   399  	ConfigurationSetTypeWindowsProvisioning ConfigurationSetType = "WindowsProvisioningConfiguration"
   400  	ConfigurationSetTypeLinuxProvisioning   ConfigurationSetType = "LinuxProvisioningConfiguration"
   401  	ConfigurationSetTypeNetwork             ConfigurationSetType = "NetworkConfiguration"
   402  )
   403  
   404  // DomainJoin contains properties that define a domain to which the Virtual
   405  // Machine will be joined.
   406  type DomainJoin struct {
   407  	Credentials     Credentials `xml:",omitempty"` // Specifies the credentials to use to join the Virtual Machine to the domain.
   408  	JoinDomain      string      `xml:",omitempty"` // Specifies the domain to join.
   409  	MachineObjectOU string      `xml:",omitempty"` // Specifies the Lightweight Directory Access Protocol (LDAP) X 500-distinguished name of the organizational unit (OU) in which the computer account is created. This account is in Active Directory on a domain controller in the domain to which the computer is being joined.
   410  }
   411  
   412  // Credentials specifies the credentials to use to join the Virtual Machine to
   413  // the domain. If Domain is not specified, Username must specify the user
   414  // principal name (UPN) format (user@fully-qualified-DNS-domain) or the fully-
   415  // qualified-DNS-domain\username format.
   416  type Credentials struct {
   417  	Domain   string // Specifies the name of the domain used to authenticate an account. The value is a fully qualified DNS domain.
   418  	Username string // Specifies a user name in the domain that can be used to join the domain.
   419  	Password string // Specifies the password to use to join the domain.
   420  }
   421  
   422  // CertificateSetting specifies the parameters for the certificate which to
   423  // provision to the new Virtual Machine.
   424  type CertificateSetting struct {
   425  	StoreLocation string // Required. Specifies the certificate store location on the Virtual Machine. The only supported value is "LocalMachine".
   426  	StoreName     string // Required. Specifies the name of the certificate store from which the certificate is retrieved. For example, "My".
   427  	Thumbprint    string // Required. Specifies the thumbprint of the certificate. The thumbprint must specify an existing service certificate.
   428  }
   429  
   430  // WinRMListener specifies the protocol and certificate information for a WinRM
   431  // listener.
   432  type WinRMListener struct {
   433  	Protocol              WinRMProtocol // Specifies the protocol of listener.
   434  	CertificateThumbprint string        `xml:",omitempty"` // Specifies the certificate thumbprint for the secure connection. If this value is not specified, a self-signed certificate is generated and used for the Virtual Machine.
   435  }
   436  
   437  type WinRMProtocol string
   438  
   439  // Enum values for WinRMProtocol
   440  const (
   441  	WinRMProtocolHTTP  WinRMProtocol = "Http"
   442  	WinRMProtocolHTTPS WinRMProtocol = "Https"
   443  )
   444  
   445  // SSH specifies the SSH public keys and key pairs to use with the Virtual Machine.
   446  type SSH struct {
   447  	PublicKeys []PublicKey `xml:">PublicKey"`
   448  	KeyPairs   []KeyPair   `xml:">KeyPair"`
   449  }
   450  
   451  // PublicKey specifies a public SSH key.
   452  type PublicKey struct {
   453  	Fingerprint string // Specifies the SHA1 fingerprint of an X509 certificate associated with the cloud service and includes the SSH public key.
   454  	// Specifies the full path of a file, on the Virtual Machine, where the SSH public key is stored. If
   455  	// the file already exists, the specified key is appended to the file.
   456  	Path string // Usually /home/username/.ssh/authorized_keys
   457  }
   458  
   459  // KeyPair specifies an SSH keypair.
   460  type KeyPair struct {
   461  	Fingerprint string // Specifies the SHA1 fingerprint of an X509 certificate that is associated with the cloud service and includes the SSH keypair.
   462  	// Specifies the full path of a file, on the virtual machine, which stores the SSH private key. The
   463  	// file is overwritten when multiple keys are written to it. The SSH public key is stored in the same
   464  	// directory and has the same name as the private key file with .pub suffix.
   465  	Path string // Usually /home/username/.ssh/id_rsa
   466  }
   467  
   468  // InputEndpoint specifies the properties that define an external endpoint for
   469  // the Virtual Machine.
   470  type InputEndpoint struct {
   471  	LocalPort int                   // Specifies the internal port on which the Virtual Machine is listening.
   472  	Name      string                // Specifies the name of the external endpoint.
   473  	Port      int                   // Specifies the external port to use for the endpoint.
   474  	Protocol  InputEndpointProtocol //Specifies the transport protocol for the endpoint.
   475  	Vip       string                `xml:",omitempty"`
   476  }
   477  
   478  type InputEndpointProtocol string
   479  
   480  // Enum values for InputEndpointProtocol
   481  const (
   482  	InputEndpointProtocolTCP InputEndpointProtocol = "TCP"
   483  	InputEndpointProtocolUDP InputEndpointProtocol = "UDP"
   484  )
   485  
   486  // PublicIP contains a public IP address that can be used in addition to default
   487  // virtual IP address for the Virtual Machine.
   488  type PublicIP struct {
   489  	Name                 string // Specifies the name of the public IP address.
   490  	Address              string // Specifies the IP address.
   491  	IdleTimeoutInMinutes int    `xml:",omitempty"` // Specifies the timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP.
   492  }
   493  
   494  // ServiceCertificate contains a certificate for adding it to a hosted service
   495  type ServiceCertificate struct {
   496  	XMLName           xml.Name `xml:"CertificateFile"`
   497  	Data              string
   498  	CertificateFormat string
   499  	Password          string `xml:",omitempty"`
   500  }
   501  
   502  // StartRoleOperation contains the information for starting a Role.
   503  type StartRoleOperation struct {
   504  	XMLName       xml.Name `xml:"http://schemas.microsoft.com/windowsazure StartRoleOperation"`
   505  	OperationType string
   506  }
   507  
   508  type PostShutdownAction string
   509  
   510  // Enum values for PostShutdownAction
   511  const (
   512  	PostShutdownActionStopped            PostShutdownAction = "Stopped"
   513  	PostShutdownActionStoppedDeallocated PostShutdownAction = "StoppedDeallocated"
   514  )
   515  
   516  // ShutdownRoleOperation contains the information for shutting down a Role.
   517  type ShutdownRoleOperation struct {
   518  	XMLName            xml.Name `xml:"http://schemas.microsoft.com/windowsazure ShutdownRoleOperation"`
   519  	OperationType      string
   520  	PostShutdownAction PostShutdownAction
   521  }
   522  
   523  // RestartRoleOperation contains the information for restarting a Role.
   524  type RestartRoleOperation struct {
   525  	XMLName       xml.Name `xml:"http://schemas.microsoft.com/windowsazure RestartRoleOperation"`
   526  	OperationType string
   527  }
   528  
   529  // CaptureRoleOperation contains the information for capturing a Role
   530  type CaptureRoleOperation struct {
   531  	XMLName                   xml.Name `xml:"http://schemas.microsoft.com/windowsazure CaptureRoleOperation"`
   532  	OperationType             string
   533  	PostCaptureAction         PostCaptureAction
   534  	ProvisioningConfiguration *ConfigurationSet `xml:",omitempty"`
   535  	TargetImageLabel          string
   536  	TargetImageName           string
   537  }
   538  
   539  type PostCaptureAction string
   540  
   541  // Enum values for PostCaptureAction
   542  const (
   543  	PostCaptureActionDelete      PostCaptureAction = "Delete"
   544  	PostCaptureActionReprovision PostCaptureAction = "Reprovision"
   545  )
   546  
   547  // RoleSizeList contains a list of the available role sizes
   548  type RoleSizeList struct {
   549  	XMLName   xml.Name   `xml:"RoleSizes"`
   550  	RoleSizes []RoleSize `xml:"RoleSize"`
   551  }
   552  
   553  // RoleSize contains a detailed explanation of a role size
   554  type RoleSize struct {
   555  	Name                               string
   556  	Label                              string
   557  	Cores                              int
   558  	MemoryInMb                         int
   559  	SupportedByWebWorkerRoles          bool
   560  	SupportedByVirtualMachines         bool
   561  	MaxDataDiskCount                   int
   562  	WebWorkerResourceDiskSizeInMb      int
   563  	VirtualMachineResourceDiskSizeInMb int
   564  }
   565  
   566  // DNSServer contains the definition of a DNS server for virtual machine deployment
   567  type DNSServer struct {
   568  	Name    string
   569  	Address string
   570  }
   571  
   572  // LoadBalancer contains the definition of a load balancer for virtual machine deployment
   573  type LoadBalancer struct {
   574  	Name                          string        // Specifies the name of the internal load balancer.
   575  	Type                          IPAddressType `xml:"FrontendIpConfiguration>Type"`                                    // Specifies the type of virtual IP address that is provided by the load balancer. The only allowable value is Private.
   576  	SubnetName                    string        `xml:"FrontendIpConfiguration>SubnetName,omitempty"`                    // Required if the deployment exists in a virtual network and a StaticVirtualNetworkIPAddress is assigned. Specifies the subnet of the virtual network that the load balancer uses. The virtual IP address that is managed by the load balancer is contained in this subnet.
   577  	StaticVirtualNetworkIPAddress string        `xml:"FrontendIpConfiguration>StaticVirtualNetworkIPAddress,omitempty"` // Specifies a specific virtual IP address that the load balancer uses from the subnet in the virtual network.
   578  }
   579  
   580  type IPAddressType string
   581  
   582  // Enum values for IPAddressType
   583  const (
   584  	IPAddressTypePrivate IPAddressType = "Private" // Only allowed value (currently) for IPAddressType
   585  )
   586  
   587  type ResourceExtensions struct {
   588  	List []ResourceExtension `xml:"ResourceExtension"`
   589  }
   590  
   591  type ResourceExtension struct {
   592  	Publisher                   string
   593  	Name                        string
   594  	Version                     string
   595  	Label                       string
   596  	Description                 string
   597  	PublicConfigurationSchema   string
   598  	PrivateConfigurationSchema  string
   599  	SampleConfig                string
   600  	ReplicationCompleted        string
   601  	Eula                        string
   602  	PrivacyURI                  string `xml:"PrivacyUri"`
   603  	HomepageURI                 string `xml:"HomepageUri"`
   604  	IsJSONExtension             bool   `xml:"IsJsonExtension"`
   605  	IsInternalExtension         bool
   606  	DisallowMajorVersionUpgrade bool
   607  	CompanyName                 string
   608  	SupportedOS                 string
   609  	PublishedDate               string
   610  }
   611  
   612  type PersistentVMRole struct {
   613  	XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure PersistentVMRole"`
   614  	Role
   615  }
   616  

View as plain text