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