1// +build go1.7 2 3package virtualmachineimage 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// Client is used to perform operations on Azure VM Images. 27type Client struct { 28 management.Client 29} 30 31type ListVirtualMachineImagesResponse struct { 32 VMImages []VMImage `xml:"VMImage"` 33} 34 35type VMImage struct { 36 Name string // Specifies the name of the image. 37 Label string // Specifies an identifier for the image. 38 Category string // Specifies the repository classification of the image. All user images have the category User. 39 Description string // Specifies the description of the image. 40 OSDiskConfiguration OSDiskConfiguration // Specifies configuration information for the operating system disk that is associated with the image. 41 DataDiskConfigurations []DataDiskConfiguration `xml:">DataDiskConfiguration"` // Specifies configuration information for the data disks that are associated with the image. A VM Image might not have data disks associated with it. 42 ServiceName string // Specifies the name of the cloud service that contained the Virtual Machine from which the image was created. 43 DeploymentName string // Specifies the name of the deployment that contained the Virtual Machine from which the image was created. 44 RoleName string // Specifies the name of the Virtual Machine from which the image was created. 45 Location string // Specifies the geo-location in which the media is located. The Location value is derived from the storage account that contains the blob in which the media is located. If the storage account belongs to an affinity group the value is NULL and the element is not displayed in the response. 46 AffinityGroup string // Specifies the affinity group in which the media is located. The AffinityGroup value is derived from the storage account that contains the blob in which the media is located. If the storage account does not belong to an affinity group the value is NULL and the element is not displayed in the response. 47 CreatedTime string // Specifies the time that the image was created. 48 ModifiedTime string // Specifies the time that the image was last updated. 49 Language string // Specifies the language of the image. 50 ImageFamily string // Specifies a value that can be used to group VM Images. 51 RecommendedVMSize string // Optional. Specifies the size to use for the Virtual Machine that is created from the VM Image. 52 IsPremium string // Indicates whether the image contains software or associated services that will incur charges above the core price for the virtual machine. For additional details, see the PricingDetailLink element. 53 Eula string // Specifies the End User License Agreement that is associated with the image. The value for this element is a string, but it is recommended that the value be a URL that points to a EULA. 54 IconURI string `xml:"IconUri"` // Specifies the URI to the icon that is displayed for the image in the Management Portal. 55 SmallIconURI string `xml:"SmallIconUri"` // Specifies the URI to the small icon that is displayed for the image in the Management Portal. 56 PrivacyURI string `xml:"PrivacyUri"` // Specifies the URI that points to a document that contains the privacy policy related to the image. 57 PublishedDate string // Specifies the date when the image was added to the image repository. 58} 59 60type OSState string 61 62const ( 63 OSStateGeneralized OSState = "Generalized" 64 OSStateSpecialized OSState = "Specialized" 65) 66 67type IOType string 68 69const ( 70 IOTypeProvisioned IOType = "Provisioned" 71 IOTypeStandard IOType = "Standard" 72) 73 74// OSDiskConfiguration specifies configuration information for the operating 75// system disk that is associated with the image. 76type OSDiskConfiguration struct { 77 Name string // Specifies the name of the operating system disk. 78 HostCaching vmdisk.HostCachingType // Specifies the caching behavior of the operating system disk. 79 OSState OSState // Specifies the state of the operating system in the image. 80 OS string // Specifies the operating system type of the image. 81 MediaLink string // Specifies the location of the blob in Azure storage. The blob location belongs to a storage account in the subscription specified by the <subscription-id> value in the operation call. 82 LogicalSizeInGB float64 // Specifies the size, in GB, of the operating system disk. 83 IOType IOType // Identifies the type of the storage account for the backing VHD. If the backing VHD is in an Provisioned Storage account, “Provisioned” is returned otherwise “Standard” is returned. 84} 85 86// DataDiskConfiguration specifies configuration information for the data disks 87// that are associated with the image. 88type DataDiskConfiguration struct { 89 Name string // Specifies the name of the data disk. 90 HostCaching vmdisk.HostCachingType // Specifies the caching behavior of the data disk. 91 Lun string // Specifies the Logical Unit Number (LUN) for the data disk. 92 MediaLink string // Specifies the location of the blob in Azure storage. The blob location belongs to a storage account in the subscription specified by the <subscription-id> value in the operation call. 93 LogicalSizeInGB float64 // Specifies the size, in GB, of the data disk. 94 IOType IOType // Identifies the type of the storage account for the backing VHD. If the backing VHD is in an Provisioned Storage account, “Provisioned” is returned otherwise “Standard” is returned. 95} 96 97type CaptureRoleAsVMImageOperation struct { 98 XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure CaptureRoleAsVMImageOperation"` 99 OperationType string //CaptureRoleAsVMImageOperation 100 OSState OSState 101 VMImageName string 102 VMImageLabel string 103 CaptureParameters 104} 105 106type CaptureParameters struct { 107 Description string `xml:",omitempty"` 108 Language string `xml:",omitempty"` 109 ImageFamily string `xml:",omitempty"` 110 RecommendedVMSize string `xml:",omitempty"` 111} 112