diff --git a/profiles/latest/compute/mgmt/compute/models.go b/profiles/latest/compute/mgmt/compute/models.go
index 5e33dfcce10c..60f83ea30410 100644
--- a/profiles/latest/compute/mgmt/compute/models.go
+++ b/profiles/latest/compute/mgmt/compute/models.go
@@ -598,6 +598,7 @@ type ResourceSkusResult = original.ResourceSkusResult
type ResourceSkusResultIterator = original.ResourceSkusResultIterator
type ResourceSkusResultPage = original.ResourceSkusResultPage
type ResourceUpdate = original.ResourceUpdate
+type RollbackStatusInfo = original.RollbackStatusInfo
type RollingUpgradePolicy = original.RollingUpgradePolicy
type RollingUpgradeProgressInfo = original.RollingUpgradeProgressInfo
type RollingUpgradeRunningStatus = original.RollingUpgradeRunningStatus
diff --git a/profiles/preview/compute/mgmt/compute/models.go b/profiles/preview/compute/mgmt/compute/models.go
index f21402a0a626..198ee2052a18 100644
--- a/profiles/preview/compute/mgmt/compute/models.go
+++ b/profiles/preview/compute/mgmt/compute/models.go
@@ -598,6 +598,7 @@ type ResourceSkusResult = original.ResourceSkusResult
type ResourceSkusResultIterator = original.ResourceSkusResultIterator
type ResourceSkusResultPage = original.ResourceSkusResultPage
type ResourceUpdate = original.ResourceUpdate
+type RollbackStatusInfo = original.RollbackStatusInfo
type RollingUpgradePolicy = original.RollingUpgradePolicy
type RollingUpgradeProgressInfo = original.RollingUpgradeProgressInfo
type RollingUpgradeRunningStatus = original.RollingUpgradeRunningStatus
diff --git a/profiles/preview/preview/compute/mgmt/compute/models.go b/profiles/preview/preview/compute/mgmt/compute/models.go
new file mode 100644
index 000000000000..0c6069e7f972
--- /dev/null
+++ b/profiles/preview/preview/compute/mgmt/compute/models.go
@@ -0,0 +1,551 @@
+// +build go1.9
+
+// Copyright 2018 Microsoft Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// This code was auto-generated by:
+// github.com/Azure/azure-sdk-for-go/tools/profileBuilder
+
+package compute
+
+import original "github.com/Azure/azure-sdk-for-go/services/preview/compute/mgmt/2016-04-30-preview/compute"
+
+type AvailabilitySetsClient = original.AvailabilitySetsClient
+
+const (
+ DefaultBaseURI = original.DefaultBaseURI
+)
+
+type BaseClient = original.BaseClient
+type DisksClient = original.DisksClient
+type ImagesClient = original.ImagesClient
+type AccessLevel = original.AccessLevel
+
+const (
+ None AccessLevel = original.None
+ Read AccessLevel = original.Read
+)
+
+type CachingTypes = original.CachingTypes
+
+const (
+ CachingTypesNone CachingTypes = original.CachingTypesNone
+ CachingTypesReadOnly CachingTypes = original.CachingTypesReadOnly
+ CachingTypesReadWrite CachingTypes = original.CachingTypesReadWrite
+)
+
+type ComponentNames = original.ComponentNames
+
+const (
+ MicrosoftWindowsShellSetup ComponentNames = original.MicrosoftWindowsShellSetup
+)
+
+type DiskCreateOption = original.DiskCreateOption
+
+const (
+ Attach DiskCreateOption = original.Attach
+ Copy DiskCreateOption = original.Copy
+ Empty DiskCreateOption = original.Empty
+ FromImage DiskCreateOption = original.FromImage
+ Import DiskCreateOption = original.Import
+ Restore DiskCreateOption = original.Restore
+)
+
+type DiskCreateOptionTypes = original.DiskCreateOptionTypes
+
+const (
+ DiskCreateOptionTypesAttach DiskCreateOptionTypes = original.DiskCreateOptionTypesAttach
+ DiskCreateOptionTypesEmpty DiskCreateOptionTypes = original.DiskCreateOptionTypesEmpty
+ DiskCreateOptionTypesFromImage DiskCreateOptionTypes = original.DiskCreateOptionTypesFromImage
+)
+
+type InstanceViewTypes = original.InstanceViewTypes
+
+const (
+ InstanceView InstanceViewTypes = original.InstanceView
+)
+
+type OperatingSystemStateTypes = original.OperatingSystemStateTypes
+
+const (
+ Generalized OperatingSystemStateTypes = original.Generalized
+ Specialized OperatingSystemStateTypes = original.Specialized
+)
+
+type OperatingSystemTypes = original.OperatingSystemTypes
+
+const (
+ Linux OperatingSystemTypes = original.Linux
+ Windows OperatingSystemTypes = original.Windows
+)
+
+type PassNames = original.PassNames
+
+const (
+ OobeSystem PassNames = original.OobeSystem
+)
+
+type ProtocolTypes = original.ProtocolTypes
+
+const (
+ HTTP ProtocolTypes = original.HTTP
+ HTTPS ProtocolTypes = original.HTTPS
+)
+
+type ResourceIdentityType = original.ResourceIdentityType
+
+const (
+ SystemAssigned ResourceIdentityType = original.SystemAssigned
+)
+
+type SettingNames = original.SettingNames
+
+const (
+ AutoLogon SettingNames = original.AutoLogon
+ FirstLogonCommands SettingNames = original.FirstLogonCommands
+)
+
+type StatusLevelTypes = original.StatusLevelTypes
+
+const (
+ Error StatusLevelTypes = original.Error
+ Info StatusLevelTypes = original.Info
+ Warning StatusLevelTypes = original.Warning
+)
+
+type StorageAccountTypes = original.StorageAccountTypes
+
+const (
+ PremiumLRS StorageAccountTypes = original.PremiumLRS
+ StandardLRS StorageAccountTypes = original.StandardLRS
+)
+
+type UpgradeMode = original.UpgradeMode
+
+const (
+ Automatic UpgradeMode = original.Automatic
+ Manual UpgradeMode = original.Manual
+)
+
+type VirtualMachineScaleSetSkuScaleType = original.VirtualMachineScaleSetSkuScaleType
+
+const (
+ VirtualMachineScaleSetSkuScaleTypeAutomatic VirtualMachineScaleSetSkuScaleType = original.VirtualMachineScaleSetSkuScaleTypeAutomatic
+ VirtualMachineScaleSetSkuScaleTypeNone VirtualMachineScaleSetSkuScaleType = original.VirtualMachineScaleSetSkuScaleTypeNone
+)
+
+type VirtualMachineSizeTypes = original.VirtualMachineSizeTypes
+
+const (
+ BasicA0 VirtualMachineSizeTypes = original.BasicA0
+ BasicA1 VirtualMachineSizeTypes = original.BasicA1
+ BasicA2 VirtualMachineSizeTypes = original.BasicA2
+ BasicA3 VirtualMachineSizeTypes = original.BasicA3
+ BasicA4 VirtualMachineSizeTypes = original.BasicA4
+ StandardA0 VirtualMachineSizeTypes = original.StandardA0
+ StandardA1 VirtualMachineSizeTypes = original.StandardA1
+ StandardA10 VirtualMachineSizeTypes = original.StandardA10
+ StandardA11 VirtualMachineSizeTypes = original.StandardA11
+ StandardA2 VirtualMachineSizeTypes = original.StandardA2
+ StandardA3 VirtualMachineSizeTypes = original.StandardA3
+ StandardA4 VirtualMachineSizeTypes = original.StandardA4
+ StandardA5 VirtualMachineSizeTypes = original.StandardA5
+ StandardA6 VirtualMachineSizeTypes = original.StandardA6
+ StandardA7 VirtualMachineSizeTypes = original.StandardA7
+ StandardA8 VirtualMachineSizeTypes = original.StandardA8
+ StandardA9 VirtualMachineSizeTypes = original.StandardA9
+ StandardD1 VirtualMachineSizeTypes = original.StandardD1
+ StandardD11 VirtualMachineSizeTypes = original.StandardD11
+ StandardD11V2 VirtualMachineSizeTypes = original.StandardD11V2
+ StandardD12 VirtualMachineSizeTypes = original.StandardD12
+ StandardD12V2 VirtualMachineSizeTypes = original.StandardD12V2
+ StandardD13 VirtualMachineSizeTypes = original.StandardD13
+ StandardD13V2 VirtualMachineSizeTypes = original.StandardD13V2
+ StandardD14 VirtualMachineSizeTypes = original.StandardD14
+ StandardD14V2 VirtualMachineSizeTypes = original.StandardD14V2
+ StandardD15V2 VirtualMachineSizeTypes = original.StandardD15V2
+ StandardD1V2 VirtualMachineSizeTypes = original.StandardD1V2
+ StandardD2 VirtualMachineSizeTypes = original.StandardD2
+ StandardD2V2 VirtualMachineSizeTypes = original.StandardD2V2
+ StandardD3 VirtualMachineSizeTypes = original.StandardD3
+ StandardD3V2 VirtualMachineSizeTypes = original.StandardD3V2
+ StandardD4 VirtualMachineSizeTypes = original.StandardD4
+ StandardD4V2 VirtualMachineSizeTypes = original.StandardD4V2
+ StandardD5V2 VirtualMachineSizeTypes = original.StandardD5V2
+ StandardDS1 VirtualMachineSizeTypes = original.StandardDS1
+ StandardDS11 VirtualMachineSizeTypes = original.StandardDS11
+ StandardDS11V2 VirtualMachineSizeTypes = original.StandardDS11V2
+ StandardDS12 VirtualMachineSizeTypes = original.StandardDS12
+ StandardDS12V2 VirtualMachineSizeTypes = original.StandardDS12V2
+ StandardDS13 VirtualMachineSizeTypes = original.StandardDS13
+ StandardDS13V2 VirtualMachineSizeTypes = original.StandardDS13V2
+ StandardDS14 VirtualMachineSizeTypes = original.StandardDS14
+ StandardDS14V2 VirtualMachineSizeTypes = original.StandardDS14V2
+ StandardDS15V2 VirtualMachineSizeTypes = original.StandardDS15V2
+ StandardDS1V2 VirtualMachineSizeTypes = original.StandardDS1V2
+ StandardDS2 VirtualMachineSizeTypes = original.StandardDS2
+ StandardDS2V2 VirtualMachineSizeTypes = original.StandardDS2V2
+ StandardDS3 VirtualMachineSizeTypes = original.StandardDS3
+ StandardDS3V2 VirtualMachineSizeTypes = original.StandardDS3V2
+ StandardDS4 VirtualMachineSizeTypes = original.StandardDS4
+ StandardDS4V2 VirtualMachineSizeTypes = original.StandardDS4V2
+ StandardDS5V2 VirtualMachineSizeTypes = original.StandardDS5V2
+ StandardG1 VirtualMachineSizeTypes = original.StandardG1
+ StandardG2 VirtualMachineSizeTypes = original.StandardG2
+ StandardG3 VirtualMachineSizeTypes = original.StandardG3
+ StandardG4 VirtualMachineSizeTypes = original.StandardG4
+ StandardG5 VirtualMachineSizeTypes = original.StandardG5
+ StandardGS1 VirtualMachineSizeTypes = original.StandardGS1
+ StandardGS2 VirtualMachineSizeTypes = original.StandardGS2
+ StandardGS3 VirtualMachineSizeTypes = original.StandardGS3
+ StandardGS4 VirtualMachineSizeTypes = original.StandardGS4
+ StandardGS5 VirtualMachineSizeTypes = original.StandardGS5
+)
+
+type AccessURI = original.AccessURI
+type AccessURIOutput = original.AccessURIOutput
+type AccessURIRaw = original.AccessURIRaw
+type AdditionalUnattendContent = original.AdditionalUnattendContent
+type APIEntityReference = original.APIEntityReference
+type APIError = original.APIError
+type APIErrorBase = original.APIErrorBase
+type AvailabilitySet = original.AvailabilitySet
+type AvailabilitySetListResult = original.AvailabilitySetListResult
+type AvailabilitySetProperties = original.AvailabilitySetProperties
+type BootDiagnostics = original.BootDiagnostics
+type BootDiagnosticsInstanceView = original.BootDiagnosticsInstanceView
+type CreationData = original.CreationData
+type DataDisk = original.DataDisk
+type DataDiskImage = original.DataDiskImage
+type DiagnosticsProfile = original.DiagnosticsProfile
+type Disk = original.Disk
+type DiskEncryptionSettings = original.DiskEncryptionSettings
+type DiskInstanceView = original.DiskInstanceView
+type DiskList = original.DiskList
+type DiskListIterator = original.DiskListIterator
+type DiskListPage = original.DiskListPage
+type DiskProperties = original.DiskProperties
+type DisksCreateOrUpdateFuture = original.DisksCreateOrUpdateFuture
+type DisksDeleteFuture = original.DisksDeleteFuture
+type DisksGrantAccessFuture = original.DisksGrantAccessFuture
+type DisksRevokeAccessFuture = original.DisksRevokeAccessFuture
+type DisksUpdateFuture = original.DisksUpdateFuture
+type DiskUpdate = original.DiskUpdate
+type DiskUpdateProperties = original.DiskUpdateProperties
+type EncryptionSettings = original.EncryptionSettings
+type GrantAccessData = original.GrantAccessData
+type HardwareProfile = original.HardwareProfile
+type Image = original.Image
+type ImageDataDisk = original.ImageDataDisk
+type ImageDiskReference = original.ImageDiskReference
+type ImageListResult = original.ImageListResult
+type ImageListResultIterator = original.ImageListResultIterator
+type ImageListResultPage = original.ImageListResultPage
+type ImageOSDisk = original.ImageOSDisk
+type ImageProperties = original.ImageProperties
+type ImageReference = original.ImageReference
+type ImagesCreateOrUpdateFuture = original.ImagesCreateOrUpdateFuture
+type ImagesDeleteFuture = original.ImagesDeleteFuture
+type ImageStorageProfile = original.ImageStorageProfile
+type InnerError = original.InnerError
+type InstanceViewStatus = original.InstanceViewStatus
+type KeyVaultAndKeyReference = original.KeyVaultAndKeyReference
+type KeyVaultAndSecretReference = original.KeyVaultAndSecretReference
+type KeyVaultKeyReference = original.KeyVaultKeyReference
+type KeyVaultSecretReference = original.KeyVaultSecretReference
+type LinuxConfiguration = original.LinuxConfiguration
+type ListUsagesResult = original.ListUsagesResult
+type ListUsagesResultIterator = original.ListUsagesResultIterator
+type ListUsagesResultPage = original.ListUsagesResultPage
+type ListVirtualMachineExtensionImage = original.ListVirtualMachineExtensionImage
+type ListVirtualMachineImageResource = original.ListVirtualMachineImageResource
+type LongRunningOperationProperties = original.LongRunningOperationProperties
+type ManagedDiskParameters = original.ManagedDiskParameters
+type NetworkInterfaceReference = original.NetworkInterfaceReference
+type NetworkInterfaceReferenceProperties = original.NetworkInterfaceReferenceProperties
+type NetworkProfile = original.NetworkProfile
+type OperationStatusResponse = original.OperationStatusResponse
+type OSDisk = original.OSDisk
+type OSDiskImage = original.OSDiskImage
+type OSProfile = original.OSProfile
+type Plan = original.Plan
+type PurchasePlan = original.PurchasePlan
+type Resource = original.Resource
+type ResourceUpdate = original.ResourceUpdate
+type Sku = original.Sku
+type Snapshot = original.Snapshot
+type SnapshotList = original.SnapshotList
+type SnapshotListIterator = original.SnapshotListIterator
+type SnapshotListPage = original.SnapshotListPage
+type SnapshotsCreateOrUpdateFuture = original.SnapshotsCreateOrUpdateFuture
+type SnapshotsDeleteFuture = original.SnapshotsDeleteFuture
+type SnapshotsGrantAccessFuture = original.SnapshotsGrantAccessFuture
+type SnapshotsRevokeAccessFuture = original.SnapshotsRevokeAccessFuture
+type SnapshotsUpdateFuture = original.SnapshotsUpdateFuture
+type SnapshotUpdate = original.SnapshotUpdate
+type SourceVault = original.SourceVault
+type SSHConfiguration = original.SSHConfiguration
+type SSHPublicKey = original.SSHPublicKey
+type StorageProfile = original.StorageProfile
+type SubResource = original.SubResource
+type SubResourceReadOnly = original.SubResourceReadOnly
+type UpdateResource = original.UpdateResource
+type UpgradePolicy = original.UpgradePolicy
+type Usage = original.Usage
+type UsageName = original.UsageName
+type VaultCertificate = original.VaultCertificate
+type VaultSecretGroup = original.VaultSecretGroup
+type VirtualHardDisk = original.VirtualHardDisk
+type VirtualMachine = original.VirtualMachine
+type VirtualMachineAgentInstanceView = original.VirtualMachineAgentInstanceView
+type VirtualMachineCaptureParameters = original.VirtualMachineCaptureParameters
+type VirtualMachineCaptureResult = original.VirtualMachineCaptureResult
+type VirtualMachineCaptureResultProperties = original.VirtualMachineCaptureResultProperties
+type VirtualMachineExtension = original.VirtualMachineExtension
+type VirtualMachineExtensionHandlerInstanceView = original.VirtualMachineExtensionHandlerInstanceView
+type VirtualMachineExtensionImage = original.VirtualMachineExtensionImage
+type VirtualMachineExtensionImageProperties = original.VirtualMachineExtensionImageProperties
+type VirtualMachineExtensionInstanceView = original.VirtualMachineExtensionInstanceView
+type VirtualMachineExtensionProperties = original.VirtualMachineExtensionProperties
+type VirtualMachineExtensionsCreateOrUpdateFuture = original.VirtualMachineExtensionsCreateOrUpdateFuture
+type VirtualMachineExtensionsDeleteFuture = original.VirtualMachineExtensionsDeleteFuture
+type VirtualMachineExtensionsListResult = original.VirtualMachineExtensionsListResult
+type VirtualMachineExtensionsUpdateFuture = original.VirtualMachineExtensionsUpdateFuture
+type VirtualMachineExtensionUpdate = original.VirtualMachineExtensionUpdate
+type VirtualMachineExtensionUpdateProperties = original.VirtualMachineExtensionUpdateProperties
+type VirtualMachineIdentity = original.VirtualMachineIdentity
+type VirtualMachineImage = original.VirtualMachineImage
+type VirtualMachineImageProperties = original.VirtualMachineImageProperties
+type VirtualMachineImageResource = original.VirtualMachineImageResource
+type VirtualMachineInstanceView = original.VirtualMachineInstanceView
+type VirtualMachineListResult = original.VirtualMachineListResult
+type VirtualMachineListResultIterator = original.VirtualMachineListResultIterator
+type VirtualMachineListResultPage = original.VirtualMachineListResultPage
+type VirtualMachineProperties = original.VirtualMachineProperties
+type VirtualMachineScaleSet = original.VirtualMachineScaleSet
+type VirtualMachineScaleSetDataDisk = original.VirtualMachineScaleSetDataDisk
+type VirtualMachineScaleSetExtension = original.VirtualMachineScaleSetExtension
+type VirtualMachineScaleSetExtensionProfile = original.VirtualMachineScaleSetExtensionProfile
+type VirtualMachineScaleSetExtensionProperties = original.VirtualMachineScaleSetExtensionProperties
+type VirtualMachineScaleSetIdentity = original.VirtualMachineScaleSetIdentity
+type VirtualMachineScaleSetInstanceView = original.VirtualMachineScaleSetInstanceView
+type VirtualMachineScaleSetInstanceViewStatusesSummary = original.VirtualMachineScaleSetInstanceViewStatusesSummary
+type VirtualMachineScaleSetIPConfiguration = original.VirtualMachineScaleSetIPConfiguration
+type VirtualMachineScaleSetIPConfigurationProperties = original.VirtualMachineScaleSetIPConfigurationProperties
+type VirtualMachineScaleSetListResult = original.VirtualMachineScaleSetListResult
+type VirtualMachineScaleSetListResultIterator = original.VirtualMachineScaleSetListResultIterator
+type VirtualMachineScaleSetListResultPage = original.VirtualMachineScaleSetListResultPage
+type VirtualMachineScaleSetListSkusResult = original.VirtualMachineScaleSetListSkusResult
+type VirtualMachineScaleSetListSkusResultIterator = original.VirtualMachineScaleSetListSkusResultIterator
+type VirtualMachineScaleSetListSkusResultPage = original.VirtualMachineScaleSetListSkusResultPage
+type VirtualMachineScaleSetListWithLinkResult = original.VirtualMachineScaleSetListWithLinkResult
+type VirtualMachineScaleSetListWithLinkResultIterator = original.VirtualMachineScaleSetListWithLinkResultIterator
+type VirtualMachineScaleSetListWithLinkResultPage = original.VirtualMachineScaleSetListWithLinkResultPage
+type VirtualMachineScaleSetManagedDiskParameters = original.VirtualMachineScaleSetManagedDiskParameters
+type VirtualMachineScaleSetNetworkConfiguration = original.VirtualMachineScaleSetNetworkConfiguration
+type VirtualMachineScaleSetNetworkConfigurationProperties = original.VirtualMachineScaleSetNetworkConfigurationProperties
+type VirtualMachineScaleSetNetworkProfile = original.VirtualMachineScaleSetNetworkProfile
+type VirtualMachineScaleSetOSDisk = original.VirtualMachineScaleSetOSDisk
+type VirtualMachineScaleSetOSProfile = original.VirtualMachineScaleSetOSProfile
+type VirtualMachineScaleSetProperties = original.VirtualMachineScaleSetProperties
+type VirtualMachineScaleSetsCreateOrUpdateFuture = original.VirtualMachineScaleSetsCreateOrUpdateFuture
+type VirtualMachineScaleSetsDeallocateFuture = original.VirtualMachineScaleSetsDeallocateFuture
+type VirtualMachineScaleSetsDeleteFuture = original.VirtualMachineScaleSetsDeleteFuture
+type VirtualMachineScaleSetsDeleteInstancesFuture = original.VirtualMachineScaleSetsDeleteInstancesFuture
+type VirtualMachineScaleSetSku = original.VirtualMachineScaleSetSku
+type VirtualMachineScaleSetSkuCapacity = original.VirtualMachineScaleSetSkuCapacity
+type VirtualMachineScaleSetsPowerOffFuture = original.VirtualMachineScaleSetsPowerOffFuture
+type VirtualMachineScaleSetsReimageAllFuture = original.VirtualMachineScaleSetsReimageAllFuture
+type VirtualMachineScaleSetsReimageFuture = original.VirtualMachineScaleSetsReimageFuture
+type VirtualMachineScaleSetsRestartFuture = original.VirtualMachineScaleSetsRestartFuture
+type VirtualMachineScaleSetsStartFuture = original.VirtualMachineScaleSetsStartFuture
+type VirtualMachineScaleSetStorageProfile = original.VirtualMachineScaleSetStorageProfile
+type VirtualMachineScaleSetsUpdateInstancesFuture = original.VirtualMachineScaleSetsUpdateInstancesFuture
+type VirtualMachineScaleSetVM = original.VirtualMachineScaleSetVM
+type VirtualMachineScaleSetVMExtensionsSummary = original.VirtualMachineScaleSetVMExtensionsSummary
+type VirtualMachineScaleSetVMInstanceIDs = original.VirtualMachineScaleSetVMInstanceIDs
+type VirtualMachineScaleSetVMInstanceRequiredIDs = original.VirtualMachineScaleSetVMInstanceRequiredIDs
+type VirtualMachineScaleSetVMInstanceView = original.VirtualMachineScaleSetVMInstanceView
+type VirtualMachineScaleSetVMListResult = original.VirtualMachineScaleSetVMListResult
+type VirtualMachineScaleSetVMListResultIterator = original.VirtualMachineScaleSetVMListResultIterator
+type VirtualMachineScaleSetVMListResultPage = original.VirtualMachineScaleSetVMListResultPage
+type VirtualMachineScaleSetVMProfile = original.VirtualMachineScaleSetVMProfile
+type VirtualMachineScaleSetVMProperties = original.VirtualMachineScaleSetVMProperties
+type VirtualMachineScaleSetVMsDeallocateFuture = original.VirtualMachineScaleSetVMsDeallocateFuture
+type VirtualMachineScaleSetVMsDeleteFuture = original.VirtualMachineScaleSetVMsDeleteFuture
+type VirtualMachineScaleSetVMsPowerOffFuture = original.VirtualMachineScaleSetVMsPowerOffFuture
+type VirtualMachineScaleSetVMsReimageAllFuture = original.VirtualMachineScaleSetVMsReimageAllFuture
+type VirtualMachineScaleSetVMsReimageFuture = original.VirtualMachineScaleSetVMsReimageFuture
+type VirtualMachineScaleSetVMsRestartFuture = original.VirtualMachineScaleSetVMsRestartFuture
+type VirtualMachineScaleSetVMsStartFuture = original.VirtualMachineScaleSetVMsStartFuture
+type VirtualMachinesCaptureFuture = original.VirtualMachinesCaptureFuture
+type VirtualMachinesConvertToManagedDisksFuture = original.VirtualMachinesConvertToManagedDisksFuture
+type VirtualMachinesCreateOrUpdateFuture = original.VirtualMachinesCreateOrUpdateFuture
+type VirtualMachinesDeallocateFuture = original.VirtualMachinesDeallocateFuture
+type VirtualMachinesDeleteFuture = original.VirtualMachinesDeleteFuture
+type VirtualMachineSize = original.VirtualMachineSize
+type VirtualMachineSizeListResult = original.VirtualMachineSizeListResult
+type VirtualMachinesPowerOffFuture = original.VirtualMachinesPowerOffFuture
+type VirtualMachinesRedeployFuture = original.VirtualMachinesRedeployFuture
+type VirtualMachinesRestartFuture = original.VirtualMachinesRestartFuture
+type VirtualMachinesStartFuture = original.VirtualMachinesStartFuture
+type VirtualMachineStatusCodeCount = original.VirtualMachineStatusCodeCount
+type WindowsConfiguration = original.WindowsConfiguration
+type WinRMConfiguration = original.WinRMConfiguration
+type WinRMListener = original.WinRMListener
+type SnapshotsClient = original.SnapshotsClient
+type UsageClient = original.UsageClient
+type VirtualMachineExtensionImagesClient = original.VirtualMachineExtensionImagesClient
+type VirtualMachineExtensionsClient = original.VirtualMachineExtensionsClient
+type VirtualMachineImagesClient = original.VirtualMachineImagesClient
+type VirtualMachinesClient = original.VirtualMachinesClient
+type VirtualMachineScaleSetsClient = original.VirtualMachineScaleSetsClient
+type VirtualMachineScaleSetVMsClient = original.VirtualMachineScaleSetVMsClient
+type VirtualMachineSizesClient = original.VirtualMachineSizesClient
+
+func NewAvailabilitySetsClient(subscriptionID string) AvailabilitySetsClient {
+ return original.NewAvailabilitySetsClient(subscriptionID)
+}
+func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string) AvailabilitySetsClient {
+ return original.NewAvailabilitySetsClientWithBaseURI(baseURI, subscriptionID)
+}
+func New(subscriptionID string) BaseClient {
+ return original.New(subscriptionID)
+}
+func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
+ return original.NewWithBaseURI(baseURI, subscriptionID)
+}
+func NewDisksClient(subscriptionID string) DisksClient {
+ return original.NewDisksClient(subscriptionID)
+}
+func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient {
+ return original.NewDisksClientWithBaseURI(baseURI, subscriptionID)
+}
+func NewImagesClient(subscriptionID string) ImagesClient {
+ return original.NewImagesClient(subscriptionID)
+}
+func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesClient {
+ return original.NewImagesClientWithBaseURI(baseURI, subscriptionID)
+}
+func PossibleAccessLevelValues() []AccessLevel {
+ return original.PossibleAccessLevelValues()
+}
+func PossibleCachingTypesValues() []CachingTypes {
+ return original.PossibleCachingTypesValues()
+}
+func PossibleComponentNamesValues() []ComponentNames {
+ return original.PossibleComponentNamesValues()
+}
+func PossibleDiskCreateOptionValues() []DiskCreateOption {
+ return original.PossibleDiskCreateOptionValues()
+}
+func PossibleDiskCreateOptionTypesValues() []DiskCreateOptionTypes {
+ return original.PossibleDiskCreateOptionTypesValues()
+}
+func PossibleInstanceViewTypesValues() []InstanceViewTypes {
+ return original.PossibleInstanceViewTypesValues()
+}
+func PossibleOperatingSystemStateTypesValues() []OperatingSystemStateTypes {
+ return original.PossibleOperatingSystemStateTypesValues()
+}
+func PossibleOperatingSystemTypesValues() []OperatingSystemTypes {
+ return original.PossibleOperatingSystemTypesValues()
+}
+func PossiblePassNamesValues() []PassNames {
+ return original.PossiblePassNamesValues()
+}
+func PossibleProtocolTypesValues() []ProtocolTypes {
+ return original.PossibleProtocolTypesValues()
+}
+func PossibleResourceIdentityTypeValues() []ResourceIdentityType {
+ return original.PossibleResourceIdentityTypeValues()
+}
+func PossibleSettingNamesValues() []SettingNames {
+ return original.PossibleSettingNamesValues()
+}
+func PossibleStatusLevelTypesValues() []StatusLevelTypes {
+ return original.PossibleStatusLevelTypesValues()
+}
+func PossibleStorageAccountTypesValues() []StorageAccountTypes {
+ return original.PossibleStorageAccountTypesValues()
+}
+func PossibleUpgradeModeValues() []UpgradeMode {
+ return original.PossibleUpgradeModeValues()
+}
+func PossibleVirtualMachineScaleSetSkuScaleTypeValues() []VirtualMachineScaleSetSkuScaleType {
+ return original.PossibleVirtualMachineScaleSetSkuScaleTypeValues()
+}
+func PossibleVirtualMachineSizeTypesValues() []VirtualMachineSizeTypes {
+ return original.PossibleVirtualMachineSizeTypesValues()
+}
+func NewSnapshotsClient(subscriptionID string) SnapshotsClient {
+ return original.NewSnapshotsClient(subscriptionID)
+}
+func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient {
+ return original.NewSnapshotsClientWithBaseURI(baseURI, subscriptionID)
+}
+func NewUsageClient(subscriptionID string) UsageClient {
+ return original.NewUsageClient(subscriptionID)
+}
+func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient {
+ return original.NewUsageClientWithBaseURI(baseURI, subscriptionID)
+}
+func UserAgent() string {
+ return original.UserAgent() + " profiles/preview"
+}
+func Version() string {
+ return original.Version()
+}
+func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachineExtensionImagesClient {
+ return original.NewVirtualMachineExtensionImagesClient(subscriptionID)
+}
+func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient {
+ return original.NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI, subscriptionID)
+}
+func NewVirtualMachineExtensionsClient(subscriptionID string) VirtualMachineExtensionsClient {
+ return original.NewVirtualMachineExtensionsClient(subscriptionID)
+}
+func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionsClient {
+ return original.NewVirtualMachineExtensionsClientWithBaseURI(baseURI, subscriptionID)
+}
+func NewVirtualMachineImagesClient(subscriptionID string) VirtualMachineImagesClient {
+ return original.NewVirtualMachineImagesClient(subscriptionID)
+}
+func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineImagesClient {
+ return original.NewVirtualMachineImagesClientWithBaseURI(baseURI, subscriptionID)
+}
+func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient {
+ return original.NewVirtualMachinesClient(subscriptionID)
+}
+func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient {
+ return original.NewVirtualMachinesClientWithBaseURI(baseURI, subscriptionID)
+}
+func NewVirtualMachineScaleSetsClient(subscriptionID string) VirtualMachineScaleSetsClient {
+ return original.NewVirtualMachineScaleSetsClient(subscriptionID)
+}
+func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetsClient {
+ return original.NewVirtualMachineScaleSetsClientWithBaseURI(baseURI, subscriptionID)
+}
+func NewVirtualMachineScaleSetVMsClient(subscriptionID string) VirtualMachineScaleSetVMsClient {
+ return original.NewVirtualMachineScaleSetVMsClient(subscriptionID)
+}
+func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetVMsClient {
+ return original.NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI, subscriptionID)
+}
+func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient {
+ return original.NewVirtualMachineSizesClient(subscriptionID)
+}
+func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient {
+ return original.NewVirtualMachineSizesClientWithBaseURI(baseURI, subscriptionID)
+}
diff --git a/profiles/preview/preview/containerservice/mgmt/containerservice/models.go b/profiles/preview/preview/containerservice/mgmt/containerservice/models.go
new file mode 100644
index 000000000000..360809335f4a
--- /dev/null
+++ b/profiles/preview/preview/containerservice/mgmt/containerservice/models.go
@@ -0,0 +1,129 @@
+// +build go1.9
+
+// Copyright 2018 Microsoft Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// This code was auto-generated by:
+// github.com/Azure/azure-sdk-for-go/tools/profileBuilder
+
+package containerservice
+
+import original "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice"
+
+const (
+ DefaultBaseURI = original.DefaultBaseURI
+)
+
+type BaseClient = original.BaseClient
+type Client = original.Client
+type OchestratorTypes = original.OchestratorTypes
+
+const (
+ DCOS OchestratorTypes = original.DCOS
+ Mesos OchestratorTypes = original.Mesos
+ SwarmPreview OchestratorTypes = original.SwarmPreview
+)
+
+type VMSizeTypes = original.VMSizeTypes
+
+const (
+ StandardA0 VMSizeTypes = original.StandardA0
+ StandardA1 VMSizeTypes = original.StandardA1
+ StandardA10 VMSizeTypes = original.StandardA10
+ StandardA11 VMSizeTypes = original.StandardA11
+ StandardA2 VMSizeTypes = original.StandardA2
+ StandardA3 VMSizeTypes = original.StandardA3
+ StandardA4 VMSizeTypes = original.StandardA4
+ StandardA5 VMSizeTypes = original.StandardA5
+ StandardA6 VMSizeTypes = original.StandardA6
+ StandardA7 VMSizeTypes = original.StandardA7
+ StandardA8 VMSizeTypes = original.StandardA8
+ StandardA9 VMSizeTypes = original.StandardA9
+ StandardD1 VMSizeTypes = original.StandardD1
+ StandardD11 VMSizeTypes = original.StandardD11
+ StandardD11V2 VMSizeTypes = original.StandardD11V2
+ StandardD12 VMSizeTypes = original.StandardD12
+ StandardD12V2 VMSizeTypes = original.StandardD12V2
+ StandardD13 VMSizeTypes = original.StandardD13
+ StandardD13V2 VMSizeTypes = original.StandardD13V2
+ StandardD14 VMSizeTypes = original.StandardD14
+ StandardD14V2 VMSizeTypes = original.StandardD14V2
+ StandardD1V2 VMSizeTypes = original.StandardD1V2
+ StandardD2 VMSizeTypes = original.StandardD2
+ StandardD2V2 VMSizeTypes = original.StandardD2V2
+ StandardD3 VMSizeTypes = original.StandardD3
+ StandardD3V2 VMSizeTypes = original.StandardD3V2
+ StandardD4 VMSizeTypes = original.StandardD4
+ StandardD4V2 VMSizeTypes = original.StandardD4V2
+ StandardD5V2 VMSizeTypes = original.StandardD5V2
+ StandardDS1 VMSizeTypes = original.StandardDS1
+ StandardDS11 VMSizeTypes = original.StandardDS11
+ StandardDS12 VMSizeTypes = original.StandardDS12
+ StandardDS13 VMSizeTypes = original.StandardDS13
+ StandardDS14 VMSizeTypes = original.StandardDS14
+ StandardDS2 VMSizeTypes = original.StandardDS2
+ StandardDS3 VMSizeTypes = original.StandardDS3
+ StandardDS4 VMSizeTypes = original.StandardDS4
+ StandardG1 VMSizeTypes = original.StandardG1
+ StandardG2 VMSizeTypes = original.StandardG2
+ StandardG3 VMSizeTypes = original.StandardG3
+ StandardG4 VMSizeTypes = original.StandardG4
+ StandardG5 VMSizeTypes = original.StandardG5
+ StandardGS1 VMSizeTypes = original.StandardGS1
+ StandardGS2 VMSizeTypes = original.StandardGS2
+ StandardGS3 VMSizeTypes = original.StandardGS3
+ StandardGS4 VMSizeTypes = original.StandardGS4
+ StandardGS5 VMSizeTypes = original.StandardGS5
+)
+
+type AgentPoolProfile = original.AgentPoolProfile
+type ContainerService = original.ContainerService
+type CreateOrUpdateFuture = original.CreateOrUpdateFuture
+type DeleteFuture = original.DeleteFuture
+type DiagnosticsProfile = original.DiagnosticsProfile
+type LinuxProfile = original.LinuxProfile
+type ListResult = original.ListResult
+type MasterProfile = original.MasterProfile
+type OrchestratorProfile = original.OrchestratorProfile
+type Properties = original.Properties
+type Resource = original.Resource
+type SSHConfiguration = original.SSHConfiguration
+type SSHPublicKey = original.SSHPublicKey
+type VMDiagnostics = original.VMDiagnostics
+type WindowsProfile = original.WindowsProfile
+
+func New(subscriptionID string) BaseClient {
+ return original.New(subscriptionID)
+}
+func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
+ return original.NewWithBaseURI(baseURI, subscriptionID)
+}
+func NewClient(subscriptionID string) Client {
+ return original.NewClient(subscriptionID)
+}
+func NewClientWithBaseURI(baseURI string, subscriptionID string) Client {
+ return original.NewClientWithBaseURI(baseURI, subscriptionID)
+}
+func PossibleOchestratorTypesValues() []OchestratorTypes {
+ return original.PossibleOchestratorTypesValues()
+}
+func PossibleVMSizeTypesValues() []VMSizeTypes {
+ return original.PossibleVMSizeTypesValues()
+}
+func UserAgent() string {
+ return original.UserAgent() + " profiles/preview"
+}
+func Version() string {
+ return original.Version()
+}
diff --git a/services/compute/mgmt/2018-04-01/compute/models.go b/services/compute/mgmt/2018-04-01/compute/models.go
index c05065047c91..5a4648905409 100644
--- a/services/compute/mgmt/2018-04-01/compute/models.go
+++ b/services/compute/mgmt/2018-04-01/compute/models.go
@@ -1243,13 +1243,7 @@ type AvailabilitySetProperties struct {
}
// AvailabilitySetUpdate specifies information about the availability set that the virtual machine should be
-// assigned to. Virtual machines specified in the same availability set are allocated to different nodes to
-// maximize availability. For more information about availability sets, see [Manage the availability of virtual
-// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
-//
For more information on Azure planned maintainance, see [Planned maintenance for virtual machines in
-// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
-//
Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added
-// to an availability set.
+// assigned to. Only tags may be updated.
type AvailabilitySetUpdate struct {
*AvailabilitySetProperties `json:"properties,omitempty"`
// Sku - Sku of the availability set
@@ -2873,8 +2867,7 @@ func (future ImagesUpdateFuture) Result(client ImagesClient) (i Image, err error
return
}
-// ImageUpdate the source user image virtual hard disk. The virtual hard disk will be copied before being attached
-// to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.
+// ImageUpdate the source user image virtual hard disk. Only tags may be updated.
type ImageUpdate struct {
*ImageProperties `json:"properties,omitempty"`
// Tags - Resource tags
@@ -3786,6 +3779,16 @@ func (ru ResourceUpdate) MarshalJSON() ([]byte, error) {
return json.Marshal(objectMap)
}
+// RollbackStatusInfo information about rollback on failed VM instances after a OS Upgrade operation
+type RollbackStatusInfo struct {
+ // SuccessfullyRolledbackInstanceCount - The number of instances which have been successfully rolled back.
+ SuccessfullyRolledbackInstanceCount *int32 `json:"successfullyRolledbackInstanceCount,omitempty"`
+ // FailedRolledbackInstanceCount - The number of instances which failed to rollback.
+ FailedRolledbackInstanceCount *int32 `json:"failedRolledbackInstanceCount,omitempty"`
+ // RollbackError - Error Details if OS rollback failed.
+ RollbackError *APIError `json:"rollbackError,omitempty"`
+}
+
// RollingUpgradePolicy the configuration parameters used while performing a rolling upgrade.
type RollingUpgradePolicy struct {
// MaxBatchInstancePercent - The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability. The default value for this parameter is 20%.
@@ -4883,6 +4886,8 @@ type UpgradeOperationHistoricalStatusInfoProperties struct {
StartedBy UpgradeOperationInvoker `json:"startedBy,omitempty"`
// TargetImageReference - Image Reference details
TargetImageReference *ImageReference `json:"targetImageReference,omitempty"`
+ // RollbackInfo - Information about OS rollback if performed
+ RollbackInfo *RollbackStatusInfo `json:"rollbackInfo,omitempty"`
}
// UpgradeOperationHistoryStatus information about the current running state of the overall upgrade.
@@ -8732,7 +8737,7 @@ type VirtualMachineScaleSetVMProfile struct {
LicenseType *string `json:"licenseType,omitempty"`
// Priority - Specifies the priority for the virtual machines in the scale set.
Minimum api-version: 2017-10-30-preview. Possible values include: 'Regular', 'Low'
Priority VirtualMachinePriorityTypes `json:"priority,omitempty"`
- // EvictionPolicy - Specifies the eviction policy for virtual machines in the low priority scale set.
Minimum api-version: 2017-10-30-preview. Possible values include: 'Deallocate', 'Delete'
+ // EvictionPolicy - Specifies the eviction policy for virtual machines in a low priority scale set.
Minimum api-version: 2017-10-30-preview. Possible values include: 'Deallocate', 'Delete'
EvictionPolicy VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"`
}
@@ -9871,7 +9876,7 @@ func (future VirtualMachinesUpdateFuture) Result(client VirtualMachinesClient) (
return
}
-// VirtualMachineUpdate describes a Virtual Machine.
+// VirtualMachineUpdate describes a Virtual Machine Update.
type VirtualMachineUpdate struct {
// Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**.
Plan *Plan `json:"plan,omitempty"`
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/availabilitysets.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/availabilitysets.go
new file mode 100644
index 000000000000..3f446fabaa6d
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/availabilitysets.go
@@ -0,0 +1,373 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "net/http"
+)
+
+// AvailabilitySetsClient is the compute Client
+type AvailabilitySetsClient struct {
+ BaseClient
+}
+
+// NewAvailabilitySetsClient creates an instance of the AvailabilitySetsClient client.
+func NewAvailabilitySetsClient(subscriptionID string) AvailabilitySetsClient {
+ return NewAvailabilitySetsClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewAvailabilitySetsClientWithBaseURI creates an instance of the AvailabilitySetsClient client.
+func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string) AvailabilitySetsClient {
+ return AvailabilitySetsClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// CreateOrUpdate create or update an availability set.
+//
+// resourceGroupName is the name of the resource group. name is the name of the availability set. parameters is
+// parameters supplied to the Create Availability Set operation.
+func (client AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters AvailabilitySet) (result AvailabilitySet, err error) {
+ req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, parameters)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.CreateOrUpdateSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.CreateOrUpdateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "CreateOrUpdate", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
+func (client AvailabilitySetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, parameters AvailabilitySet) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "availabilitySetName": autorest.Encode("path", name),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPut(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
+ autorest.WithJSON(parameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
+// http.Response Body if it receives an error.
+func (client AvailabilitySetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
+// closes the http.Response Body.
+func (client AvailabilitySetsClient) CreateOrUpdateResponder(resp *http.Response) (result AvailabilitySet, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Delete delete an availability set.
+//
+// resourceGroupName is the name of the resource group. availabilitySetName is the name of the availability set.
+func (client AvailabilitySetsClient) Delete(ctx context.Context, resourceGroupName string, availabilitySetName string) (result OperationStatusResponse, err error) {
+ req, err := client.DeletePreparer(ctx, resourceGroupName, availabilitySetName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.DeleteSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.DeleteResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Delete", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// DeletePreparer prepares the Delete request.
+func (client AvailabilitySetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "availabilitySetName": autorest.Encode("path", availabilitySetName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsDelete(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeleteSender sends the Delete request. The method will close the
+// http.Response Body if it receives an error.
+func (client AvailabilitySetsClient) DeleteSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// DeleteResponder handles the response to the Delete request. The method always
+// closes the http.Response Body.
+func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Get retrieves information about an availability set.
+//
+// resourceGroupName is the name of the resource group. availabilitySetName is the name of the availability set.
+func (client AvailabilitySetsClient) Get(ctx context.Context, resourceGroupName string, availabilitySetName string) (result AvailabilitySet, err error) {
+ req, err := client.GetPreparer(ctx, resourceGroupName, availabilitySetName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "Get", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetPreparer prepares the Get request.
+func (client AvailabilitySetsClient) GetPreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "availabilitySetName": autorest.Encode("path", availabilitySetName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetSender sends the Get request. The method will close the
+// http.Response Body if it receives an error.
+func (client AvailabilitySetsClient) GetSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetResponder handles the response to the Get request. The method always
+// closes the http.Response Body.
+func (client AvailabilitySetsClient) GetResponder(resp *http.Response) (result AvailabilitySet, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// List lists all availability sets in a resource group.
+//
+// resourceGroupName is the name of the resource group.
+func (client AvailabilitySetsClient) List(ctx context.Context, resourceGroupName string) (result AvailabilitySetListResult, err error) {
+ req, err := client.ListPreparer(ctx, resourceGroupName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListPreparer prepares the List request.
+func (client AvailabilitySetsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSender sends the List request. The method will close the
+// http.Response Body if it receives an error.
+func (client AvailabilitySetsClient) ListSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListResponder handles the response to the List request. The method always
+// closes the http.Response Body.
+func (client AvailabilitySetsClient) ListResponder(resp *http.Response) (result AvailabilitySetListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// ListAvailableSizes lists all available virtual machine sizes that can be used to create a new virtual machine in an
+// existing availability set.
+//
+// resourceGroupName is the name of the resource group. availabilitySetName is the name of the availability set.
+func (client AvailabilitySetsClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, availabilitySetName string) (result VirtualMachineSizeListResult, err error) {
+ req, err := client.ListAvailableSizesPreparer(ctx, resourceGroupName, availabilitySetName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListAvailableSizesSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.ListAvailableSizesResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListAvailableSizesPreparer prepares the ListAvailableSizes request.
+func (client AvailabilitySetsClient) ListAvailableSizesPreparer(ctx context.Context, resourceGroupName string, availabilitySetName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "availabilitySetName": autorest.Encode("path", availabilitySetName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the
+// http.Response Body if it receives an error.
+func (client AvailabilitySetsClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always
+// closes the http.Response Body.
+func (client AvailabilitySetsClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/client.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/client.go
new file mode 100644
index 000000000000..a06c86a83313
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/client.go
@@ -0,0 +1,51 @@
+// Package compute implements the Azure ARM Compute service API version 2016-04-30-preview.
+//
+// Compute Client
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "github.com/Azure/go-autorest/autorest"
+)
+
+const (
+ // DefaultBaseURI is the default URI used for the service Compute
+ DefaultBaseURI = "https://management.azure.com"
+)
+
+// BaseClient is the base client for Compute.
+type BaseClient struct {
+ autorest.Client
+ BaseURI string
+ SubscriptionID string
+}
+
+// New creates an instance of the BaseClient client.
+func New(subscriptionID string) BaseClient {
+ return NewWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewWithBaseURI creates an instance of the BaseClient client.
+func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
+ return BaseClient{
+ Client: autorest.NewClientWithUserAgent(UserAgent()),
+ BaseURI: baseURI,
+ SubscriptionID: subscriptionID,
+ }
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/disks.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/disks.go
new file mode 100644
index 000000000000..caca36c0c29d
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/disks.go
@@ -0,0 +1,678 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "github.com/Azure/go-autorest/autorest/validation"
+ "net/http"
+)
+
+// DisksClient is the compute Client
+type DisksClient struct {
+ BaseClient
+}
+
+// NewDisksClient creates an instance of the DisksClient client.
+func NewDisksClient(subscriptionID string) DisksClient {
+ return NewDisksClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewDisksClientWithBaseURI creates an instance of the DisksClient client.
+func NewDisksClientWithBaseURI(baseURI string, subscriptionID string) DisksClient {
+ return DisksClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// CreateOrUpdate creates or updates a disk.
+//
+// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
+// created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
+// 0-9 and _. The maximum name length is 80 characters. disk is disk object supplied in the body of the Put disk
+// operation.
+func (client DisksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk) (result DisksCreateOrUpdateFuture, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: disk,
+ Constraints: []validation.Constraint{{Target: "disk.DiskProperties", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData", Name: validation.Null, Rule: true,
+ Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData.ImageReference", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "disk.DiskProperties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}},
+ }},
+ {Target: "disk.DiskProperties.EncryptionSettings", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "disk.DiskProperties.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "disk.DiskProperties.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
+ {Target: "disk.DiskProperties.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil},
+ }},
+ {Target: "disk.DiskProperties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "disk.DiskProperties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
+ {Target: "disk.DiskProperties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil},
+ }},
+ }},
+ }}}}}); err != nil {
+ return result, validation.NewError("compute.DisksClient", "CreateOrUpdate", err.Error())
+ }
+
+ req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, diskName, disk)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "CreateOrUpdate", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.CreateOrUpdateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "CreateOrUpdate", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
+func (client DisksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, diskName string, disk Disk) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "diskName": autorest.Encode("path", diskName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPut(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
+ autorest.WithJSON(disk),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
+// http.Response Body if it receives an error.
+func (client DisksClient) CreateOrUpdateSender(req *http.Request) (future DisksCreateOrUpdateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
+// closes the http.Response Body.
+func (client DisksClient) CreateOrUpdateResponder(resp *http.Response) (result Disk, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Delete deletes a disk.
+//
+// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
+// created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
+// 0-9 and _. The maximum name length is 80 characters.
+func (client DisksClient) Delete(ctx context.Context, resourceGroupName string, diskName string) (result DisksDeleteFuture, err error) {
+ req, err := client.DeletePreparer(ctx, resourceGroupName, diskName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "Delete", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeleteSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "Delete", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeletePreparer prepares the Delete request.
+func (client DisksClient) DeletePreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "diskName": autorest.Encode("path", diskName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsDelete(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeleteSender sends the Delete request. The method will close the
+// http.Response Body if it receives an error.
+func (client DisksClient) DeleteSender(req *http.Request) (future DisksDeleteFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
+ return
+}
+
+// DeleteResponder handles the response to the Delete request. The method always
+// closes the http.Response Body.
+func (client DisksClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Get gets information about a disk.
+//
+// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
+// created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
+// 0-9 and _. The maximum name length is 80 characters.
+func (client DisksClient) Get(ctx context.Context, resourceGroupName string, diskName string) (result Disk, err error) {
+ req, err := client.GetPreparer(ctx, resourceGroupName, diskName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "Get", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetPreparer prepares the Get request.
+func (client DisksClient) GetPreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "diskName": autorest.Encode("path", diskName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetSender sends the Get request. The method will close the
+// http.Response Body if it receives an error.
+func (client DisksClient) GetSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetResponder handles the response to the Get request. The method always
+// closes the http.Response Body.
+func (client DisksClient) GetResponder(resp *http.Response) (result Disk, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// GrantAccess grants access to a disk.
+//
+// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
+// created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
+// 0-9 and _. The maximum name length is 80 characters. grantAccessData is access data object supplied in the body
+// of the get disk access operation.
+func (client DisksClient) GrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (result DisksGrantAccessFuture, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: grantAccessData,
+ Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
+ return result, validation.NewError("compute.DisksClient", "GrantAccess", err.Error())
+ }
+
+ req, err := client.GrantAccessPreparer(ctx, resourceGroupName, diskName, grantAccessData)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "GrantAccess", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.GrantAccessSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "GrantAccess", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// GrantAccessPreparer prepares the GrantAccess request.
+func (client DisksClient) GrantAccessPreparer(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "diskName": autorest.Encode("path", diskName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", pathParameters),
+ autorest.WithJSON(grantAccessData),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GrantAccessSender sends the GrantAccess request. The method will close the
+// http.Response Body if it receives an error.
+func (client DisksClient) GrantAccessSender(req *http.Request) (future DisksGrantAccessFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// GrantAccessResponder handles the response to the GrantAccess request. The method always
+// closes the http.Response Body.
+func (client DisksClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// List lists all the disks under a subscription.
+func (client DisksClient) List(ctx context.Context) (result DiskListPage, err error) {
+ result.fn = client.listNextResults
+ req, err := client.ListPreparer(ctx)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.dl.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", resp, "Failure sending request")
+ return
+ }
+
+ result.dl, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "List", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListPreparer prepares the List request.
+func (client DisksClient) ListPreparer(ctx context.Context) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSender sends the List request. The method will close the
+// http.Response Body if it receives an error.
+func (client DisksClient) ListSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListResponder handles the response to the List request. The method always
+// closes the http.Response Body.
+func (client DisksClient) ListResponder(resp *http.Response) (result DiskList, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listNextResults retrieves the next set of results, if any.
+func (client DisksClient) listNextResults(lastResults DiskList) (result DiskList, err error) {
+ req, err := lastResults.diskListPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "listNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListComplete enumerates all values, automatically crossing page boundaries as required.
+func (client DisksClient) ListComplete(ctx context.Context) (result DiskListIterator, err error) {
+ result.page, err = client.List(ctx)
+ return
+}
+
+// ListByResourceGroup lists all the disks under a resource group.
+//
+// resourceGroupName is the name of the resource group.
+func (client DisksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DiskListPage, err error) {
+ result.fn = client.listByResourceGroupNextResults
+ req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListByResourceGroupSender(req)
+ if err != nil {
+ result.dl.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", resp, "Failure sending request")
+ return
+ }
+
+ result.dl, err = client.ListByResourceGroupResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "ListByResourceGroup", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
+func (client DisksClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
+// http.Response Body if it receives an error.
+func (client DisksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
+// closes the http.Response Body.
+func (client DisksClient) ListByResourceGroupResponder(resp *http.Response) (result DiskList, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listByResourceGroupNextResults retrieves the next set of results, if any.
+func (client DisksClient) listByResourceGroupNextResults(lastResults DiskList) (result DiskList, err error) {
+ req, err := lastResults.diskListPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListByResourceGroupSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListByResourceGroupResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
+func (client DisksClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DiskListIterator, err error) {
+ result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
+ return
+}
+
+// RevokeAccess revokes access to a disk.
+//
+// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
+// created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
+// 0-9 and _. The maximum name length is 80 characters.
+func (client DisksClient) RevokeAccess(ctx context.Context, resourceGroupName string, diskName string) (result DisksRevokeAccessFuture, err error) {
+ req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, diskName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "RevokeAccess", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.RevokeAccessSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "RevokeAccess", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// RevokeAccessPreparer prepares the RevokeAccess request.
+func (client DisksClient) RevokeAccessPreparer(ctx context.Context, resourceGroupName string, diskName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "diskName": autorest.Encode("path", diskName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// RevokeAccessSender sends the RevokeAccess request. The method will close the
+// http.Response Body if it receives an error.
+func (client DisksClient) RevokeAccessSender(req *http.Request) (future DisksRevokeAccessFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// RevokeAccessResponder handles the response to the RevokeAccess request. The method always
+// closes the http.Response Body.
+func (client DisksClient) RevokeAccessResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Update updates (patches) a disk.
+//
+// resourceGroupName is the name of the resource group. diskName is the name of the managed disk that is being
+// created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z,
+// 0-9 and _. The maximum name length is 80 characters. disk is disk object supplied in the body of the Patch disk
+// operation.
+func (client DisksClient) Update(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate) (result DisksUpdateFuture, err error) {
+ req, err := client.UpdatePreparer(ctx, resourceGroupName, diskName, disk)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "Update", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.UpdateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksClient", "Update", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// UpdatePreparer prepares the Update request.
+func (client DisksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "diskName": autorest.Encode("path", diskName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPatch(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", pathParameters),
+ autorest.WithJSON(disk),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// UpdateSender sends the Update request. The method will close the
+// http.Response Body if it receives an error.
+func (client DisksClient) UpdateSender(req *http.Request) (future DisksUpdateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// UpdateResponder handles the response to the Update request. The method always
+// closes the http.Response Body.
+func (client DisksClient) UpdateResponder(resp *http.Response) (result Disk, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/images.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/images.go
new file mode 100644
index 000000000000..6e949be03ccb
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/images.go
@@ -0,0 +1,443 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "github.com/Azure/go-autorest/autorest/validation"
+ "net/http"
+)
+
+// ImagesClient is the compute Client
+type ImagesClient struct {
+ BaseClient
+}
+
+// NewImagesClient creates an instance of the ImagesClient client.
+func NewImagesClient(subscriptionID string) ImagesClient {
+ return NewImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewImagesClientWithBaseURI creates an instance of the ImagesClient client.
+func NewImagesClientWithBaseURI(baseURI string, subscriptionID string) ImagesClient {
+ return ImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// CreateOrUpdate create or update an image.
+//
+// resourceGroupName is the name of the resource group. imageName is the name of the image. parameters is
+// parameters supplied to the Create Image operation.
+func (client ImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (result ImagesCreateOrUpdateFuture, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: parameters,
+ Constraints: []validation.Constraint{{Target: "parameters.ImageProperties", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "parameters.ImageProperties.StorageProfile", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "parameters.ImageProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: true, Chain: nil}}},
+ }}}}}); err != nil {
+ return result, validation.NewError("compute.ImagesClient", "CreateOrUpdate", err.Error())
+ }
+
+ req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, imageName, parameters)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.CreateOrUpdateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
+func (client ImagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, imageName string, parameters Image) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "imageName": autorest.Encode("path", imageName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPut(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
+ autorest.WithJSON(parameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
+// http.Response Body if it receives an error.
+func (client ImagesClient) CreateOrUpdateSender(req *http.Request) (future ImagesCreateOrUpdateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
+ return
+}
+
+// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
+// closes the http.Response Body.
+func (client ImagesClient) CreateOrUpdateResponder(resp *http.Response) (result Image, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Delete deletes an Image.
+//
+// resourceGroupName is the name of the resource group. imageName is the name of the image.
+func (client ImagesClient) Delete(ctx context.Context, resourceGroupName string, imageName string) (result ImagesDeleteFuture, err error) {
+ req, err := client.DeletePreparer(ctx, resourceGroupName, imageName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeleteSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Delete", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeletePreparer prepares the Delete request.
+func (client ImagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, imageName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "imageName": autorest.Encode("path", imageName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsDelete(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeleteSender sends the Delete request. The method will close the
+// http.Response Body if it receives an error.
+func (client ImagesClient) DeleteSender(req *http.Request) (future ImagesDeleteFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
+ return
+}
+
+// DeleteResponder handles the response to the Delete request. The method always
+// closes the http.Response Body.
+func (client ImagesClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Get gets an image.
+//
+// resourceGroupName is the name of the resource group. imageName is the name of the image. expand is the expand
+// expression to apply on the operation.
+func (client ImagesClient) Get(ctx context.Context, resourceGroupName string, imageName string, expand string) (result Image, err error) {
+ req, err := client.GetPreparer(ctx, resourceGroupName, imageName, expand)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "Get", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetPreparer prepares the Get request.
+func (client ImagesClient) GetPreparer(ctx context.Context, resourceGroupName string, imageName string, expand string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "imageName": autorest.Encode("path", imageName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+ if len(expand) > 0 {
+ queryParameters["$expand"] = autorest.Encode("query", expand)
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetSender sends the Get request. The method will close the
+// http.Response Body if it receives an error.
+func (client ImagesClient) GetSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetResponder handles the response to the Get request. The method always
+// closes the http.Response Body.
+func (client ImagesClient) GetResponder(resp *http.Response) (result Image, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// List gets the list of Images in the subscription. Use nextLink property in the response to get the next page of
+// Images. Do this till nextLink is null to fetch all the Images.
+func (client ImagesClient) List(ctx context.Context) (result ImageListResultPage, err error) {
+ result.fn = client.listNextResults
+ req, err := client.ListPreparer(ctx)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.ilr.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure sending request")
+ return
+ }
+
+ result.ilr, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "List", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListPreparer prepares the List request.
+func (client ImagesClient) ListPreparer(ctx context.Context) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSender sends the List request. The method will close the
+// http.Response Body if it receives an error.
+func (client ImagesClient) ListSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListResponder handles the response to the List request. The method always
+// closes the http.Response Body.
+func (client ImagesClient) ListResponder(resp *http.Response) (result ImageListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listNextResults retrieves the next set of results, if any.
+func (client ImagesClient) listNextResults(lastResults ImageListResult) (result ImageListResult, err error) {
+ req, err := lastResults.imageListResultPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "listNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListComplete enumerates all values, automatically crossing page boundaries as required.
+func (client ImagesClient) ListComplete(ctx context.Context) (result ImageListResultIterator, err error) {
+ result.page, err = client.List(ctx)
+ return
+}
+
+// ListByResourceGroup gets the list of images under a resource group.
+//
+// resourceGroupName is the name of the resource group.
+func (client ImagesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ImageListResultPage, err error) {
+ result.fn = client.listByResourceGroupNextResults
+ req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListByResourceGroupSender(req)
+ if err != nil {
+ result.ilr.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure sending request")
+ return
+ }
+
+ result.ilr, err = client.ListByResourceGroupResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "ListByResourceGroup", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
+func (client ImagesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
+// http.Response Body if it receives an error.
+func (client ImagesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
+// closes the http.Response Body.
+func (client ImagesClient) ListByResourceGroupResponder(resp *http.Response) (result ImageListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listByResourceGroupNextResults retrieves the next set of results, if any.
+func (client ImagesClient) listByResourceGroupNextResults(lastResults ImageListResult) (result ImageListResult, err error) {
+ req, err := lastResults.imageListResultPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListByResourceGroupSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListByResourceGroupResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
+func (client ImagesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ImageListResultIterator, err error) {
+ result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
+ return
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/models.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/models.go
new file mode 100644
index 000000000000..d89551fb39f0
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/models.go
@@ -0,0 +1,6284 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "encoding/json"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "github.com/Azure/go-autorest/autorest/date"
+ "github.com/Azure/go-autorest/autorest/to"
+ "net/http"
+)
+
+// AccessLevel enumerates the values for access level.
+type AccessLevel string
+
+const (
+ // None ...
+ None AccessLevel = "None"
+ // Read ...
+ Read AccessLevel = "Read"
+)
+
+// PossibleAccessLevelValues returns an array of possible values for the AccessLevel const type.
+func PossibleAccessLevelValues() []AccessLevel {
+ return []AccessLevel{None, Read}
+}
+
+// CachingTypes enumerates the values for caching types.
+type CachingTypes string
+
+const (
+ // CachingTypesNone ...
+ CachingTypesNone CachingTypes = "None"
+ // CachingTypesReadOnly ...
+ CachingTypesReadOnly CachingTypes = "ReadOnly"
+ // CachingTypesReadWrite ...
+ CachingTypesReadWrite CachingTypes = "ReadWrite"
+)
+
+// PossibleCachingTypesValues returns an array of possible values for the CachingTypes const type.
+func PossibleCachingTypesValues() []CachingTypes {
+ return []CachingTypes{CachingTypesNone, CachingTypesReadOnly, CachingTypesReadWrite}
+}
+
+// ComponentNames enumerates the values for component names.
+type ComponentNames string
+
+const (
+ // MicrosoftWindowsShellSetup ...
+ MicrosoftWindowsShellSetup ComponentNames = "Microsoft-Windows-Shell-Setup"
+)
+
+// PossibleComponentNamesValues returns an array of possible values for the ComponentNames const type.
+func PossibleComponentNamesValues() []ComponentNames {
+ return []ComponentNames{MicrosoftWindowsShellSetup}
+}
+
+// DiskCreateOption enumerates the values for disk create option.
+type DiskCreateOption string
+
+const (
+ // Attach ...
+ Attach DiskCreateOption = "Attach"
+ // Copy ...
+ Copy DiskCreateOption = "Copy"
+ // Empty ...
+ Empty DiskCreateOption = "Empty"
+ // FromImage ...
+ FromImage DiskCreateOption = "FromImage"
+ // Import ...
+ Import DiskCreateOption = "Import"
+ // Restore ...
+ Restore DiskCreateOption = "Restore"
+)
+
+// PossibleDiskCreateOptionValues returns an array of possible values for the DiskCreateOption const type.
+func PossibleDiskCreateOptionValues() []DiskCreateOption {
+ return []DiskCreateOption{Attach, Copy, Empty, FromImage, Import, Restore}
+}
+
+// DiskCreateOptionTypes enumerates the values for disk create option types.
+type DiskCreateOptionTypes string
+
+const (
+ // DiskCreateOptionTypesAttach ...
+ DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach"
+ // DiskCreateOptionTypesEmpty ...
+ DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty"
+ // DiskCreateOptionTypesFromImage ...
+ DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage"
+)
+
+// PossibleDiskCreateOptionTypesValues returns an array of possible values for the DiskCreateOptionTypes const type.
+func PossibleDiskCreateOptionTypesValues() []DiskCreateOptionTypes {
+ return []DiskCreateOptionTypes{DiskCreateOptionTypesAttach, DiskCreateOptionTypesEmpty, DiskCreateOptionTypesFromImage}
+}
+
+// InstanceViewTypes enumerates the values for instance view types.
+type InstanceViewTypes string
+
+const (
+ // InstanceView ...
+ InstanceView InstanceViewTypes = "instanceView"
+)
+
+// PossibleInstanceViewTypesValues returns an array of possible values for the InstanceViewTypes const type.
+func PossibleInstanceViewTypesValues() []InstanceViewTypes {
+ return []InstanceViewTypes{InstanceView}
+}
+
+// OperatingSystemStateTypes enumerates the values for operating system state types.
+type OperatingSystemStateTypes string
+
+const (
+ // Generalized ...
+ Generalized OperatingSystemStateTypes = "Generalized"
+ // Specialized ...
+ Specialized OperatingSystemStateTypes = "Specialized"
+)
+
+// PossibleOperatingSystemStateTypesValues returns an array of possible values for the OperatingSystemStateTypes const type.
+func PossibleOperatingSystemStateTypesValues() []OperatingSystemStateTypes {
+ return []OperatingSystemStateTypes{Generalized, Specialized}
+}
+
+// OperatingSystemTypes enumerates the values for operating system types.
+type OperatingSystemTypes string
+
+const (
+ // Linux ...
+ Linux OperatingSystemTypes = "Linux"
+ // Windows ...
+ Windows OperatingSystemTypes = "Windows"
+)
+
+// PossibleOperatingSystemTypesValues returns an array of possible values for the OperatingSystemTypes const type.
+func PossibleOperatingSystemTypesValues() []OperatingSystemTypes {
+ return []OperatingSystemTypes{Linux, Windows}
+}
+
+// PassNames enumerates the values for pass names.
+type PassNames string
+
+const (
+ // OobeSystem ...
+ OobeSystem PassNames = "OobeSystem"
+)
+
+// PossiblePassNamesValues returns an array of possible values for the PassNames const type.
+func PossiblePassNamesValues() []PassNames {
+ return []PassNames{OobeSystem}
+}
+
+// ProtocolTypes enumerates the values for protocol types.
+type ProtocolTypes string
+
+const (
+ // HTTP ...
+ HTTP ProtocolTypes = "Http"
+ // HTTPS ...
+ HTTPS ProtocolTypes = "Https"
+)
+
+// PossibleProtocolTypesValues returns an array of possible values for the ProtocolTypes const type.
+func PossibleProtocolTypesValues() []ProtocolTypes {
+ return []ProtocolTypes{HTTP, HTTPS}
+}
+
+// ResourceIdentityType enumerates the values for resource identity type.
+type ResourceIdentityType string
+
+const (
+ // SystemAssigned ...
+ SystemAssigned ResourceIdentityType = "SystemAssigned"
+)
+
+// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type.
+func PossibleResourceIdentityTypeValues() []ResourceIdentityType {
+ return []ResourceIdentityType{SystemAssigned}
+}
+
+// SettingNames enumerates the values for setting names.
+type SettingNames string
+
+const (
+ // AutoLogon ...
+ AutoLogon SettingNames = "AutoLogon"
+ // FirstLogonCommands ...
+ FirstLogonCommands SettingNames = "FirstLogonCommands"
+)
+
+// PossibleSettingNamesValues returns an array of possible values for the SettingNames const type.
+func PossibleSettingNamesValues() []SettingNames {
+ return []SettingNames{AutoLogon, FirstLogonCommands}
+}
+
+// StatusLevelTypes enumerates the values for status level types.
+type StatusLevelTypes string
+
+const (
+ // Error ...
+ Error StatusLevelTypes = "Error"
+ // Info ...
+ Info StatusLevelTypes = "Info"
+ // Warning ...
+ Warning StatusLevelTypes = "Warning"
+)
+
+// PossibleStatusLevelTypesValues returns an array of possible values for the StatusLevelTypes const type.
+func PossibleStatusLevelTypesValues() []StatusLevelTypes {
+ return []StatusLevelTypes{Error, Info, Warning}
+}
+
+// StorageAccountTypes enumerates the values for storage account types.
+type StorageAccountTypes string
+
+const (
+ // PremiumLRS ...
+ PremiumLRS StorageAccountTypes = "Premium_LRS"
+ // StandardLRS ...
+ StandardLRS StorageAccountTypes = "Standard_LRS"
+)
+
+// PossibleStorageAccountTypesValues returns an array of possible values for the StorageAccountTypes const type.
+func PossibleStorageAccountTypesValues() []StorageAccountTypes {
+ return []StorageAccountTypes{PremiumLRS, StandardLRS}
+}
+
+// UpgradeMode enumerates the values for upgrade mode.
+type UpgradeMode string
+
+const (
+ // Automatic ...
+ Automatic UpgradeMode = "Automatic"
+ // Manual ...
+ Manual UpgradeMode = "Manual"
+)
+
+// PossibleUpgradeModeValues returns an array of possible values for the UpgradeMode const type.
+func PossibleUpgradeModeValues() []UpgradeMode {
+ return []UpgradeMode{Automatic, Manual}
+}
+
+// VirtualMachineScaleSetSkuScaleType enumerates the values for virtual machine scale set sku scale type.
+type VirtualMachineScaleSetSkuScaleType string
+
+const (
+ // VirtualMachineScaleSetSkuScaleTypeAutomatic ...
+ VirtualMachineScaleSetSkuScaleTypeAutomatic VirtualMachineScaleSetSkuScaleType = "Automatic"
+ // VirtualMachineScaleSetSkuScaleTypeNone ...
+ VirtualMachineScaleSetSkuScaleTypeNone VirtualMachineScaleSetSkuScaleType = "None"
+)
+
+// PossibleVirtualMachineScaleSetSkuScaleTypeValues returns an array of possible values for the VirtualMachineScaleSetSkuScaleType const type.
+func PossibleVirtualMachineScaleSetSkuScaleTypeValues() []VirtualMachineScaleSetSkuScaleType {
+ return []VirtualMachineScaleSetSkuScaleType{VirtualMachineScaleSetSkuScaleTypeAutomatic, VirtualMachineScaleSetSkuScaleTypeNone}
+}
+
+// VirtualMachineSizeTypes enumerates the values for virtual machine size types.
+type VirtualMachineSizeTypes string
+
+const (
+ // BasicA0 ...
+ BasicA0 VirtualMachineSizeTypes = "Basic_A0"
+ // BasicA1 ...
+ BasicA1 VirtualMachineSizeTypes = "Basic_A1"
+ // BasicA2 ...
+ BasicA2 VirtualMachineSizeTypes = "Basic_A2"
+ // BasicA3 ...
+ BasicA3 VirtualMachineSizeTypes = "Basic_A3"
+ // BasicA4 ...
+ BasicA4 VirtualMachineSizeTypes = "Basic_A4"
+ // StandardA0 ...
+ StandardA0 VirtualMachineSizeTypes = "Standard_A0"
+ // StandardA1 ...
+ StandardA1 VirtualMachineSizeTypes = "Standard_A1"
+ // StandardA10 ...
+ StandardA10 VirtualMachineSizeTypes = "Standard_A10"
+ // StandardA11 ...
+ StandardA11 VirtualMachineSizeTypes = "Standard_A11"
+ // StandardA2 ...
+ StandardA2 VirtualMachineSizeTypes = "Standard_A2"
+ // StandardA3 ...
+ StandardA3 VirtualMachineSizeTypes = "Standard_A3"
+ // StandardA4 ...
+ StandardA4 VirtualMachineSizeTypes = "Standard_A4"
+ // StandardA5 ...
+ StandardA5 VirtualMachineSizeTypes = "Standard_A5"
+ // StandardA6 ...
+ StandardA6 VirtualMachineSizeTypes = "Standard_A6"
+ // StandardA7 ...
+ StandardA7 VirtualMachineSizeTypes = "Standard_A7"
+ // StandardA8 ...
+ StandardA8 VirtualMachineSizeTypes = "Standard_A8"
+ // StandardA9 ...
+ StandardA9 VirtualMachineSizeTypes = "Standard_A9"
+ // StandardD1 ...
+ StandardD1 VirtualMachineSizeTypes = "Standard_D1"
+ // StandardD11 ...
+ StandardD11 VirtualMachineSizeTypes = "Standard_D11"
+ // StandardD11V2 ...
+ StandardD11V2 VirtualMachineSizeTypes = "Standard_D11_v2"
+ // StandardD12 ...
+ StandardD12 VirtualMachineSizeTypes = "Standard_D12"
+ // StandardD12V2 ...
+ StandardD12V2 VirtualMachineSizeTypes = "Standard_D12_v2"
+ // StandardD13 ...
+ StandardD13 VirtualMachineSizeTypes = "Standard_D13"
+ // StandardD13V2 ...
+ StandardD13V2 VirtualMachineSizeTypes = "Standard_D13_v2"
+ // StandardD14 ...
+ StandardD14 VirtualMachineSizeTypes = "Standard_D14"
+ // StandardD14V2 ...
+ StandardD14V2 VirtualMachineSizeTypes = "Standard_D14_v2"
+ // StandardD15V2 ...
+ StandardD15V2 VirtualMachineSizeTypes = "Standard_D15_v2"
+ // StandardD1V2 ...
+ StandardD1V2 VirtualMachineSizeTypes = "Standard_D1_v2"
+ // StandardD2 ...
+ StandardD2 VirtualMachineSizeTypes = "Standard_D2"
+ // StandardD2V2 ...
+ StandardD2V2 VirtualMachineSizeTypes = "Standard_D2_v2"
+ // StandardD3 ...
+ StandardD3 VirtualMachineSizeTypes = "Standard_D3"
+ // StandardD3V2 ...
+ StandardD3V2 VirtualMachineSizeTypes = "Standard_D3_v2"
+ // StandardD4 ...
+ StandardD4 VirtualMachineSizeTypes = "Standard_D4"
+ // StandardD4V2 ...
+ StandardD4V2 VirtualMachineSizeTypes = "Standard_D4_v2"
+ // StandardD5V2 ...
+ StandardD5V2 VirtualMachineSizeTypes = "Standard_D5_v2"
+ // StandardDS1 ...
+ StandardDS1 VirtualMachineSizeTypes = "Standard_DS1"
+ // StandardDS11 ...
+ StandardDS11 VirtualMachineSizeTypes = "Standard_DS11"
+ // StandardDS11V2 ...
+ StandardDS11V2 VirtualMachineSizeTypes = "Standard_DS11_v2"
+ // StandardDS12 ...
+ StandardDS12 VirtualMachineSizeTypes = "Standard_DS12"
+ // StandardDS12V2 ...
+ StandardDS12V2 VirtualMachineSizeTypes = "Standard_DS12_v2"
+ // StandardDS13 ...
+ StandardDS13 VirtualMachineSizeTypes = "Standard_DS13"
+ // StandardDS13V2 ...
+ StandardDS13V2 VirtualMachineSizeTypes = "Standard_DS13_v2"
+ // StandardDS14 ...
+ StandardDS14 VirtualMachineSizeTypes = "Standard_DS14"
+ // StandardDS14V2 ...
+ StandardDS14V2 VirtualMachineSizeTypes = "Standard_DS14_v2"
+ // StandardDS15V2 ...
+ StandardDS15V2 VirtualMachineSizeTypes = "Standard_DS15_v2"
+ // StandardDS1V2 ...
+ StandardDS1V2 VirtualMachineSizeTypes = "Standard_DS1_v2"
+ // StandardDS2 ...
+ StandardDS2 VirtualMachineSizeTypes = "Standard_DS2"
+ // StandardDS2V2 ...
+ StandardDS2V2 VirtualMachineSizeTypes = "Standard_DS2_v2"
+ // StandardDS3 ...
+ StandardDS3 VirtualMachineSizeTypes = "Standard_DS3"
+ // StandardDS3V2 ...
+ StandardDS3V2 VirtualMachineSizeTypes = "Standard_DS3_v2"
+ // StandardDS4 ...
+ StandardDS4 VirtualMachineSizeTypes = "Standard_DS4"
+ // StandardDS4V2 ...
+ StandardDS4V2 VirtualMachineSizeTypes = "Standard_DS4_v2"
+ // StandardDS5V2 ...
+ StandardDS5V2 VirtualMachineSizeTypes = "Standard_DS5_v2"
+ // StandardG1 ...
+ StandardG1 VirtualMachineSizeTypes = "Standard_G1"
+ // StandardG2 ...
+ StandardG2 VirtualMachineSizeTypes = "Standard_G2"
+ // StandardG3 ...
+ StandardG3 VirtualMachineSizeTypes = "Standard_G3"
+ // StandardG4 ...
+ StandardG4 VirtualMachineSizeTypes = "Standard_G4"
+ // StandardG5 ...
+ StandardG5 VirtualMachineSizeTypes = "Standard_G5"
+ // StandardGS1 ...
+ StandardGS1 VirtualMachineSizeTypes = "Standard_GS1"
+ // StandardGS2 ...
+ StandardGS2 VirtualMachineSizeTypes = "Standard_GS2"
+ // StandardGS3 ...
+ StandardGS3 VirtualMachineSizeTypes = "Standard_GS3"
+ // StandardGS4 ...
+ StandardGS4 VirtualMachineSizeTypes = "Standard_GS4"
+ // StandardGS5 ...
+ StandardGS5 VirtualMachineSizeTypes = "Standard_GS5"
+)
+
+// PossibleVirtualMachineSizeTypesValues returns an array of possible values for the VirtualMachineSizeTypes const type.
+func PossibleVirtualMachineSizeTypesValues() []VirtualMachineSizeTypes {
+ return []VirtualMachineSizeTypes{BasicA0, BasicA1, BasicA2, BasicA3, BasicA4, StandardA0, StandardA1, StandardA10, StandardA11, StandardA2, StandardA3, StandardA4, StandardA5, StandardA6, StandardA7, StandardA8, StandardA9, StandardD1, StandardD11, StandardD11V2, StandardD12, StandardD12V2, StandardD13, StandardD13V2, StandardD14, StandardD14V2, StandardD15V2, StandardD1V2, StandardD2, StandardD2V2, StandardD3, StandardD3V2, StandardD4, StandardD4V2, StandardD5V2, StandardDS1, StandardDS11, StandardDS11V2, StandardDS12, StandardDS12V2, StandardDS13, StandardDS13V2, StandardDS14, StandardDS14V2, StandardDS15V2, StandardDS1V2, StandardDS2, StandardDS2V2, StandardDS3, StandardDS3V2, StandardDS4, StandardDS4V2, StandardDS5V2, StandardG1, StandardG2, StandardG3, StandardG4, StandardG5, StandardGS1, StandardGS2, StandardGS3, StandardGS4, StandardGS5}
+}
+
+// AccessURI a disk access SAS uri.
+type AccessURI struct {
+ autorest.Response `json:"-"`
+ // AccessURIOutput - Operation output data (raw JSON)
+ *AccessURIOutput `json:"properties,omitempty"`
+}
+
+// MarshalJSON is the custom marshaler for AccessURI.
+func (au AccessURI) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if au.AccessURIOutput != nil {
+ objectMap["properties"] = au.AccessURIOutput
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for AccessURI struct.
+func (au *AccessURI) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var accessURIOutput AccessURIOutput
+ err = json.Unmarshal(*v, &accessURIOutput)
+ if err != nil {
+ return err
+ }
+ au.AccessURIOutput = &accessURIOutput
+ }
+ }
+ }
+
+ return nil
+}
+
+// AccessURIOutput azure properties, including output.
+type AccessURIOutput struct {
+ // AccessURIRaw - Operation output data (raw JSON)
+ *AccessURIRaw `json:"output,omitempty"`
+}
+
+// MarshalJSON is the custom marshaler for AccessURIOutput.
+func (auo AccessURIOutput) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if auo.AccessURIRaw != nil {
+ objectMap["output"] = auo.AccessURIRaw
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for AccessURIOutput struct.
+func (auo *AccessURIOutput) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "output":
+ if v != nil {
+ var accessURIRaw AccessURIRaw
+ err = json.Unmarshal(*v, &accessURIRaw)
+ if err != nil {
+ return err
+ }
+ auo.AccessURIRaw = &accessURIRaw
+ }
+ }
+ }
+
+ return nil
+}
+
+// AccessURIRaw this object gets 'bubbled up' through flattening.
+type AccessURIRaw struct {
+ // AccessSAS - A SAS uri for accessing a disk.
+ AccessSAS *string `json:"accessSAS,omitempty"`
+}
+
+// AdditionalUnattendContent specifies additional XML formatted information that can be included in the
+// Unattend.xml file, which is used by Windows Setup. Contents are defined by setting name, component name, and the
+// pass in which the content is applied.
+type AdditionalUnattendContent struct {
+ // PassName - The pass name. Currently, the only allowable value is OobeSystem. Possible values include: 'OobeSystem'
+ PassName PassNames `json:"passName,omitempty"`
+ // ComponentName - The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. Possible values include: 'MicrosoftWindowsShellSetup'
+ ComponentName ComponentNames `json:"componentName,omitempty"`
+ // SettingName - Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. Possible values include: 'AutoLogon', 'FirstLogonCommands'
+ SettingName SettingNames `json:"settingName,omitempty"`
+ // Content - Specifies the XML formatted content that is added to the unattend.xml file for the specified path and component. The XML must be less than 4KB and must include the root element for the setting or feature that is being inserted.
+ Content *string `json:"content,omitempty"`
+}
+
+// APIEntityReference the API entity reference.
+type APIEntityReference struct {
+ // ID - The ARM resource id in the form of /subscriptions/{SubcriptionId}/resourceGroups/{ResourceGroupName}/...
+ ID *string `json:"id,omitempty"`
+}
+
+// APIError api error.
+type APIError struct {
+ // Details - The Api error details
+ Details *[]APIErrorBase `json:"details,omitempty"`
+ // Innererror - The Api inner error
+ Innererror *InnerError `json:"innererror,omitempty"`
+ // Code - The error code.
+ Code *string `json:"code,omitempty"`
+ // Target - The target of the particular error.
+ Target *string `json:"target,omitempty"`
+ // Message - The error message.
+ Message *string `json:"message,omitempty"`
+}
+
+// APIErrorBase api error base.
+type APIErrorBase struct {
+ // Code - The error code.
+ Code *string `json:"code,omitempty"`
+ // Target - The target of the particular error.
+ Target *string `json:"target,omitempty"`
+ // Message - The error message.
+ Message *string `json:"message,omitempty"`
+}
+
+// AvailabilitySet specifies information about the availability set that the virtual machine should be assigned to.
+// Virtual machines specified in the same availability set are allocated to different nodes to maximize
+// availability. For more information about availability sets, see [Manage the availability of virtual
+// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
+//
For more information on Azure planned maintainance, see [Planned maintenance for virtual machines in
+// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
+//
Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added
+// to an availability set.
+type AvailabilitySet struct {
+ autorest.Response `json:"-"`
+ *AvailabilitySetProperties `json:"properties,omitempty"`
+ // Sku - Sku of the availability set
+ Sku *Sku `json:"sku,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for AvailabilitySet.
+func (as AvailabilitySet) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if as.AvailabilitySetProperties != nil {
+ objectMap["properties"] = as.AvailabilitySetProperties
+ }
+ if as.Sku != nil {
+ objectMap["sku"] = as.Sku
+ }
+ if as.ID != nil {
+ objectMap["id"] = as.ID
+ }
+ if as.Name != nil {
+ objectMap["name"] = as.Name
+ }
+ if as.Type != nil {
+ objectMap["type"] = as.Type
+ }
+ if as.Location != nil {
+ objectMap["location"] = as.Location
+ }
+ if as.Tags != nil {
+ objectMap["tags"] = as.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for AvailabilitySet struct.
+func (as *AvailabilitySet) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var availabilitySetProperties AvailabilitySetProperties
+ err = json.Unmarshal(*v, &availabilitySetProperties)
+ if err != nil {
+ return err
+ }
+ as.AvailabilitySetProperties = &availabilitySetProperties
+ }
+ case "sku":
+ if v != nil {
+ var sku Sku
+ err = json.Unmarshal(*v, &sku)
+ if err != nil {
+ return err
+ }
+ as.Sku = &sku
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ as.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ as.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ as.Type = &typeVar
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ as.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ as.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// AvailabilitySetListResult the List Availability Set operation response.
+type AvailabilitySetListResult struct {
+ autorest.Response `json:"-"`
+ // Value - The list of availability sets
+ Value *[]AvailabilitySet `json:"value,omitempty"`
+}
+
+// AvailabilitySetProperties the instance view of a resource.
+type AvailabilitySetProperties struct {
+ // PlatformUpdateDomainCount - Update Domain count.
+ PlatformUpdateDomainCount *int32 `json:"platformUpdateDomainCount,omitempty"`
+ // PlatformFaultDomainCount - Fault Domain count.
+ PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"`
+ // VirtualMachines - A list of references to all virtual machines in the availability set.
+ VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"`
+ // Statuses - The resource status information.
+ Statuses *[]InstanceViewStatus `json:"statuses,omitempty"`
+ // Managed - If the availability set supports managed disks.
+ Managed *bool `json:"managed,omitempty"`
+}
+
+// BootDiagnostics boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot
+// to diagnose VM status.
For Linux Virtual Machines, you can easily view the output of your console log.
+//
For both Windows and Linux virtual machines, Azure also enables you to see a screenshot of the VM from
+// the hypervisor.
+type BootDiagnostics struct {
+ // Enabled - Whether boot diagnostics should be enabled on the Virtual Machine.
+ Enabled *bool `json:"enabled,omitempty"`
+ // StorageURI - Uri of the storage account to use for placing the console output and screenshot.
+ StorageURI *string `json:"storageUri,omitempty"`
+}
+
+// BootDiagnosticsInstanceView the instance view of a virtual machine boot diagnostics.
+type BootDiagnosticsInstanceView struct {
+ // ConsoleScreenshotBlobURI - The console screenshot blob URI.
+ ConsoleScreenshotBlobURI *string `json:"consoleScreenshotBlobUri,omitempty"`
+ // SerialConsoleLogBlobURI - The Linux serial console log blob Uri.
+ SerialConsoleLogBlobURI *string `json:"serialConsoleLogBlobUri,omitempty"`
+}
+
+// CreationData data used when creating a disk.
+type CreationData struct {
+ // CreateOption - This enumerates the possible sources of a disk's creation. Possible values include: 'Empty', 'Attach', 'FromImage', 'Import', 'Copy', 'Restore'
+ CreateOption DiskCreateOption `json:"createOption,omitempty"`
+ // StorageAccountID - If createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription
+ StorageAccountID *string `json:"storageAccountId,omitempty"`
+ // ImageReference - Disk source information.
+ ImageReference *ImageDiskReference `json:"imageReference,omitempty"`
+ // SourceURI - If createOption is Import, this is a SAS URI to a blob to be imported into a managed disk. If createOption is Copy, this is a relative Uri containing the id of the source snapshot to be copied into a managed disk.
+ SourceURI *string `json:"sourceUri,omitempty"`
+ // SourceResourceID - If createOption is Copy, this is the ARM id of the source snapshot or disk. If createOption is Restore, this is the ARM-like id of the source disk restore point.
+ SourceResourceID *string `json:"sourceResourceId,omitempty"`
+}
+
+// DataDisk describes a data disk.
+type DataDisk struct {
+ // Lun - Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.
+ Lun *int32 `json:"lun,omitempty"`
+ // Name - The disk name.
+ Name *string `json:"name,omitempty"`
+ // Vhd - The virtual hard disk.
+ Vhd *VirtualHardDisk `json:"vhd,omitempty"`
+ // Image - The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.
+ Image *VirtualHardDisk `json:"image,omitempty"`
+ // Caching - Specifies the caching requirements.
Possible values are:
**None**
**ReadOnly**
**ReadWrite**
Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite'
+ Caching CachingTypes `json:"caching,omitempty"`
+ // CreateOption - Specifies how the virtual machine should be created.
Possible values are:
**Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.
**FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach'
+ CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"`
+ // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.
This value cannot be larger than 1023 GB
+ DiskSizeGB *int32 `json:"diskSizeGB,omitempty"`
+ // ManagedDisk - The managed disk parameters.
+ ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"`
+}
+
+// DataDiskImage contains the data disk images information.
+type DataDiskImage struct {
+ // Lun - Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.
+ Lun *int32 `json:"lun,omitempty"`
+}
+
+// DiagnosticsProfile specifies the boot diagnostic settings state.
Minimum api-version: 2015-06-15.
+type DiagnosticsProfile struct {
+ // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status.
For Linux Virtual Machines, you can easily view the output of your console log.
For both Windows and Linux virtual machines, Azure also enables you to see a screenshot of the VM from the hypervisor.
+ BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"`
+}
+
+// Disk disk resource.
+type Disk struct {
+ autorest.Response `json:"-"`
+ *DiskProperties `json:"properties,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for Disk.
+func (d Disk) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if d.DiskProperties != nil {
+ objectMap["properties"] = d.DiskProperties
+ }
+ if d.ID != nil {
+ objectMap["id"] = d.ID
+ }
+ if d.Name != nil {
+ objectMap["name"] = d.Name
+ }
+ if d.Type != nil {
+ objectMap["type"] = d.Type
+ }
+ if d.Location != nil {
+ objectMap["location"] = d.Location
+ }
+ if d.Tags != nil {
+ objectMap["tags"] = d.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for Disk struct.
+func (d *Disk) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var diskProperties DiskProperties
+ err = json.Unmarshal(*v, &diskProperties)
+ if err != nil {
+ return err
+ }
+ d.DiskProperties = &diskProperties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ d.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ d.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ d.Type = &typeVar
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ d.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ d.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// DiskEncryptionSettings describes a Encryption Settings for a Disk
+type DiskEncryptionSettings struct {
+ // DiskEncryptionKey - Specifies the location of the disk encryption key, which is a Key Vault Secret.
+ DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"`
+ // KeyEncryptionKey - Specifies the location of the key encryption key in Key Vault.
+ KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"`
+ // Enabled - Specifies whether disk encryption should be enabled on the virtual machine.
+ Enabled *bool `json:"enabled,omitempty"`
+}
+
+// DiskInstanceView the instance view of the disk.
+type DiskInstanceView struct {
+ // Name - The disk name.
+ Name *string `json:"name,omitempty"`
+ // Statuses - The resource status information.
+ Statuses *[]InstanceViewStatus `json:"statuses,omitempty"`
+}
+
+// DiskList the List Disks operation response.
+type DiskList struct {
+ autorest.Response `json:"-"`
+ // Value - A list of disks.
+ Value *[]Disk `json:"value,omitempty"`
+ // NextLink - the uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks.
+ NextLink *string `json:"nextLink,omitempty"`
+}
+
+// DiskListIterator provides access to a complete listing of Disk values.
+type DiskListIterator struct {
+ i int
+ page DiskListPage
+}
+
+// Next advances to the next value. If there was an error making
+// the request the iterator does not advance and the error is returned.
+func (iter *DiskListIterator) Next() error {
+ iter.i++
+ if iter.i < len(iter.page.Values()) {
+ return nil
+ }
+ err := iter.page.Next()
+ if err != nil {
+ iter.i--
+ return err
+ }
+ iter.i = 0
+ return nil
+}
+
+// NotDone returns true if the enumeration should be started or is not yet complete.
+func (iter DiskListIterator) NotDone() bool {
+ return iter.page.NotDone() && iter.i < len(iter.page.Values())
+}
+
+// Response returns the raw server response from the last page request.
+func (iter DiskListIterator) Response() DiskList {
+ return iter.page.Response()
+}
+
+// Value returns the current value or a zero-initialized value if the
+// iterator has advanced beyond the end of the collection.
+func (iter DiskListIterator) Value() Disk {
+ if !iter.page.NotDone() {
+ return Disk{}
+ }
+ return iter.page.Values()[iter.i]
+}
+
+// IsEmpty returns true if the ListResult contains no values.
+func (dl DiskList) IsEmpty() bool {
+ return dl.Value == nil || len(*dl.Value) == 0
+}
+
+// diskListPreparer prepares a request to retrieve the next set of results.
+// It returns nil if no more results exist.
+func (dl DiskList) diskListPreparer() (*http.Request, error) {
+ if dl.NextLink == nil || len(to.String(dl.NextLink)) < 1 {
+ return nil, nil
+ }
+ return autorest.Prepare(&http.Request{},
+ autorest.AsJSON(),
+ autorest.AsGet(),
+ autorest.WithBaseURL(to.String(dl.NextLink)))
+}
+
+// DiskListPage contains a page of Disk values.
+type DiskListPage struct {
+ fn func(DiskList) (DiskList, error)
+ dl DiskList
+}
+
+// Next advances to the next page of values. If there was an error making
+// the request the page does not advance and the error is returned.
+func (page *DiskListPage) Next() error {
+ next, err := page.fn(page.dl)
+ if err != nil {
+ return err
+ }
+ page.dl = next
+ return nil
+}
+
+// NotDone returns true if the page enumeration should be started or is not yet complete.
+func (page DiskListPage) NotDone() bool {
+ return !page.dl.IsEmpty()
+}
+
+// Response returns the raw server response from the last page request.
+func (page DiskListPage) Response() DiskList {
+ return page.dl
+}
+
+// Values returns the slice of values for the current page or nil if there are no values.
+func (page DiskListPage) Values() []Disk {
+ if page.dl.IsEmpty() {
+ return nil
+ }
+ return *page.dl.Value
+}
+
+// DiskProperties disk resource properties.
+type DiskProperties struct {
+ // AccountType - the storage account type of the disk. Possible values include: 'StandardLRS', 'PremiumLRS'
+ AccountType StorageAccountTypes `json:"accountType,omitempty"`
+ // TimeCreated - The time when the disk was created.
+ TimeCreated *date.Time `json:"timeCreated,omitempty"`
+ // OsType - The Operating System type. Possible values include: 'Windows', 'Linux'
+ OsType OperatingSystemTypes `json:"osType,omitempty"`
+ // CreationData - Disk source information. CreationData information cannot be changed after the disk has been created.
+ CreationData *CreationData `json:"creationData,omitempty"`
+ // DiskSizeGB - If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
+ DiskSizeGB *int32 `json:"diskSizeGB,omitempty"`
+ // EncryptionSettings - Encryption settings for disk or snapshot
+ EncryptionSettings *EncryptionSettings `json:"encryptionSettings,omitempty"`
+ // OwnerID - A relative URI containing the VM id that has the disk attached.
+ OwnerID *string `json:"ownerId,omitempty"`
+ // ProvisioningState - The disk provisioning state.
+ ProvisioningState *string `json:"provisioningState,omitempty"`
+}
+
+// DisksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type DisksCreateOrUpdateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future DisksCreateOrUpdateFuture) Result(client DisksClient) (d Disk, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return d, azure.NewAsyncOpIncompleteError("compute.DisksCreateOrUpdateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ d, err = client.CreateOrUpdateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ d, err = client.CreateOrUpdateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// DisksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type DisksDeleteFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future DisksDeleteFuture) Result(client DisksClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksDeleteFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.DisksDeleteFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.DeleteResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksDeleteFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksDeleteFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.DeleteResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksDeleteFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// DisksGrantAccessFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type DisksGrantAccessFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future DisksGrantAccessFuture) Result(client DisksClient) (au AccessURI, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return au, azure.NewAsyncOpIncompleteError("compute.DisksGrantAccessFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ au, err = client.GrantAccessResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ au, err = client.GrantAccessResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// DisksRevokeAccessFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type DisksRevokeAccessFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future DisksRevokeAccessFuture) Result(client DisksClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksRevokeAccessFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.DisksRevokeAccessFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.RevokeAccessResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksRevokeAccessFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksRevokeAccessFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.RevokeAccessResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksRevokeAccessFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// DisksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type DisksUpdateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future DisksUpdateFuture) Result(client DisksClient) (d Disk, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return d, azure.NewAsyncOpIncompleteError("compute.DisksUpdateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ d, err = client.UpdateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ d, err = client.UpdateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// DiskUpdate disk update resource.
+type DiskUpdate struct {
+ *DiskUpdateProperties `json:"properties,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for DiskUpdate.
+func (du DiskUpdate) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if du.DiskUpdateProperties != nil {
+ objectMap["properties"] = du.DiskUpdateProperties
+ }
+ if du.Tags != nil {
+ objectMap["tags"] = du.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for DiskUpdate struct.
+func (du *DiskUpdate) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var diskUpdateProperties DiskUpdateProperties
+ err = json.Unmarshal(*v, &diskUpdateProperties)
+ if err != nil {
+ return err
+ }
+ du.DiskUpdateProperties = &diskUpdateProperties
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ du.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// DiskUpdateProperties disk resource update properties.
+type DiskUpdateProperties struct {
+ // AccountType - the storage account type of the disk. Possible values include: 'StandardLRS', 'PremiumLRS'
+ AccountType StorageAccountTypes `json:"accountType,omitempty"`
+ // OsType - the Operating System type. Possible values include: 'Windows', 'Linux'
+ OsType OperatingSystemTypes `json:"osType,omitempty"`
+ // CreationData - disk source information. CreationData information cannot be changed after the disk has been created.
+ CreationData *CreationData `json:"creationData,omitempty"`
+ // DiskSizeGB - If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
+ DiskSizeGB *int32 `json:"diskSizeGB,omitempty"`
+ // EncryptionSettings - Encryption settings for disk or snapshot
+ EncryptionSettings *EncryptionSettings `json:"encryptionSettings,omitempty"`
+}
+
+// EncryptionSettings encryption settings for disk or snapshot
+type EncryptionSettings struct {
+ // Enabled - Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged.
+ Enabled *bool `json:"enabled,omitempty"`
+ // DiskEncryptionKey - Key Vault Secret Url and vault id of the disk encryption key
+ DiskEncryptionKey *KeyVaultAndSecretReference `json:"diskEncryptionKey,omitempty"`
+ // KeyEncryptionKey - Key Vault Key Url and vault id of the key encryption key
+ KeyEncryptionKey *KeyVaultAndKeyReference `json:"keyEncryptionKey,omitempty"`
+}
+
+// GrantAccessData data used for requesting a SAS.
+type GrantAccessData struct {
+ // Access - Possible values include: 'None', 'Read'
+ Access AccessLevel `json:"access,omitempty"`
+ // DurationInSeconds - Time duration in seconds until the SAS access expires.
+ DurationInSeconds *int32 `json:"durationInSeconds,omitempty"`
+}
+
+// HardwareProfile specifies the hardware settings for the virtual machine.
+type HardwareProfile struct {
+ // VMSize - Specifies the size of the virtual machine. For more information about virtual machine sizes, see [Sizes for virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-sizes?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
The available VM sizes depend on region and availability set. For a list of available sizes use these APIs:
[List all available virtual machine sizes in an availability set](virtualmachines-list-sizes-availability-set.md)
[List all available virtual machine sizes in a region](virtualmachines-list-sizes-region.md)
[List all available virtual machine sizes for resizing](virtualmachines-list-sizes-for-resizing.md). Possible values include: 'BasicA0', 'BasicA1', 'BasicA2', 'BasicA3', 'BasicA4', 'StandardA0', 'StandardA1', 'StandardA2', 'StandardA3', 'StandardA4', 'StandardA5', 'StandardA6', 'StandardA7', 'StandardA8', 'StandardA9', 'StandardA10', 'StandardA11', 'StandardD1', 'StandardD2', 'StandardD3', 'StandardD4', 'StandardD11', 'StandardD12', 'StandardD13', 'StandardD14', 'StandardD1V2', 'StandardD2V2', 'StandardD3V2', 'StandardD4V2', 'StandardD5V2', 'StandardD11V2', 'StandardD12V2', 'StandardD13V2', 'StandardD14V2', 'StandardD15V2', 'StandardDS1', 'StandardDS2', 'StandardDS3', 'StandardDS4', 'StandardDS11', 'StandardDS12', 'StandardDS13', 'StandardDS14', 'StandardDS1V2', 'StandardDS2V2', 'StandardDS3V2', 'StandardDS4V2', 'StandardDS5V2', 'StandardDS11V2', 'StandardDS12V2', 'StandardDS13V2', 'StandardDS14V2', 'StandardDS15V2', 'StandardG1', 'StandardG2', 'StandardG3', 'StandardG4', 'StandardG5', 'StandardGS1', 'StandardGS2', 'StandardGS3', 'StandardGS4', 'StandardGS5'
+ VMSize VirtualMachineSizeTypes `json:"vmSize,omitempty"`
+}
+
+// Image the source user image virtual hard disk. The virtual hard disk will be copied before being attached to the
+// virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.
+type Image struct {
+ autorest.Response `json:"-"`
+ *ImageProperties `json:"properties,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for Image.
+func (i Image) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if i.ImageProperties != nil {
+ objectMap["properties"] = i.ImageProperties
+ }
+ if i.ID != nil {
+ objectMap["id"] = i.ID
+ }
+ if i.Name != nil {
+ objectMap["name"] = i.Name
+ }
+ if i.Type != nil {
+ objectMap["type"] = i.Type
+ }
+ if i.Location != nil {
+ objectMap["location"] = i.Location
+ }
+ if i.Tags != nil {
+ objectMap["tags"] = i.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for Image struct.
+func (i *Image) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var imageProperties ImageProperties
+ err = json.Unmarshal(*v, &imageProperties)
+ if err != nil {
+ return err
+ }
+ i.ImageProperties = &imageProperties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ i.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ i.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ i.Type = &typeVar
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ i.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ i.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// ImageDataDisk describes a data disk.
+type ImageDataDisk struct {
+ // Lun - Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.
+ Lun *int32 `json:"lun,omitempty"`
+ // Snapshot - The snapshot.
+ Snapshot *SubResource `json:"snapshot,omitempty"`
+ // ManagedDisk - The managedDisk.
+ ManagedDisk *SubResource `json:"managedDisk,omitempty"`
+ // BlobURI - The Virtual Hard Disk.
+ BlobURI *string `json:"blobUri,omitempty"`
+ // Caching - Specifies the caching requirements.
Possible values are:
**None**
**ReadOnly**
**ReadWrite**
Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite'
+ Caching CachingTypes `json:"caching,omitempty"`
+ // DiskSizeGB - Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.
This value cannot be larger than 1023 GB
+ DiskSizeGB *int32 `json:"diskSizeGB,omitempty"`
+}
+
+// ImageDiskReference the source image used for creating the disk.
+type ImageDiskReference struct {
+ // ID - A relative uri containing either a Platform Imgage Repository or user image reference.
+ ID *string `json:"id,omitempty"`
+ // Lun - If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.
+ Lun *int32 `json:"lun,omitempty"`
+}
+
+// ImageListResult the List Image operation response.
+type ImageListResult struct {
+ autorest.Response `json:"-"`
+ // Value - The list of Images.
+ Value *[]Image `json:"value,omitempty"`
+ // NextLink - The uri to fetch the next page of Images. Call ListNext() with this to fetch the next page of Images.
+ NextLink *string `json:"nextLink,omitempty"`
+}
+
+// ImageListResultIterator provides access to a complete listing of Image values.
+type ImageListResultIterator struct {
+ i int
+ page ImageListResultPage
+}
+
+// Next advances to the next value. If there was an error making
+// the request the iterator does not advance and the error is returned.
+func (iter *ImageListResultIterator) Next() error {
+ iter.i++
+ if iter.i < len(iter.page.Values()) {
+ return nil
+ }
+ err := iter.page.Next()
+ if err != nil {
+ iter.i--
+ return err
+ }
+ iter.i = 0
+ return nil
+}
+
+// NotDone returns true if the enumeration should be started or is not yet complete.
+func (iter ImageListResultIterator) NotDone() bool {
+ return iter.page.NotDone() && iter.i < len(iter.page.Values())
+}
+
+// Response returns the raw server response from the last page request.
+func (iter ImageListResultIterator) Response() ImageListResult {
+ return iter.page.Response()
+}
+
+// Value returns the current value or a zero-initialized value if the
+// iterator has advanced beyond the end of the collection.
+func (iter ImageListResultIterator) Value() Image {
+ if !iter.page.NotDone() {
+ return Image{}
+ }
+ return iter.page.Values()[iter.i]
+}
+
+// IsEmpty returns true if the ListResult contains no values.
+func (ilr ImageListResult) IsEmpty() bool {
+ return ilr.Value == nil || len(*ilr.Value) == 0
+}
+
+// imageListResultPreparer prepares a request to retrieve the next set of results.
+// It returns nil if no more results exist.
+func (ilr ImageListResult) imageListResultPreparer() (*http.Request, error) {
+ if ilr.NextLink == nil || len(to.String(ilr.NextLink)) < 1 {
+ return nil, nil
+ }
+ return autorest.Prepare(&http.Request{},
+ autorest.AsJSON(),
+ autorest.AsGet(),
+ autorest.WithBaseURL(to.String(ilr.NextLink)))
+}
+
+// ImageListResultPage contains a page of Image values.
+type ImageListResultPage struct {
+ fn func(ImageListResult) (ImageListResult, error)
+ ilr ImageListResult
+}
+
+// Next advances to the next page of values. If there was an error making
+// the request the page does not advance and the error is returned.
+func (page *ImageListResultPage) Next() error {
+ next, err := page.fn(page.ilr)
+ if err != nil {
+ return err
+ }
+ page.ilr = next
+ return nil
+}
+
+// NotDone returns true if the page enumeration should be started or is not yet complete.
+func (page ImageListResultPage) NotDone() bool {
+ return !page.ilr.IsEmpty()
+}
+
+// Response returns the raw server response from the last page request.
+func (page ImageListResultPage) Response() ImageListResult {
+ return page.ilr
+}
+
+// Values returns the slice of values for the current page or nil if there are no values.
+func (page ImageListResultPage) Values() []Image {
+ if page.ilr.IsEmpty() {
+ return nil
+ }
+ return *page.ilr.Value
+}
+
+// ImageOSDisk describes an Operating System disk.
+type ImageOSDisk struct {
+ // OsType - This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image.
Possible values are:
**Windows**
**Linux**. Possible values include: 'Windows', 'Linux'
+ OsType OperatingSystemTypes `json:"osType,omitempty"`
+ // OsState - The OS State. Possible values include: 'Generalized', 'Specialized'
+ OsState OperatingSystemStateTypes `json:"osState,omitempty"`
+ // Snapshot - The snapshot.
+ Snapshot *SubResource `json:"snapshot,omitempty"`
+ // ManagedDisk - The managedDisk.
+ ManagedDisk *SubResource `json:"managedDisk,omitempty"`
+ // BlobURI - The Virtual Hard Disk.
+ BlobURI *string `json:"blobUri,omitempty"`
+ // Caching - Specifies the caching requirements.
Possible values are:
**None**
**ReadOnly**
**ReadWrite**
Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite'
+ Caching CachingTypes `json:"caching,omitempty"`
+ // DiskSizeGB - Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.
This value cannot be larger than 1023 GB
+ DiskSizeGB *int32 `json:"diskSizeGB,omitempty"`
+}
+
+// ImageProperties describes the properties of an Image.
+type ImageProperties struct {
+ // SourceVirtualMachine - The source virtual machine from which Image is created.
+ SourceVirtualMachine *SubResource `json:"sourceVirtualMachine,omitempty"`
+ // StorageProfile - Specifies the storage settings for the virtual machine disks.
+ StorageProfile *ImageStorageProfile `json:"storageProfile,omitempty"`
+ // ProvisioningState - The provisioning state.
+ ProvisioningState *string `json:"provisioningState,omitempty"`
+}
+
+// ImageReference specifies information about the image to use. You can specify information about platform images,
+// marketplace images, or virtual machine images. This element is required when you want to use a platform image,
+// marketplace image, or virtual machine image, but is not used in other creation operations.
+type ImageReference struct {
+ // Publisher - The image publisher.
+ Publisher *string `json:"publisher,omitempty"`
+ // Offer - Specifies the offer of the platform image or marketplace image used to create the virtual machine.
+ Offer *string `json:"offer,omitempty"`
+ // Sku - The image SKU.
+ Sku *string `json:"sku,omitempty"`
+ // Version - Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available.
+ Version *string `json:"version,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// ImagesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type ImagesCreateOrUpdateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future ImagesCreateOrUpdateFuture) Result(client ImagesClient) (i Image, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return i, azure.NewAsyncOpIncompleteError("compute.ImagesCreateOrUpdateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ i, err = client.CreateOrUpdateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ i, err = client.CreateOrUpdateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// ImagesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type ImagesDeleteFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future ImagesDeleteFuture) Result(client ImagesClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.ImagesDeleteFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.DeleteResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.DeleteResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// ImageStorageProfile describes a storage profile.
+type ImageStorageProfile struct {
+ // OsDisk - Specifies information about the operating system disk used by the virtual machine.
For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
+ OsDisk *ImageOSDisk `json:"osDisk,omitempty"`
+ // DataDisks - Specifies the parameters that are used to add a data disk to a virtual machine.
For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
+ DataDisks *[]ImageDataDisk `json:"dataDisks,omitempty"`
+}
+
+// InnerError inner error details.
+type InnerError struct {
+ // Exceptiontype - The exception type.
+ Exceptiontype *string `json:"exceptiontype,omitempty"`
+ // Errordetail - The internal error message or exception dump.
+ Errordetail *string `json:"errordetail,omitempty"`
+}
+
+// InstanceViewStatus instance view status.
+type InstanceViewStatus struct {
+ // Code - The status code.
+ Code *string `json:"code,omitempty"`
+ // Level - The level code. Possible values include: 'Info', 'Warning', 'Error'
+ Level StatusLevelTypes `json:"level,omitempty"`
+ // DisplayStatus - The short localizable label for the status.
+ DisplayStatus *string `json:"displayStatus,omitempty"`
+ // Message - The detailed status message, including for alerts and error messages.
+ Message *string `json:"message,omitempty"`
+ // Time - The time of the status.
+ Time *date.Time `json:"time,omitempty"`
+}
+
+// KeyVaultAndKeyReference key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to
+// unwrap the encryptionKey
+type KeyVaultAndKeyReference struct {
+ // SourceVault - Resource id of the KeyVault containing the key or secret
+ SourceVault *SourceVault `json:"sourceVault,omitempty"`
+ // KeyURL - Url pointing to a key or secret in KeyVault
+ KeyURL *string `json:"keyUrl,omitempty"`
+}
+
+// KeyVaultAndSecretReference key Vault Secret Url and vault id of the encryption key
+type KeyVaultAndSecretReference struct {
+ // SourceVault - Resource id of the KeyVault containing the key or secret
+ SourceVault *SourceVault `json:"sourceVault,omitempty"`
+ // SecretURL - Url pointing to a key or secret in KeyVault
+ SecretURL *string `json:"secretUrl,omitempty"`
+}
+
+// KeyVaultKeyReference describes a reference to Key Vault Key
+type KeyVaultKeyReference struct {
+ // KeyURL - The URL referencing a key encryption key in Key Vault.
+ KeyURL *string `json:"keyUrl,omitempty"`
+ // SourceVault - The relative URL of the Key Vault containing the key.
+ SourceVault *SubResource `json:"sourceVault,omitempty"`
+}
+
+// KeyVaultSecretReference describes a reference to Key Vault Secret
+type KeyVaultSecretReference struct {
+ // SecretURL - The URL referencing a secret in a Key Vault.
+ SecretURL *string `json:"secretUrl,omitempty"`
+ // SourceVault - The relative URL of the Key Vault containing the secret.
+ SourceVault *SubResource `json:"sourceVault,omitempty"`
+}
+
+// LinuxConfiguration specifies the Linux operating system settings on the virtual machine.
For a list of
+// supported Linux distributions, see [Linux on Azure-Endorsed
+// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
+//
For running non-endorsed distributions, see [Information for Non-Endorsed
+// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json).
+type LinuxConfiguration struct {
+ // DisablePasswordAuthentication - Specifies whether password authentication should be disabled.
+ DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"`
+ // SSH - Specifies the ssh key configuration for a Linux OS.
+ SSH *SSHConfiguration `json:"ssh,omitempty"`
+}
+
+// ListUsagesResult the List Usages operation response.
+type ListUsagesResult struct {
+ autorest.Response `json:"-"`
+ // Value - The list of compute resource usages.
+ Value *[]Usage `json:"value,omitempty"`
+ // NextLink - The URI to fetch the next page of compute resource usage information. Call ListNext() with this to fetch the next page of compute resource usage information.
+ NextLink *string `json:"nextLink,omitempty"`
+}
+
+// ListUsagesResultIterator provides access to a complete listing of Usage values.
+type ListUsagesResultIterator struct {
+ i int
+ page ListUsagesResultPage
+}
+
+// Next advances to the next value. If there was an error making
+// the request the iterator does not advance and the error is returned.
+func (iter *ListUsagesResultIterator) Next() error {
+ iter.i++
+ if iter.i < len(iter.page.Values()) {
+ return nil
+ }
+ err := iter.page.Next()
+ if err != nil {
+ iter.i--
+ return err
+ }
+ iter.i = 0
+ return nil
+}
+
+// NotDone returns true if the enumeration should be started or is not yet complete.
+func (iter ListUsagesResultIterator) NotDone() bool {
+ return iter.page.NotDone() && iter.i < len(iter.page.Values())
+}
+
+// Response returns the raw server response from the last page request.
+func (iter ListUsagesResultIterator) Response() ListUsagesResult {
+ return iter.page.Response()
+}
+
+// Value returns the current value or a zero-initialized value if the
+// iterator has advanced beyond the end of the collection.
+func (iter ListUsagesResultIterator) Value() Usage {
+ if !iter.page.NotDone() {
+ return Usage{}
+ }
+ return iter.page.Values()[iter.i]
+}
+
+// IsEmpty returns true if the ListResult contains no values.
+func (lur ListUsagesResult) IsEmpty() bool {
+ return lur.Value == nil || len(*lur.Value) == 0
+}
+
+// listUsagesResultPreparer prepares a request to retrieve the next set of results.
+// It returns nil if no more results exist.
+func (lur ListUsagesResult) listUsagesResultPreparer() (*http.Request, error) {
+ if lur.NextLink == nil || len(to.String(lur.NextLink)) < 1 {
+ return nil, nil
+ }
+ return autorest.Prepare(&http.Request{},
+ autorest.AsJSON(),
+ autorest.AsGet(),
+ autorest.WithBaseURL(to.String(lur.NextLink)))
+}
+
+// ListUsagesResultPage contains a page of Usage values.
+type ListUsagesResultPage struct {
+ fn func(ListUsagesResult) (ListUsagesResult, error)
+ lur ListUsagesResult
+}
+
+// Next advances to the next page of values. If there was an error making
+// the request the page does not advance and the error is returned.
+func (page *ListUsagesResultPage) Next() error {
+ next, err := page.fn(page.lur)
+ if err != nil {
+ return err
+ }
+ page.lur = next
+ return nil
+}
+
+// NotDone returns true if the page enumeration should be started or is not yet complete.
+func (page ListUsagesResultPage) NotDone() bool {
+ return !page.lur.IsEmpty()
+}
+
+// Response returns the raw server response from the last page request.
+func (page ListUsagesResultPage) Response() ListUsagesResult {
+ return page.lur
+}
+
+// Values returns the slice of values for the current page or nil if there are no values.
+func (page ListUsagesResultPage) Values() []Usage {
+ if page.lur.IsEmpty() {
+ return nil
+ }
+ return *page.lur.Value
+}
+
+// ListVirtualMachineExtensionImage ...
+type ListVirtualMachineExtensionImage struct {
+ autorest.Response `json:"-"`
+ Value *[]VirtualMachineExtensionImage `json:"value,omitempty"`
+}
+
+// ListVirtualMachineImageResource ...
+type ListVirtualMachineImageResource struct {
+ autorest.Response `json:"-"`
+ Value *[]VirtualMachineImageResource `json:"value,omitempty"`
+}
+
+// LongRunningOperationProperties compute-specific operation properties, including output
+type LongRunningOperationProperties struct {
+ // Output - Operation output data (raw JSON)
+ Output interface{} `json:"output,omitempty"`
+}
+
+// ManagedDiskParameters the parameters of a managed disk.
+type ManagedDiskParameters struct {
+ // StorageAccountType - Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'StandardLRS', 'PremiumLRS'
+ StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// NetworkInterfaceReference describes a network interface reference.
+type NetworkInterfaceReference struct {
+ *NetworkInterfaceReferenceProperties `json:"properties,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// MarshalJSON is the custom marshaler for NetworkInterfaceReference.
+func (nir NetworkInterfaceReference) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if nir.NetworkInterfaceReferenceProperties != nil {
+ objectMap["properties"] = nir.NetworkInterfaceReferenceProperties
+ }
+ if nir.ID != nil {
+ objectMap["id"] = nir.ID
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for NetworkInterfaceReference struct.
+func (nir *NetworkInterfaceReference) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var networkInterfaceReferenceProperties NetworkInterfaceReferenceProperties
+ err = json.Unmarshal(*v, &networkInterfaceReferenceProperties)
+ if err != nil {
+ return err
+ }
+ nir.NetworkInterfaceReferenceProperties = &networkInterfaceReferenceProperties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ nir.ID = &ID
+ }
+ }
+ }
+
+ return nil
+}
+
+// NetworkInterfaceReferenceProperties describes a network interface reference properties.
+type NetworkInterfaceReferenceProperties struct {
+ // Primary - Specifies the primary network interface in case the virtual machine has more than 1 network interface.
+ Primary *bool `json:"primary,omitempty"`
+}
+
+// NetworkProfile specifies the network interfaces of the virtual machine.
+type NetworkProfile struct {
+ // NetworkInterfaces - Specifies the list of resource Ids for the network interfaces associated with the virtual machine.
+ NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"`
+}
+
+// OperationStatusResponse operation status response
+type OperationStatusResponse struct {
+ autorest.Response `json:"-"`
+ // Name - Operation ID
+ Name *string `json:"name,omitempty"`
+ // Status - Operation status
+ Status *string `json:"status,omitempty"`
+ // StartTime - Start time of the operation
+ StartTime *date.Time `json:"startTime,omitempty"`
+ // EndTime - End time of the operation
+ EndTime *date.Time `json:"endTime,omitempty"`
+ // Error - Api error
+ Error *APIError `json:"error,omitempty"`
+}
+
+// OSDisk specifies information about the operating system disk used by the virtual machine.
For more
+// information about disks, see [About disks and VHDs for Azure virtual
+// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
+type OSDisk struct {
+ // OsType - This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD.
Possible values are:
**Windows**
**Linux**. Possible values include: 'Windows', 'Linux'
+ OsType OperatingSystemTypes `json:"osType,omitempty"`
+ // EncryptionSettings - Specifies the encryption settings for the OS Disk.
Minimum api-version: 2015-06-15
+ EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"`
+ // Name - The disk name.
+ Name *string `json:"name,omitempty"`
+ // Vhd - The virtual hard disk.
+ Vhd *VirtualHardDisk `json:"vhd,omitempty"`
+ // Image - The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.
+ Image *VirtualHardDisk `json:"image,omitempty"`
+ // Caching - Specifies the caching requirements.
Possible values are:
**None**
**ReadOnly**
**ReadWrite**
Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite'
+ Caching CachingTypes `json:"caching,omitempty"`
+ // CreateOption - Specifies how the virtual machine should be created.
Possible values are:
**Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.
**FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach'
+ CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"`
+ // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.
This value cannot be larger than 1023 GB
+ DiskSizeGB *int32 `json:"diskSizeGB,omitempty"`
+ // ManagedDisk - The managed disk parameters.
+ ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"`
+}
+
+// OSDiskImage contains the os disk image information.
+type OSDiskImage struct {
+ // OperatingSystem - The operating system of the osDiskImage. Possible values include: 'Windows', 'Linux'
+ OperatingSystem OperatingSystemTypes `json:"operatingSystem,omitempty"`
+}
+
+// OSProfile specifies the operating system settings for the virtual machine.
+type OSProfile struct {
+ // ComputerName - Specifies the host OS name of the virtual machine.
**Max-length (Windows):** 15 characters
**Max-length (Linux):** 64 characters.
For naming conventions and restrictions see [Azure infrastructure services implementation guidelines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions).
+ ComputerName *string `json:"computerName,omitempty"`
+ // AdminUsername - Specifies the name of the administrator account.
**Windows-only restriction:** Cannot end in "."
**Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".
**Minimum-length (Linux):** 1 character
**Max-length (Linux):** 64 characters
**Max-length (Windows):** 20 characters
For root access to the Linux VM, see [Using root privileges on Linux virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
For a list of built-in system users on Linux that should not be used in this field, see [Selecting User Names for Linux on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
+ AdminUsername *string `json:"adminUsername,omitempty"`
+ // AdminPassword - Specifies the password of the administrator account.
**Minimum-length (Windows):** 8 characters
**Minimum-length (Linux):** 6 characters
**Max-length (Windows):** 123 characters
**Max-length (Linux):** 72 characters
**Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has upper characters
Has a digit
Has a special character (Regex match [\W_])
**Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"
For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password)
+ AdminPassword *string `json:"adminPassword,omitempty"`
+ // CustomData - Specifies a base-64 encoded string of custom data. 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.
For using cloud-init for your VM, see [Using cloud-init to customize a Linux VM during creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
+ CustomData *string `json:"customData,omitempty"`
+ // WindowsConfiguration - Specifies Windows operating system settings on the virtual machine.
+ WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"`
+ // LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine.
For a list of supported Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
For running non-endorsed distributions, see [Information for Non-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json).
+ LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"`
+ // Secrets - Specifies set of certificates that should be installed onto the virtual machine.
+ Secrets *[]VaultSecretGroup `json:"secrets,omitempty"`
+}
+
+// Plan specifies information about the marketplace image used to create the virtual machine. This element is only
+// used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for
+// programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to
+// deploy programmatically, Get Started ->**. Enter any required information and then click **Save**.
+type Plan struct {
+ // Name - The plan ID.
+ Name *string `json:"name,omitempty"`
+ // Publisher - The publisher ID.
+ Publisher *string `json:"publisher,omitempty"`
+ // Product - Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element.
+ Product *string `json:"product,omitempty"`
+ // PromotionCode - The promotion code.
+ PromotionCode *string `json:"promotionCode,omitempty"`
+}
+
+// PurchasePlan used for establishing the purchase context of any 3rd Party artifact through MarketPlace.
+type PurchasePlan struct {
+ // Publisher - The publisher ID.
+ Publisher *string `json:"publisher,omitempty"`
+ // Name - The plan ID.
+ Name *string `json:"name,omitempty"`
+ // Product - Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element.
+ Product *string `json:"product,omitempty"`
+}
+
+// Resource the Resource model definition.
+type Resource struct {
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for Resource.
+func (r Resource) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if r.ID != nil {
+ objectMap["id"] = r.ID
+ }
+ if r.Name != nil {
+ objectMap["name"] = r.Name
+ }
+ if r.Type != nil {
+ objectMap["type"] = r.Type
+ }
+ if r.Location != nil {
+ objectMap["location"] = r.Location
+ }
+ if r.Tags != nil {
+ objectMap["tags"] = r.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// ResourceUpdate the Resource model definition.
+type ResourceUpdate struct {
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for ResourceUpdate.
+func (ru ResourceUpdate) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if ru.Tags != nil {
+ objectMap["tags"] = ru.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// Sku describes a virtual machine scale set sku.
+type Sku struct {
+ // Name - The sku name.
+ Name *string `json:"name,omitempty"`
+ // Tier - Specifies the tier of virtual machines in a scale set.
Possible Values:
**Standard**
**Basic**
+ Tier *string `json:"tier,omitempty"`
+ // Capacity - Specifies the number of virtual machines in the scale set.
+ Capacity *int64 `json:"capacity,omitempty"`
+}
+
+// Snapshot snapshot resource.
+type Snapshot struct {
+ autorest.Response `json:"-"`
+ *DiskProperties `json:"properties,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for Snapshot.
+func (s Snapshot) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if s.DiskProperties != nil {
+ objectMap["properties"] = s.DiskProperties
+ }
+ if s.ID != nil {
+ objectMap["id"] = s.ID
+ }
+ if s.Name != nil {
+ objectMap["name"] = s.Name
+ }
+ if s.Type != nil {
+ objectMap["type"] = s.Type
+ }
+ if s.Location != nil {
+ objectMap["location"] = s.Location
+ }
+ if s.Tags != nil {
+ objectMap["tags"] = s.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for Snapshot struct.
+func (s *Snapshot) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var diskProperties DiskProperties
+ err = json.Unmarshal(*v, &diskProperties)
+ if err != nil {
+ return err
+ }
+ s.DiskProperties = &diskProperties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ s.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ s.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ s.Type = &typeVar
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ s.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ s.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// SnapshotList the List Snapshots operation response.
+type SnapshotList struct {
+ autorest.Response `json:"-"`
+ // Value - A list of snapshots.
+ Value *[]Snapshot `json:"value,omitempty"`
+ // NextLink - The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots.
+ NextLink *string `json:"nextLink,omitempty"`
+}
+
+// SnapshotListIterator provides access to a complete listing of Snapshot values.
+type SnapshotListIterator struct {
+ i int
+ page SnapshotListPage
+}
+
+// Next advances to the next value. If there was an error making
+// the request the iterator does not advance and the error is returned.
+func (iter *SnapshotListIterator) Next() error {
+ iter.i++
+ if iter.i < len(iter.page.Values()) {
+ return nil
+ }
+ err := iter.page.Next()
+ if err != nil {
+ iter.i--
+ return err
+ }
+ iter.i = 0
+ return nil
+}
+
+// NotDone returns true if the enumeration should be started or is not yet complete.
+func (iter SnapshotListIterator) NotDone() bool {
+ return iter.page.NotDone() && iter.i < len(iter.page.Values())
+}
+
+// Response returns the raw server response from the last page request.
+func (iter SnapshotListIterator) Response() SnapshotList {
+ return iter.page.Response()
+}
+
+// Value returns the current value or a zero-initialized value if the
+// iterator has advanced beyond the end of the collection.
+func (iter SnapshotListIterator) Value() Snapshot {
+ if !iter.page.NotDone() {
+ return Snapshot{}
+ }
+ return iter.page.Values()[iter.i]
+}
+
+// IsEmpty returns true if the ListResult contains no values.
+func (sl SnapshotList) IsEmpty() bool {
+ return sl.Value == nil || len(*sl.Value) == 0
+}
+
+// snapshotListPreparer prepares a request to retrieve the next set of results.
+// It returns nil if no more results exist.
+func (sl SnapshotList) snapshotListPreparer() (*http.Request, error) {
+ if sl.NextLink == nil || len(to.String(sl.NextLink)) < 1 {
+ return nil, nil
+ }
+ return autorest.Prepare(&http.Request{},
+ autorest.AsJSON(),
+ autorest.AsGet(),
+ autorest.WithBaseURL(to.String(sl.NextLink)))
+}
+
+// SnapshotListPage contains a page of Snapshot values.
+type SnapshotListPage struct {
+ fn func(SnapshotList) (SnapshotList, error)
+ sl SnapshotList
+}
+
+// Next advances to the next page of values. If there was an error making
+// the request the page does not advance and the error is returned.
+func (page *SnapshotListPage) Next() error {
+ next, err := page.fn(page.sl)
+ if err != nil {
+ return err
+ }
+ page.sl = next
+ return nil
+}
+
+// NotDone returns true if the page enumeration should be started or is not yet complete.
+func (page SnapshotListPage) NotDone() bool {
+ return !page.sl.IsEmpty()
+}
+
+// Response returns the raw server response from the last page request.
+func (page SnapshotListPage) Response() SnapshotList {
+ return page.sl
+}
+
+// Values returns the slice of values for the current page or nil if there are no values.
+func (page SnapshotListPage) Values() []Snapshot {
+ if page.sl.IsEmpty() {
+ return nil
+ }
+ return *page.sl.Value
+}
+
+// SnapshotsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type SnapshotsCreateOrUpdateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future SnapshotsCreateOrUpdateFuture) Result(client SnapshotsClient) (s Snapshot, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return s, azure.NewAsyncOpIncompleteError("compute.SnapshotsCreateOrUpdateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ s, err = client.CreateOrUpdateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ s, err = client.CreateOrUpdateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// SnapshotsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type SnapshotsDeleteFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future SnapshotsDeleteFuture) Result(client SnapshotsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsDeleteFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.SnapshotsDeleteFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.DeleteResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsDeleteFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsDeleteFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.DeleteResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsDeleteFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// SnapshotsGrantAccessFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type SnapshotsGrantAccessFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future SnapshotsGrantAccessFuture) Result(client SnapshotsClient) (au AccessURI, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return au, azure.NewAsyncOpIncompleteError("compute.SnapshotsGrantAccessFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ au, err = client.GrantAccessResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ au, err = client.GrantAccessResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// SnapshotsRevokeAccessFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type SnapshotsRevokeAccessFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future SnapshotsRevokeAccessFuture) Result(client SnapshotsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsRevokeAccessFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.SnapshotsRevokeAccessFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.RevokeAccessResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsRevokeAccessFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsRevokeAccessFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.RevokeAccessResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsRevokeAccessFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// SnapshotsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type SnapshotsUpdateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future SnapshotsUpdateFuture) Result(client SnapshotsClient) (s Snapshot, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return s, azure.NewAsyncOpIncompleteError("compute.SnapshotsUpdateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ s, err = client.UpdateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ s, err = client.UpdateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// SnapshotUpdate snapshot update resource.
+type SnapshotUpdate struct {
+ *DiskUpdateProperties `json:"properties,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for SnapshotUpdate.
+func (su SnapshotUpdate) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if su.DiskUpdateProperties != nil {
+ objectMap["properties"] = su.DiskUpdateProperties
+ }
+ if su.Tags != nil {
+ objectMap["tags"] = su.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for SnapshotUpdate struct.
+func (su *SnapshotUpdate) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var diskUpdateProperties DiskUpdateProperties
+ err = json.Unmarshal(*v, &diskUpdateProperties)
+ if err != nil {
+ return err
+ }
+ su.DiskUpdateProperties = &diskUpdateProperties
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ su.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// SourceVault the vault id is an Azure Resource Manager Resoure id in the form
+// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
+type SourceVault struct {
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// SSHConfiguration SSH configuration for Linux based VMs running on Azure
+type SSHConfiguration struct {
+ // PublicKeys - The list of SSH public keys used to authenticate with linux based VMs.
+ PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"`
+}
+
+// SSHPublicKey contains information about SSH certificate public key and the path on the Linux VM where the public
+// key is placed.
+type SSHPublicKey struct {
+ // Path - Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys
+ Path *string `json:"path,omitempty"`
+ // KeyData - SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format.
For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-mac-create-ssh-keys?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json).
+ KeyData *string `json:"keyData,omitempty"`
+}
+
+// StorageProfile specifies the storage settings for the virtual machine disks.
+type StorageProfile struct {
+ // ImageReference - Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations.
+ ImageReference *ImageReference `json:"imageReference,omitempty"`
+ // OsDisk - Specifies information about the operating system disk used by the virtual machine.
For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
+ OsDisk *OSDisk `json:"osDisk,omitempty"`
+ // DataDisks - Specifies the parameters that are used to add a data disk to a virtual machine.
For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
+ DataDisks *[]DataDisk `json:"dataDisks,omitempty"`
+}
+
+// SubResource ...
+type SubResource struct {
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// SubResourceReadOnly ...
+type SubResourceReadOnly struct {
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// UpdateResource the Update Resource model definition.
+type UpdateResource struct {
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for UpdateResource.
+func (ur UpdateResource) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if ur.Tags != nil {
+ objectMap["tags"] = ur.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UpgradePolicy describes an upgrade policy - automatic or manual.
+type UpgradePolicy struct {
+ // Mode - Specifies the mode of an upgrade to virtual machines in the scale set.
Possible values are:
**Manual** - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade action.
**Automatic** - All virtual machines in the scale set are automatically updated at the same time. Possible values include: 'Automatic', 'Manual'
+ Mode UpgradeMode `json:"mode,omitempty"`
+}
+
+// Usage describes Compute Resource Usage.
+type Usage struct {
+ // Unit - An enum describing the unit of usage measurement.
+ Unit *string `json:"unit,omitempty"`
+ // CurrentValue - The current usage of the resource.
+ CurrentValue *int32 `json:"currentValue,omitempty"`
+ // Limit - The maximum permitted usage of the resource.
+ Limit *int64 `json:"limit,omitempty"`
+ // Name - The name of the type of usage.
+ Name *UsageName `json:"name,omitempty"`
+}
+
+// UsageName the Usage Names.
+type UsageName struct {
+ // Value - The name of the resource.
+ Value *string `json:"value,omitempty"`
+ // LocalizedValue - The localized name of the resource.
+ LocalizedValue *string `json:"localizedValue,omitempty"`
+}
+
+// VaultCertificate describes a single certificate reference in a Key Vault, and where the certificate should
+// reside on the VM.
+type VaultCertificate struct {
+ // CertificateURL - This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8:
{
"data":"",
"dataType":"pfx",
"password":""
}
+ CertificateURL *string `json:"certificateUrl,omitempty"`
+ // CertificateStore - For Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified certificate store is implicitly in the LocalMachine account.
For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name .crt for the X509 certificate file and .prv for private key. Both of these files are .pem formatted.
+ CertificateStore *string `json:"certificateStore,omitempty"`
+}
+
+// VaultSecretGroup describes a set of certificates which are all in the same Key Vault.
+type VaultSecretGroup struct {
+ // SourceVault - The relative URL of the Key Vault containing all of the certificates in VaultCertificates.
+ SourceVault *SubResource `json:"sourceVault,omitempty"`
+ // VaultCertificates - The list of key vault references in SourceVault which contain certificates.
+ VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"`
+}
+
+// VirtualHardDisk describes the uri of a disk.
+type VirtualHardDisk struct {
+ // URI - Specifies the virtual hard disk's uri.
+ URI *string `json:"uri,omitempty"`
+}
+
+// VirtualMachine describes a Virtual Machine.
+type VirtualMachine struct {
+ autorest.Response `json:"-"`
+ // Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**.
+ Plan *Plan `json:"plan,omitempty"`
+ *VirtualMachineProperties `json:"properties,omitempty"`
+ // Resources - The virtual machine child extension resources.
+ Resources *[]VirtualMachineExtension `json:"resources,omitempty"`
+ // Identity - The identity of the virtual machine, if configured.
+ Identity *VirtualMachineIdentity `json:"identity,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachine.
+func (VM VirtualMachine) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if VM.Plan != nil {
+ objectMap["plan"] = VM.Plan
+ }
+ if VM.VirtualMachineProperties != nil {
+ objectMap["properties"] = VM.VirtualMachineProperties
+ }
+ if VM.Resources != nil {
+ objectMap["resources"] = VM.Resources
+ }
+ if VM.Identity != nil {
+ objectMap["identity"] = VM.Identity
+ }
+ if VM.ID != nil {
+ objectMap["id"] = VM.ID
+ }
+ if VM.Name != nil {
+ objectMap["name"] = VM.Name
+ }
+ if VM.Type != nil {
+ objectMap["type"] = VM.Type
+ }
+ if VM.Location != nil {
+ objectMap["location"] = VM.Location
+ }
+ if VM.Tags != nil {
+ objectMap["tags"] = VM.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for VirtualMachine struct.
+func (VM *VirtualMachine) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "plan":
+ if v != nil {
+ var plan Plan
+ err = json.Unmarshal(*v, &plan)
+ if err != nil {
+ return err
+ }
+ VM.Plan = &plan
+ }
+ case "properties":
+ if v != nil {
+ var virtualMachineProperties VirtualMachineProperties
+ err = json.Unmarshal(*v, &virtualMachineProperties)
+ if err != nil {
+ return err
+ }
+ VM.VirtualMachineProperties = &virtualMachineProperties
+ }
+ case "resources":
+ if v != nil {
+ var resources []VirtualMachineExtension
+ err = json.Unmarshal(*v, &resources)
+ if err != nil {
+ return err
+ }
+ VM.Resources = &resources
+ }
+ case "identity":
+ if v != nil {
+ var identity VirtualMachineIdentity
+ err = json.Unmarshal(*v, &identity)
+ if err != nil {
+ return err
+ }
+ VM.Identity = &identity
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ VM.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ VM.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ VM.Type = &typeVar
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ VM.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ VM.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// VirtualMachineAgentInstanceView the instance view of the VM Agent running on the virtual machine.
+type VirtualMachineAgentInstanceView struct {
+ // VMAgentVersion - The VM Agent full version.
+ VMAgentVersion *string `json:"vmAgentVersion,omitempty"`
+ // ExtensionHandlers - The virtual machine extension handler instance view.
+ ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"`
+ // Statuses - The resource status information.
+ Statuses *[]InstanceViewStatus `json:"statuses,omitempty"`
+}
+
+// VirtualMachineCaptureParameters capture Virtual Machine parameters.
+type VirtualMachineCaptureParameters struct {
+ // VhdPrefix - The captured virtual hard disk's name prefix.
+ VhdPrefix *string `json:"vhdPrefix,omitempty"`
+ // DestinationContainerName - The destination container name.
+ DestinationContainerName *string `json:"destinationContainerName,omitempty"`
+ // OverwriteVhds - Specifies whether to overwrite the destination virtual hard disk, in case of conflict.
+ OverwriteVhds *bool `json:"overwriteVhds,omitempty"`
+}
+
+// VirtualMachineCaptureResult resource Id.
+type VirtualMachineCaptureResult struct {
+ autorest.Response `json:"-"`
+ *VirtualMachineCaptureResultProperties `json:"properties,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachineCaptureResult.
+func (vmcr VirtualMachineCaptureResult) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if vmcr.VirtualMachineCaptureResultProperties != nil {
+ objectMap["properties"] = vmcr.VirtualMachineCaptureResultProperties
+ }
+ if vmcr.ID != nil {
+ objectMap["id"] = vmcr.ID
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for VirtualMachineCaptureResult struct.
+func (vmcr *VirtualMachineCaptureResult) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var virtualMachineCaptureResultProperties VirtualMachineCaptureResultProperties
+ err = json.Unmarshal(*v, &virtualMachineCaptureResultProperties)
+ if err != nil {
+ return err
+ }
+ vmcr.VirtualMachineCaptureResultProperties = &virtualMachineCaptureResultProperties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ vmcr.ID = &ID
+ }
+ }
+ }
+
+ return nil
+}
+
+// VirtualMachineCaptureResultProperties compute-specific operation properties, including output
+type VirtualMachineCaptureResultProperties struct {
+ // Output - Operation output data (raw JSON)
+ Output interface{} `json:"output,omitempty"`
+}
+
+// VirtualMachineExtension describes a Virtual Machine Extension.
+type VirtualMachineExtension struct {
+ autorest.Response `json:"-"`
+ *VirtualMachineExtensionProperties `json:"properties,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachineExtension.
+func (vme VirtualMachineExtension) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if vme.VirtualMachineExtensionProperties != nil {
+ objectMap["properties"] = vme.VirtualMachineExtensionProperties
+ }
+ if vme.ID != nil {
+ objectMap["id"] = vme.ID
+ }
+ if vme.Name != nil {
+ objectMap["name"] = vme.Name
+ }
+ if vme.Type != nil {
+ objectMap["type"] = vme.Type
+ }
+ if vme.Location != nil {
+ objectMap["location"] = vme.Location
+ }
+ if vme.Tags != nil {
+ objectMap["tags"] = vme.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtension struct.
+func (vme *VirtualMachineExtension) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var virtualMachineExtensionProperties VirtualMachineExtensionProperties
+ err = json.Unmarshal(*v, &virtualMachineExtensionProperties)
+ if err != nil {
+ return err
+ }
+ vme.VirtualMachineExtensionProperties = &virtualMachineExtensionProperties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ vme.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ vme.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ vme.Type = &typeVar
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ vme.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ vme.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// VirtualMachineExtensionHandlerInstanceView the instance view of a virtual machine extension handler.
+type VirtualMachineExtensionHandlerInstanceView struct {
+ // Type - Specifies the type of the extension; an example is "CustomScriptExtension".
+ Type *string `json:"type,omitempty"`
+ // TypeHandlerVersion - Specifies the version of the script handler.
+ TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"`
+ // Status - The extension handler status.
+ Status *InstanceViewStatus `json:"status,omitempty"`
+}
+
+// VirtualMachineExtensionImage describes a Virtual Machine Extension Image.
+type VirtualMachineExtensionImage struct {
+ autorest.Response `json:"-"`
+ *VirtualMachineExtensionImageProperties `json:"properties,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachineExtensionImage.
+func (vmei VirtualMachineExtensionImage) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if vmei.VirtualMachineExtensionImageProperties != nil {
+ objectMap["properties"] = vmei.VirtualMachineExtensionImageProperties
+ }
+ if vmei.ID != nil {
+ objectMap["id"] = vmei.ID
+ }
+ if vmei.Name != nil {
+ objectMap["name"] = vmei.Name
+ }
+ if vmei.Type != nil {
+ objectMap["type"] = vmei.Type
+ }
+ if vmei.Location != nil {
+ objectMap["location"] = vmei.Location
+ }
+ if vmei.Tags != nil {
+ objectMap["tags"] = vmei.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtensionImage struct.
+func (vmei *VirtualMachineExtensionImage) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var virtualMachineExtensionImageProperties VirtualMachineExtensionImageProperties
+ err = json.Unmarshal(*v, &virtualMachineExtensionImageProperties)
+ if err != nil {
+ return err
+ }
+ vmei.VirtualMachineExtensionImageProperties = &virtualMachineExtensionImageProperties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ vmei.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ vmei.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ vmei.Type = &typeVar
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ vmei.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ vmei.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// VirtualMachineExtensionImageProperties describes the properties of a Virtual Machine Extension Image.
+type VirtualMachineExtensionImageProperties struct {
+ // OperatingSystem - The operating system this extension supports.
+ OperatingSystem *string `json:"operatingSystem,omitempty"`
+ // ComputeRole - The type of role (IaaS or PaaS) this extension supports.
+ ComputeRole *string `json:"computeRole,omitempty"`
+ // HandlerSchema - The schema defined by publisher, where extension consumers should provide settings in a matching schema.
+ HandlerSchema *string `json:"handlerSchema,omitempty"`
+ // VMScaleSetEnabled - Whether the extension can be used on xRP VMScaleSets. By default existing extensions are usable on scalesets, but there might be cases where a publisher wants to explicitly indicate the extension is only enabled for CRP VMs but not VMSS.
+ VMScaleSetEnabled *bool `json:"vmScaleSetEnabled,omitempty"`
+ // SupportsMultipleExtensions - Whether the handler can support multiple extensions.
+ SupportsMultipleExtensions *bool `json:"supportsMultipleExtensions,omitempty"`
+}
+
+// VirtualMachineExtensionInstanceView the instance view of a virtual machine extension.
+type VirtualMachineExtensionInstanceView struct {
+ // Name - The virtual machine extension name.
+ Name *string `json:"name,omitempty"`
+ // Type - Specifies the type of the extension; an example is "CustomScriptExtension".
+ Type *string `json:"type,omitempty"`
+ // TypeHandlerVersion - Specifies the version of the script handler.
+ TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"`
+ // Substatuses - The resource status information.
+ Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"`
+ // Statuses - The resource status information.
+ Statuses *[]InstanceViewStatus `json:"statuses,omitempty"`
+}
+
+// VirtualMachineExtensionProperties describes the properties of a Virtual Machine Extension.
+type VirtualMachineExtensionProperties struct {
+ // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed.
+ ForceUpdateTag *string `json:"forceUpdateTag,omitempty"`
+ // Publisher - The name of the extension handler publisher.
+ Publisher *string `json:"publisher,omitempty"`
+ // Type - Specifies the type of the extension; an example is "CustomScriptExtension".
+ Type *string `json:"type,omitempty"`
+ // TypeHandlerVersion - Specifies the version of the script handler.
+ TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"`
+ // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.
+ AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"`
+ // Settings - Json formatted public settings for the extension.
+ Settings interface{} `json:"settings,omitempty"`
+ // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.
+ ProtectedSettings interface{} `json:"protectedSettings,omitempty"`
+ // ProvisioningState - The provisioning state, which only appears in the response.
+ ProvisioningState *string `json:"provisioningState,omitempty"`
+ // InstanceView - The virtual machine extension instance view.
+ InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"`
+}
+
+// VirtualMachineExtensionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachineExtensionsCreateOrUpdateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineExtensionsCreateOrUpdateFuture) Result(client VirtualMachineExtensionsClient) (vme VirtualMachineExtension, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return vme, azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsCreateOrUpdateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ vme, err = client.CreateOrUpdateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ vme, err = client.CreateOrUpdateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachineExtensionsDeleteFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineExtensionsDeleteFuture) Result(client VirtualMachineExtensionsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsDeleteFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.DeleteResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.DeleteResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineExtensionsListResult the List Extension operation response
+type VirtualMachineExtensionsListResult struct {
+ autorest.Response `json:"-"`
+ // Value - The list of extensions
+ Value *[]VirtualMachineExtension `json:"value,omitempty"`
+}
+
+// VirtualMachineExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachineExtensionsUpdateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineExtensionsUpdateFuture) Result(client VirtualMachineExtensionsClient) (vme VirtualMachineExtension, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return vme, azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsUpdateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ vme, err = client.UpdateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ vme, err = client.UpdateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineExtensionUpdate describes a Virtual Machine Extension.
+type VirtualMachineExtensionUpdate struct {
+ *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachineExtensionUpdate.
+func (vmeu VirtualMachineExtensionUpdate) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if vmeu.VirtualMachineExtensionUpdateProperties != nil {
+ objectMap["properties"] = vmeu.VirtualMachineExtensionUpdateProperties
+ }
+ if vmeu.Tags != nil {
+ objectMap["tags"] = vmeu.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtensionUpdate struct.
+func (vmeu *VirtualMachineExtensionUpdate) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var virtualMachineExtensionUpdateProperties VirtualMachineExtensionUpdateProperties
+ err = json.Unmarshal(*v, &virtualMachineExtensionUpdateProperties)
+ if err != nil {
+ return err
+ }
+ vmeu.VirtualMachineExtensionUpdateProperties = &virtualMachineExtensionUpdateProperties
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ vmeu.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// VirtualMachineExtensionUpdateProperties describes the properties of a Virtual Machine Extension.
+type VirtualMachineExtensionUpdateProperties struct {
+ // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed.
+ ForceUpdateTag *string `json:"forceUpdateTag,omitempty"`
+ // Publisher - The name of the extension handler publisher.
+ Publisher *string `json:"publisher,omitempty"`
+ // Type - Specifies the type of the extension; an example is "CustomScriptExtension".
+ Type *string `json:"type,omitempty"`
+ // TypeHandlerVersion - Specifies the version of the script handler.
+ TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"`
+ // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.
+ AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"`
+ // Settings - Json formatted public settings for the extension.
+ Settings interface{} `json:"settings,omitempty"`
+ // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.
+ ProtectedSettings interface{} `json:"protectedSettings,omitempty"`
+}
+
+// VirtualMachineIdentity identity for the virtual machine.
+type VirtualMachineIdentity struct {
+ // PrincipalID - The principal id of virtual machine identity.
+ PrincipalID *string `json:"principalId,omitempty"`
+ // TenantID - The tenant id associated with the virtual machine.
+ TenantID *string `json:"tenantId,omitempty"`
+ // Type - The type of identity used for the virtual machine. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. Possible values include: 'SystemAssigned'
+ Type ResourceIdentityType `json:"type,omitempty"`
+}
+
+// VirtualMachineImage describes a Virtual Machine Image.
+type VirtualMachineImage struct {
+ autorest.Response `json:"-"`
+ *VirtualMachineImageProperties `json:"properties,omitempty"`
+ // Name - The name of the resource.
+ Name *string `json:"name,omitempty"`
+ // Location - The supported Azure location of the resource.
+ Location *string `json:"location,omitempty"`
+ // Tags - Specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md).
+ Tags map[string]*string `json:"tags"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachineImage.
+func (vmi VirtualMachineImage) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if vmi.VirtualMachineImageProperties != nil {
+ objectMap["properties"] = vmi.VirtualMachineImageProperties
+ }
+ if vmi.Name != nil {
+ objectMap["name"] = vmi.Name
+ }
+ if vmi.Location != nil {
+ objectMap["location"] = vmi.Location
+ }
+ if vmi.Tags != nil {
+ objectMap["tags"] = vmi.Tags
+ }
+ if vmi.ID != nil {
+ objectMap["id"] = vmi.ID
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for VirtualMachineImage struct.
+func (vmi *VirtualMachineImage) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var virtualMachineImageProperties VirtualMachineImageProperties
+ err = json.Unmarshal(*v, &virtualMachineImageProperties)
+ if err != nil {
+ return err
+ }
+ vmi.VirtualMachineImageProperties = &virtualMachineImageProperties
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ vmi.Name = &name
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ vmi.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ vmi.Tags = tags
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ vmi.ID = &ID
+ }
+ }
+ }
+
+ return nil
+}
+
+// VirtualMachineImageProperties describes the properties of a Virtual Machine Image.
+type VirtualMachineImageProperties struct {
+ Plan *PurchasePlan `json:"plan,omitempty"`
+ OsDiskImage *OSDiskImage `json:"osDiskImage,omitempty"`
+ DataDiskImages *[]DataDiskImage `json:"dataDiskImages,omitempty"`
+}
+
+// VirtualMachineImageResource virtual machine image resource information.
+type VirtualMachineImageResource struct {
+ // Name - The name of the resource.
+ Name *string `json:"name,omitempty"`
+ // Location - The supported Azure location of the resource.
+ Location *string `json:"location,omitempty"`
+ // Tags - Specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md).
+ Tags map[string]*string `json:"tags"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachineImageResource.
+func (vmir VirtualMachineImageResource) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if vmir.Name != nil {
+ objectMap["name"] = vmir.Name
+ }
+ if vmir.Location != nil {
+ objectMap["location"] = vmir.Location
+ }
+ if vmir.Tags != nil {
+ objectMap["tags"] = vmir.Tags
+ }
+ if vmir.ID != nil {
+ objectMap["id"] = vmir.ID
+ }
+ return json.Marshal(objectMap)
+}
+
+// VirtualMachineInstanceView the instance view of a virtual machine.
+type VirtualMachineInstanceView struct {
+ // PlatformUpdateDomain - Specifies the update domain of the virtual machine.
+ PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"`
+ // PlatformFaultDomain - Specifies the fault domain of the virtual machine.
+ PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"`
+ // RdpThumbPrint - The Remote desktop certificate thumbprint.
+ RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"`
+ // VMAgent - The VM Agent running on the virtual machine.
+ VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"`
+ // Disks - The virtual machine disk information.
+ Disks *[]DiskInstanceView `json:"disks,omitempty"`
+ // Extensions - The extensions information.
+ Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"`
+ // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status.
For Linux Virtual Machines, you can easily view the output of your console log.
For both Windows and Linux virtual machines, Azure also enables you to see a screenshot of the VM from the hypervisor.
+ BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"`
+ // Statuses - The resource status information.
+ Statuses *[]InstanceViewStatus `json:"statuses,omitempty"`
+}
+
+// VirtualMachineListResult the List Virtual Machine operation response.
+type VirtualMachineListResult struct {
+ autorest.Response `json:"-"`
+ // Value - The list of virtual machines.
+ Value *[]VirtualMachine `json:"value,omitempty"`
+ // NextLink - The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch the next page of Virtual Machines.
+ NextLink *string `json:"nextLink,omitempty"`
+}
+
+// VirtualMachineListResultIterator provides access to a complete listing of VirtualMachine values.
+type VirtualMachineListResultIterator struct {
+ i int
+ page VirtualMachineListResultPage
+}
+
+// Next advances to the next value. If there was an error making
+// the request the iterator does not advance and the error is returned.
+func (iter *VirtualMachineListResultIterator) Next() error {
+ iter.i++
+ if iter.i < len(iter.page.Values()) {
+ return nil
+ }
+ err := iter.page.Next()
+ if err != nil {
+ iter.i--
+ return err
+ }
+ iter.i = 0
+ return nil
+}
+
+// NotDone returns true if the enumeration should be started or is not yet complete.
+func (iter VirtualMachineListResultIterator) NotDone() bool {
+ return iter.page.NotDone() && iter.i < len(iter.page.Values())
+}
+
+// Response returns the raw server response from the last page request.
+func (iter VirtualMachineListResultIterator) Response() VirtualMachineListResult {
+ return iter.page.Response()
+}
+
+// Value returns the current value or a zero-initialized value if the
+// iterator has advanced beyond the end of the collection.
+func (iter VirtualMachineListResultIterator) Value() VirtualMachine {
+ if !iter.page.NotDone() {
+ return VirtualMachine{}
+ }
+ return iter.page.Values()[iter.i]
+}
+
+// IsEmpty returns true if the ListResult contains no values.
+func (vmlr VirtualMachineListResult) IsEmpty() bool {
+ return vmlr.Value == nil || len(*vmlr.Value) == 0
+}
+
+// virtualMachineListResultPreparer prepares a request to retrieve the next set of results.
+// It returns nil if no more results exist.
+func (vmlr VirtualMachineListResult) virtualMachineListResultPreparer() (*http.Request, error) {
+ if vmlr.NextLink == nil || len(to.String(vmlr.NextLink)) < 1 {
+ return nil, nil
+ }
+ return autorest.Prepare(&http.Request{},
+ autorest.AsJSON(),
+ autorest.AsGet(),
+ autorest.WithBaseURL(to.String(vmlr.NextLink)))
+}
+
+// VirtualMachineListResultPage contains a page of VirtualMachine values.
+type VirtualMachineListResultPage struct {
+ fn func(VirtualMachineListResult) (VirtualMachineListResult, error)
+ vmlr VirtualMachineListResult
+}
+
+// Next advances to the next page of values. If there was an error making
+// the request the page does not advance and the error is returned.
+func (page *VirtualMachineListResultPage) Next() error {
+ next, err := page.fn(page.vmlr)
+ if err != nil {
+ return err
+ }
+ page.vmlr = next
+ return nil
+}
+
+// NotDone returns true if the page enumeration should be started or is not yet complete.
+func (page VirtualMachineListResultPage) NotDone() bool {
+ return !page.vmlr.IsEmpty()
+}
+
+// Response returns the raw server response from the last page request.
+func (page VirtualMachineListResultPage) Response() VirtualMachineListResult {
+ return page.vmlr
+}
+
+// Values returns the slice of values for the current page or nil if there are no values.
+func (page VirtualMachineListResultPage) Values() []VirtualMachine {
+ if page.vmlr.IsEmpty() {
+ return nil
+ }
+ return *page.vmlr.Value
+}
+
+// VirtualMachineProperties describes the properties of a Virtual Machine.
+type VirtualMachineProperties struct {
+ // HardwareProfile - Specifies the hardware settings for the virtual machine.
+ HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"`
+ // StorageProfile - Specifies the storage settings for the virtual machine disks.
+ StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
+ // OsProfile - Specifies the operating system settings for the virtual machine.
+ OsProfile *OSProfile `json:"osProfile,omitempty"`
+ // NetworkProfile - Specifies the network interfaces of the virtual machine.
+ NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"`
+ // DiagnosticsProfile - Specifies the boot diagnostic settings state.
Minimum api-version: 2015-06-15.
+ DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"`
+ // AvailabilitySet - Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
For more information on Azure planned maintainance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set.
+ AvailabilitySet *SubResource `json:"availabilitySet,omitempty"`
+ // ProvisioningState - The provisioning state, which only appears in the response.
+ ProvisioningState *string `json:"provisioningState,omitempty"`
+ // InstanceView - The virtual machine instance view.
+ InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"`
+ // LicenseType - Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system.
Possible values are:
Windows_Client
Windows_Server
If this element is included in a request for an update, the value must match the initial value. This value cannot be updated.
For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
Minimum api-version: 2015-06-15
+ LicenseType *string `json:"licenseType,omitempty"`
+ // VMID - Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands.
+ VMID *string `json:"vmId,omitempty"`
+}
+
+// VirtualMachineScaleSet describes a Virtual Machine Scale Set.
+type VirtualMachineScaleSet struct {
+ autorest.Response `json:"-"`
+ // Sku - The virtual machine scale set sku.
+ Sku *Sku `json:"sku,omitempty"`
+ // Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**.
+ Plan *Plan `json:"plan,omitempty"`
+ *VirtualMachineScaleSetProperties `json:"properties,omitempty"`
+ // Identity - The identity of the virtual machine scale set, if configured.
+ Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachineScaleSet.
+func (vmss VirtualMachineScaleSet) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if vmss.Sku != nil {
+ objectMap["sku"] = vmss.Sku
+ }
+ if vmss.Plan != nil {
+ objectMap["plan"] = vmss.Plan
+ }
+ if vmss.VirtualMachineScaleSetProperties != nil {
+ objectMap["properties"] = vmss.VirtualMachineScaleSetProperties
+ }
+ if vmss.Identity != nil {
+ objectMap["identity"] = vmss.Identity
+ }
+ if vmss.ID != nil {
+ objectMap["id"] = vmss.ID
+ }
+ if vmss.Name != nil {
+ objectMap["name"] = vmss.Name
+ }
+ if vmss.Type != nil {
+ objectMap["type"] = vmss.Type
+ }
+ if vmss.Location != nil {
+ objectMap["location"] = vmss.Location
+ }
+ if vmss.Tags != nil {
+ objectMap["tags"] = vmss.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSet struct.
+func (vmss *VirtualMachineScaleSet) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "sku":
+ if v != nil {
+ var sku Sku
+ err = json.Unmarshal(*v, &sku)
+ if err != nil {
+ return err
+ }
+ vmss.Sku = &sku
+ }
+ case "plan":
+ if v != nil {
+ var plan Plan
+ err = json.Unmarshal(*v, &plan)
+ if err != nil {
+ return err
+ }
+ vmss.Plan = &plan
+ }
+ case "properties":
+ if v != nil {
+ var virtualMachineScaleSetProperties VirtualMachineScaleSetProperties
+ err = json.Unmarshal(*v, &virtualMachineScaleSetProperties)
+ if err != nil {
+ return err
+ }
+ vmss.VirtualMachineScaleSetProperties = &virtualMachineScaleSetProperties
+ }
+ case "identity":
+ if v != nil {
+ var identity VirtualMachineScaleSetIdentity
+ err = json.Unmarshal(*v, &identity)
+ if err != nil {
+ return err
+ }
+ vmss.Identity = &identity
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ vmss.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ vmss.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ vmss.Type = &typeVar
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ vmss.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ vmss.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// VirtualMachineScaleSetDataDisk describes a virtual machine scale set data disk.
+type VirtualMachineScaleSetDataDisk struct {
+ // Name - The disk name.
+ Name *string `json:"name,omitempty"`
+ // Lun - Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.
+ Lun *int32 `json:"lun,omitempty"`
+ // Caching - Specifies the caching requirements.
Possible values are:
**None**
**ReadOnly**
**ReadWrite**
Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite'
+ Caching CachingTypes `json:"caching,omitempty"`
+ // CreateOption - The create option. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach'
+ CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"`
+ // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.
This value cannot be larger than 1023 GB
+ DiskSizeGB *int32 `json:"diskSizeGB,omitempty"`
+ // ManagedDisk - The managed disk parameters.
+ ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"`
+}
+
+// VirtualMachineScaleSetExtension describes a Virtual Machine Scale Set Extension.
+type VirtualMachineScaleSetExtension struct {
+ // Name - The name of the extension.
+ Name *string `json:"name,omitempty"`
+ *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachineScaleSetExtension.
+func (vmsse VirtualMachineScaleSetExtension) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if vmsse.Name != nil {
+ objectMap["name"] = vmsse.Name
+ }
+ if vmsse.VirtualMachineScaleSetExtensionProperties != nil {
+ objectMap["properties"] = vmsse.VirtualMachineScaleSetExtensionProperties
+ }
+ if vmsse.ID != nil {
+ objectMap["id"] = vmsse.ID
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetExtension struct.
+func (vmsse *VirtualMachineScaleSetExtension) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ vmsse.Name = &name
+ }
+ case "properties":
+ if v != nil {
+ var virtualMachineScaleSetExtensionProperties VirtualMachineScaleSetExtensionProperties
+ err = json.Unmarshal(*v, &virtualMachineScaleSetExtensionProperties)
+ if err != nil {
+ return err
+ }
+ vmsse.VirtualMachineScaleSetExtensionProperties = &virtualMachineScaleSetExtensionProperties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ vmsse.ID = &ID
+ }
+ }
+ }
+
+ return nil
+}
+
+// VirtualMachineScaleSetExtensionProfile describes a virtual machine scale set extension profile.
+type VirtualMachineScaleSetExtensionProfile struct {
+ // Extensions - The virtual machine scale set child extension resources.
+ Extensions *[]VirtualMachineScaleSetExtension `json:"extensions,omitempty"`
+}
+
+// VirtualMachineScaleSetExtensionProperties describes the properties of a Virtual Machine Scale Set Extension.
+type VirtualMachineScaleSetExtensionProperties struct {
+ // Publisher - The name of the extension handler publisher.
+ Publisher *string `json:"publisher,omitempty"`
+ // Type - Specifies the type of the extension; an example is "CustomScriptExtension".
+ Type *string `json:"type,omitempty"`
+ // TypeHandlerVersion - Specifies the version of the script handler.
+ TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"`
+ // AutoUpgradeMinorVersion - Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.
+ AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"`
+ // Settings - Json formatted public settings for the extension.
+ Settings interface{} `json:"settings,omitempty"`
+ // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.
+ ProtectedSettings interface{} `json:"protectedSettings,omitempty"`
+ // ProvisioningState - The provisioning state, which only appears in the response.
+ ProvisioningState *string `json:"provisioningState,omitempty"`
+}
+
+// VirtualMachineScaleSetIdentity identity for the virtual machine scale set.
+type VirtualMachineScaleSetIdentity struct {
+ // PrincipalID - The principal id of virtual machine scale set identity.
+ PrincipalID *string `json:"principalId,omitempty"`
+ // TenantID - The tenant id associated with the virtual machine scale set.
+ TenantID *string `json:"tenantId,omitempty"`
+ // Type - The type of identity used for the virtual machine scale set. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. Possible values include: 'SystemAssigned'
+ Type ResourceIdentityType `json:"type,omitempty"`
+}
+
+// VirtualMachineScaleSetInstanceView the instance view of a virtual machine scale set.
+type VirtualMachineScaleSetInstanceView struct {
+ autorest.Response `json:"-"`
+ // VirtualMachine - The instance view status summary for the virtual machine scale set.
+ VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary `json:"virtualMachine,omitempty"`
+ // Extensions - The extensions information.
+ Extensions *[]VirtualMachineScaleSetVMExtensionsSummary `json:"extensions,omitempty"`
+ // Statuses - The resource status information.
+ Statuses *[]InstanceViewStatus `json:"statuses,omitempty"`
+}
+
+// VirtualMachineScaleSetInstanceViewStatusesSummary instance view statuses summary for virtual machines of a
+// virtual machine scale set.
+type VirtualMachineScaleSetInstanceViewStatusesSummary struct {
+ // StatusesSummary - The extensions information.
+ StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"`
+}
+
+// VirtualMachineScaleSetIPConfiguration describes a virtual machine scale set network profile's IP configuration.
+type VirtualMachineScaleSetIPConfiguration struct {
+ // Name - The IP configuration name.
+ Name *string `json:"name,omitempty"`
+ *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachineScaleSetIPConfiguration.
+func (vmssic VirtualMachineScaleSetIPConfiguration) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if vmssic.Name != nil {
+ objectMap["name"] = vmssic.Name
+ }
+ if vmssic.VirtualMachineScaleSetIPConfigurationProperties != nil {
+ objectMap["properties"] = vmssic.VirtualMachineScaleSetIPConfigurationProperties
+ }
+ if vmssic.ID != nil {
+ objectMap["id"] = vmssic.ID
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetIPConfiguration struct.
+func (vmssic *VirtualMachineScaleSetIPConfiguration) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ vmssic.Name = &name
+ }
+ case "properties":
+ if v != nil {
+ var virtualMachineScaleSetIPConfigurationProperties VirtualMachineScaleSetIPConfigurationProperties
+ err = json.Unmarshal(*v, &virtualMachineScaleSetIPConfigurationProperties)
+ if err != nil {
+ return err
+ }
+ vmssic.VirtualMachineScaleSetIPConfigurationProperties = &virtualMachineScaleSetIPConfigurationProperties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ vmssic.ID = &ID
+ }
+ }
+ }
+
+ return nil
+}
+
+// VirtualMachineScaleSetIPConfigurationProperties describes a virtual machine scale set network profile's IP
+// configuration properties.
+type VirtualMachineScaleSetIPConfigurationProperties struct {
+ // Subnet - The subnet.
+ Subnet *APIEntityReference `json:"subnet,omitempty"`
+ // ApplicationGatewayBackendAddressPools - The application gateway backend address pools.
+ ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"`
+ // LoadBalancerBackendAddressPools - The load balancer backend address pools.
+ LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"`
+ // LoadBalancerInboundNatPools - The load balancer inbound nat pools.
+ LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"`
+}
+
+// VirtualMachineScaleSetListResult the List Virtual Machine operation response.
+type VirtualMachineScaleSetListResult struct {
+ autorest.Response `json:"-"`
+ // Value - The list of virtual machine scale sets.
+ Value *[]VirtualMachineScaleSet `json:"value,omitempty"`
+ // NextLink - The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with this to fetch the next page of VMSS.
+ NextLink *string `json:"nextLink,omitempty"`
+}
+
+// VirtualMachineScaleSetListResultIterator provides access to a complete listing of VirtualMachineScaleSet values.
+type VirtualMachineScaleSetListResultIterator struct {
+ i int
+ page VirtualMachineScaleSetListResultPage
+}
+
+// Next advances to the next value. If there was an error making
+// the request the iterator does not advance and the error is returned.
+func (iter *VirtualMachineScaleSetListResultIterator) Next() error {
+ iter.i++
+ if iter.i < len(iter.page.Values()) {
+ return nil
+ }
+ err := iter.page.Next()
+ if err != nil {
+ iter.i--
+ return err
+ }
+ iter.i = 0
+ return nil
+}
+
+// NotDone returns true if the enumeration should be started or is not yet complete.
+func (iter VirtualMachineScaleSetListResultIterator) NotDone() bool {
+ return iter.page.NotDone() && iter.i < len(iter.page.Values())
+}
+
+// Response returns the raw server response from the last page request.
+func (iter VirtualMachineScaleSetListResultIterator) Response() VirtualMachineScaleSetListResult {
+ return iter.page.Response()
+}
+
+// Value returns the current value or a zero-initialized value if the
+// iterator has advanced beyond the end of the collection.
+func (iter VirtualMachineScaleSetListResultIterator) Value() VirtualMachineScaleSet {
+ if !iter.page.NotDone() {
+ return VirtualMachineScaleSet{}
+ }
+ return iter.page.Values()[iter.i]
+}
+
+// IsEmpty returns true if the ListResult contains no values.
+func (vmsslr VirtualMachineScaleSetListResult) IsEmpty() bool {
+ return vmsslr.Value == nil || len(*vmsslr.Value) == 0
+}
+
+// virtualMachineScaleSetListResultPreparer prepares a request to retrieve the next set of results.
+// It returns nil if no more results exist.
+func (vmsslr VirtualMachineScaleSetListResult) virtualMachineScaleSetListResultPreparer() (*http.Request, error) {
+ if vmsslr.NextLink == nil || len(to.String(vmsslr.NextLink)) < 1 {
+ return nil, nil
+ }
+ return autorest.Prepare(&http.Request{},
+ autorest.AsJSON(),
+ autorest.AsGet(),
+ autorest.WithBaseURL(to.String(vmsslr.NextLink)))
+}
+
+// VirtualMachineScaleSetListResultPage contains a page of VirtualMachineScaleSet values.
+type VirtualMachineScaleSetListResultPage struct {
+ fn func(VirtualMachineScaleSetListResult) (VirtualMachineScaleSetListResult, error)
+ vmsslr VirtualMachineScaleSetListResult
+}
+
+// Next advances to the next page of values. If there was an error making
+// the request the page does not advance and the error is returned.
+func (page *VirtualMachineScaleSetListResultPage) Next() error {
+ next, err := page.fn(page.vmsslr)
+ if err != nil {
+ return err
+ }
+ page.vmsslr = next
+ return nil
+}
+
+// NotDone returns true if the page enumeration should be started or is not yet complete.
+func (page VirtualMachineScaleSetListResultPage) NotDone() bool {
+ return !page.vmsslr.IsEmpty()
+}
+
+// Response returns the raw server response from the last page request.
+func (page VirtualMachineScaleSetListResultPage) Response() VirtualMachineScaleSetListResult {
+ return page.vmsslr
+}
+
+// Values returns the slice of values for the current page or nil if there are no values.
+func (page VirtualMachineScaleSetListResultPage) Values() []VirtualMachineScaleSet {
+ if page.vmsslr.IsEmpty() {
+ return nil
+ }
+ return *page.vmsslr.Value
+}
+
+// VirtualMachineScaleSetListSkusResult the Virtual Machine Scale Set List Skus operation response.
+type VirtualMachineScaleSetListSkusResult struct {
+ autorest.Response `json:"-"`
+ // Value - The list of skus available for the virtual machine scale set.
+ Value *[]VirtualMachineScaleSetSku `json:"value,omitempty"`
+ // NextLink - The uri to fetch the next page of Virtual Machine Scale Set Skus. Call ListNext() with this to fetch the next page of VMSS Skus.
+ NextLink *string `json:"nextLink,omitempty"`
+}
+
+// VirtualMachineScaleSetListSkusResultIterator provides access to a complete listing of VirtualMachineScaleSetSku
+// values.
+type VirtualMachineScaleSetListSkusResultIterator struct {
+ i int
+ page VirtualMachineScaleSetListSkusResultPage
+}
+
+// Next advances to the next value. If there was an error making
+// the request the iterator does not advance and the error is returned.
+func (iter *VirtualMachineScaleSetListSkusResultIterator) Next() error {
+ iter.i++
+ if iter.i < len(iter.page.Values()) {
+ return nil
+ }
+ err := iter.page.Next()
+ if err != nil {
+ iter.i--
+ return err
+ }
+ iter.i = 0
+ return nil
+}
+
+// NotDone returns true if the enumeration should be started or is not yet complete.
+func (iter VirtualMachineScaleSetListSkusResultIterator) NotDone() bool {
+ return iter.page.NotDone() && iter.i < len(iter.page.Values())
+}
+
+// Response returns the raw server response from the last page request.
+func (iter VirtualMachineScaleSetListSkusResultIterator) Response() VirtualMachineScaleSetListSkusResult {
+ return iter.page.Response()
+}
+
+// Value returns the current value or a zero-initialized value if the
+// iterator has advanced beyond the end of the collection.
+func (iter VirtualMachineScaleSetListSkusResultIterator) Value() VirtualMachineScaleSetSku {
+ if !iter.page.NotDone() {
+ return VirtualMachineScaleSetSku{}
+ }
+ return iter.page.Values()[iter.i]
+}
+
+// IsEmpty returns true if the ListResult contains no values.
+func (vmsslsr VirtualMachineScaleSetListSkusResult) IsEmpty() bool {
+ return vmsslsr.Value == nil || len(*vmsslsr.Value) == 0
+}
+
+// virtualMachineScaleSetListSkusResultPreparer prepares a request to retrieve the next set of results.
+// It returns nil if no more results exist.
+func (vmsslsr VirtualMachineScaleSetListSkusResult) virtualMachineScaleSetListSkusResultPreparer() (*http.Request, error) {
+ if vmsslsr.NextLink == nil || len(to.String(vmsslsr.NextLink)) < 1 {
+ return nil, nil
+ }
+ return autorest.Prepare(&http.Request{},
+ autorest.AsJSON(),
+ autorest.AsGet(),
+ autorest.WithBaseURL(to.String(vmsslsr.NextLink)))
+}
+
+// VirtualMachineScaleSetListSkusResultPage contains a page of VirtualMachineScaleSetSku values.
+type VirtualMachineScaleSetListSkusResultPage struct {
+ fn func(VirtualMachineScaleSetListSkusResult) (VirtualMachineScaleSetListSkusResult, error)
+ vmsslsr VirtualMachineScaleSetListSkusResult
+}
+
+// Next advances to the next page of values. If there was an error making
+// the request the page does not advance and the error is returned.
+func (page *VirtualMachineScaleSetListSkusResultPage) Next() error {
+ next, err := page.fn(page.vmsslsr)
+ if err != nil {
+ return err
+ }
+ page.vmsslsr = next
+ return nil
+}
+
+// NotDone returns true if the page enumeration should be started or is not yet complete.
+func (page VirtualMachineScaleSetListSkusResultPage) NotDone() bool {
+ return !page.vmsslsr.IsEmpty()
+}
+
+// Response returns the raw server response from the last page request.
+func (page VirtualMachineScaleSetListSkusResultPage) Response() VirtualMachineScaleSetListSkusResult {
+ return page.vmsslsr
+}
+
+// Values returns the slice of values for the current page or nil if there are no values.
+func (page VirtualMachineScaleSetListSkusResultPage) Values() []VirtualMachineScaleSetSku {
+ if page.vmsslsr.IsEmpty() {
+ return nil
+ }
+ return *page.vmsslsr.Value
+}
+
+// VirtualMachineScaleSetListWithLinkResult the List Virtual Machine operation response.
+type VirtualMachineScaleSetListWithLinkResult struct {
+ autorest.Response `json:"-"`
+ // Value - The list of virtual machine scale sets.
+ Value *[]VirtualMachineScaleSet `json:"value,omitempty"`
+ // NextLink - The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with this to fetch the next page of Virtual Machine Scale Sets.
+ NextLink *string `json:"nextLink,omitempty"`
+}
+
+// VirtualMachineScaleSetListWithLinkResultIterator provides access to a complete listing of VirtualMachineScaleSet
+// values.
+type VirtualMachineScaleSetListWithLinkResultIterator struct {
+ i int
+ page VirtualMachineScaleSetListWithLinkResultPage
+}
+
+// Next advances to the next value. If there was an error making
+// the request the iterator does not advance and the error is returned.
+func (iter *VirtualMachineScaleSetListWithLinkResultIterator) Next() error {
+ iter.i++
+ if iter.i < len(iter.page.Values()) {
+ return nil
+ }
+ err := iter.page.Next()
+ if err != nil {
+ iter.i--
+ return err
+ }
+ iter.i = 0
+ return nil
+}
+
+// NotDone returns true if the enumeration should be started or is not yet complete.
+func (iter VirtualMachineScaleSetListWithLinkResultIterator) NotDone() bool {
+ return iter.page.NotDone() && iter.i < len(iter.page.Values())
+}
+
+// Response returns the raw server response from the last page request.
+func (iter VirtualMachineScaleSetListWithLinkResultIterator) Response() VirtualMachineScaleSetListWithLinkResult {
+ return iter.page.Response()
+}
+
+// Value returns the current value or a zero-initialized value if the
+// iterator has advanced beyond the end of the collection.
+func (iter VirtualMachineScaleSetListWithLinkResultIterator) Value() VirtualMachineScaleSet {
+ if !iter.page.NotDone() {
+ return VirtualMachineScaleSet{}
+ }
+ return iter.page.Values()[iter.i]
+}
+
+// IsEmpty returns true if the ListResult contains no values.
+func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) IsEmpty() bool {
+ return vmsslwlr.Value == nil || len(*vmsslwlr.Value) == 0
+}
+
+// virtualMachineScaleSetListWithLinkResultPreparer prepares a request to retrieve the next set of results.
+// It returns nil if no more results exist.
+func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) virtualMachineScaleSetListWithLinkResultPreparer() (*http.Request, error) {
+ if vmsslwlr.NextLink == nil || len(to.String(vmsslwlr.NextLink)) < 1 {
+ return nil, nil
+ }
+ return autorest.Prepare(&http.Request{},
+ autorest.AsJSON(),
+ autorest.AsGet(),
+ autorest.WithBaseURL(to.String(vmsslwlr.NextLink)))
+}
+
+// VirtualMachineScaleSetListWithLinkResultPage contains a page of VirtualMachineScaleSet values.
+type VirtualMachineScaleSetListWithLinkResultPage struct {
+ fn func(VirtualMachineScaleSetListWithLinkResult) (VirtualMachineScaleSetListWithLinkResult, error)
+ vmsslwlr VirtualMachineScaleSetListWithLinkResult
+}
+
+// Next advances to the next page of values. If there was an error making
+// the request the page does not advance and the error is returned.
+func (page *VirtualMachineScaleSetListWithLinkResultPage) Next() error {
+ next, err := page.fn(page.vmsslwlr)
+ if err != nil {
+ return err
+ }
+ page.vmsslwlr = next
+ return nil
+}
+
+// NotDone returns true if the page enumeration should be started or is not yet complete.
+func (page VirtualMachineScaleSetListWithLinkResultPage) NotDone() bool {
+ return !page.vmsslwlr.IsEmpty()
+}
+
+// Response returns the raw server response from the last page request.
+func (page VirtualMachineScaleSetListWithLinkResultPage) Response() VirtualMachineScaleSetListWithLinkResult {
+ return page.vmsslwlr
+}
+
+// Values returns the slice of values for the current page or nil if there are no values.
+func (page VirtualMachineScaleSetListWithLinkResultPage) Values() []VirtualMachineScaleSet {
+ if page.vmsslwlr.IsEmpty() {
+ return nil
+ }
+ return *page.vmsslwlr.Value
+}
+
+// VirtualMachineScaleSetManagedDiskParameters describes the parameters of a ScaleSet managed disk.
+type VirtualMachineScaleSetManagedDiskParameters struct {
+ // StorageAccountType - Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'StandardLRS', 'PremiumLRS'
+ StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"`
+}
+
+// VirtualMachineScaleSetNetworkConfiguration describes a virtual machine scale set network profile's network
+// configurations.
+type VirtualMachineScaleSetNetworkConfiguration struct {
+ // Name - The network configuration name.
+ Name *string `json:"name,omitempty"`
+ *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachineScaleSetNetworkConfiguration.
+func (vmssnc VirtualMachineScaleSetNetworkConfiguration) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if vmssnc.Name != nil {
+ objectMap["name"] = vmssnc.Name
+ }
+ if vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties != nil {
+ objectMap["properties"] = vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties
+ }
+ if vmssnc.ID != nil {
+ objectMap["id"] = vmssnc.ID
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetNetworkConfiguration struct.
+func (vmssnc *VirtualMachineScaleSetNetworkConfiguration) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ vmssnc.Name = &name
+ }
+ case "properties":
+ if v != nil {
+ var virtualMachineScaleSetNetworkConfigurationProperties VirtualMachineScaleSetNetworkConfigurationProperties
+ err = json.Unmarshal(*v, &virtualMachineScaleSetNetworkConfigurationProperties)
+ if err != nil {
+ return err
+ }
+ vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties = &virtualMachineScaleSetNetworkConfigurationProperties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ vmssnc.ID = &ID
+ }
+ }
+ }
+
+ return nil
+}
+
+// VirtualMachineScaleSetNetworkConfigurationProperties describes a virtual machine scale set network profile's IP
+// configuration.
+type VirtualMachineScaleSetNetworkConfigurationProperties struct {
+ // Primary - Whether this is a primary NIC on a virtual machine.
+ Primary *bool `json:"primary,omitempty"`
+ // IPConfigurations - The virtual machine scale set IP Configuration.
+ IPConfigurations *[]VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations,omitempty"`
+}
+
+// VirtualMachineScaleSetNetworkProfile describes a virtual machine scale set network profile.
+type VirtualMachineScaleSetNetworkProfile struct {
+ // NetworkInterfaceConfigurations - The list of network configurations.
+ NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"`
+}
+
+// VirtualMachineScaleSetOSDisk describes a virtual machine scale set operating system disk.
+type VirtualMachineScaleSetOSDisk struct {
+ // Name - The disk name.
+ Name *string `json:"name,omitempty"`
+ // Caching - Specifies the caching requirements.
Possible values are:
**None**
**ReadOnly**
**ReadWrite**
Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite'
+ Caching CachingTypes `json:"caching,omitempty"`
+ // CreateOption - Specifies how the virtual machines in the scale set should be created.
The only allowed value is: **FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach'
+ CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"`
+ // OsType - This property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD.
Possible values are:
**Windows**
**Linux**. Possible values include: 'Windows', 'Linux'
+ OsType OperatingSystemTypes `json:"osType,omitempty"`
+ // Image - The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before using it to attach to the Virtual Machine. If SourceImage is provided, the destination VirtualHardDisk should not exist.
+ Image *VirtualHardDisk `json:"image,omitempty"`
+ // VhdContainers - The list of virtual hard disk container uris.
+ VhdContainers *[]string `json:"vhdContainers,omitempty"`
+ // ManagedDisk - The managed disk parameters.
+ ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"`
+}
+
+// VirtualMachineScaleSetOSProfile describes a virtual machine scale set OS profile.
+type VirtualMachineScaleSetOSProfile struct {
+ // ComputerNamePrefix - Specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to 15 characters long.
+ ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"`
+ // AdminUsername - Specifies the name of the administrator account.
**Windows-only restriction:** Cannot end in "."
**Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".
**Minimum-length (Linux):** 1 character
**Max-length (Linux):** 64 characters
**Max-length (Windows):** 20 characters
For root access to the Linux VM, see [Using root privileges on Linux virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
For a list of built-in system users on Linux that should not be used in this field, see [Selecting User Names for Linux on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
+ AdminUsername *string `json:"adminUsername,omitempty"`
+ // AdminPassword - Specifies the password of the administrator account.
**Minimum-length (Windows):** 8 characters
**Minimum-length (Linux):** 6 characters
**Max-length (Windows):** 123 characters
**Max-length (Linux):** 72 characters
**Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has upper characters
Has a digit
Has a special character (Regex match [\W_])
**Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"
For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password)
+ AdminPassword *string `json:"adminPassword,omitempty"`
+ // CustomData - A base-64 encoded string of custom data.
+ CustomData *string `json:"customData,omitempty"`
+ // WindowsConfiguration - The Windows Configuration of the OS profile.
+ WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"`
+ // LinuxConfiguration - The Linux Configuration of the OS profile.
+ LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"`
+ // Secrets - The List of certificates for addition to the VM.
+ Secrets *[]VaultSecretGroup `json:"secrets,omitempty"`
+}
+
+// VirtualMachineScaleSetProperties describes the properties of a Virtual Machine Scale Set.
+type VirtualMachineScaleSetProperties struct {
+ // UpgradePolicy - The upgrade policy.
+ UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"`
+ // VirtualMachineProfile - The virtual machine profile.
+ VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"`
+ // ProvisioningState - The provisioning state, which only appears in the response.
+ ProvisioningState *string `json:"provisioningState,omitempty"`
+ // OverProvision - Specifies whether the Virtual Machine Scale Set should be overprovisioned.
+ OverProvision *bool `json:"overProvision,omitempty"`
+ // SinglePlacementGroup - When true this limits the scale set to a single placement group, of max size 100 virtual machines.
+ SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"`
+}
+
+// VirtualMachineScaleSetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachineScaleSetsCreateOrUpdateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetsCreateOrUpdateFuture) Result(client VirtualMachineScaleSetsClient) (vmss VirtualMachineScaleSet, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return vmss, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsCreateOrUpdateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ vmss, err = client.CreateOrUpdateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ vmss, err = client.CreateOrUpdateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetsDeallocateFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachineScaleSetsDeallocateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetsDeallocateFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeallocateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.DeallocateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.DeallocateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachineScaleSetsDeleteFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetsDeleteFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.DeleteResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.DeleteResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetsDeleteInstancesFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachineScaleSetsDeleteInstancesFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetsDeleteInstancesFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteInstancesFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.DeleteInstancesResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.DeleteInstancesResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetSku describes an available virtual machine scale set sku.
+type VirtualMachineScaleSetSku struct {
+ // ResourceType - The type of resource the sku applies to.
+ ResourceType *string `json:"resourceType,omitempty"`
+ // Sku - The Sku.
+ Sku *Sku `json:"sku,omitempty"`
+ // Capacity - Specifies the number of virtual machines in the scale set.
+ Capacity *VirtualMachineScaleSetSkuCapacity `json:"capacity,omitempty"`
+}
+
+// VirtualMachineScaleSetSkuCapacity describes scaling information of a sku.
+type VirtualMachineScaleSetSkuCapacity struct {
+ // Minimum - The minimum capacity.
+ Minimum *int64 `json:"minimum,omitempty"`
+ // Maximum - The maximum capacity that can be set.
+ Maximum *int64 `json:"maximum,omitempty"`
+ // DefaultCapacity - The default capacity.
+ DefaultCapacity *int64 `json:"defaultCapacity,omitempty"`
+ // ScaleType - The scale type applicable to the sku. Possible values include: 'VirtualMachineScaleSetSkuScaleTypeAutomatic', 'VirtualMachineScaleSetSkuScaleTypeNone'
+ ScaleType VirtualMachineScaleSetSkuScaleType `json:"scaleType,omitempty"`
+}
+
+// VirtualMachineScaleSetsPowerOffFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachineScaleSetsPowerOffFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetsPowerOffFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsPowerOffFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.PowerOffResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.PowerOffResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetsReimageAllFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachineScaleSetsReimageAllFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetsReimageAllFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageAllFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.ReimageAllResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.ReimageAllResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetsReimageFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachineScaleSetsReimageFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetsReimageFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.ReimageResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.ReimageResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetsRestartFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachineScaleSetsRestartFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetsRestartFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsRestartFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.RestartResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.RestartResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetsStartFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachineScaleSetsStartFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetsStartFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsStartFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.StartResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.StartResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetStorageProfile describes a virtual machine scale set storage profile.
+type VirtualMachineScaleSetStorageProfile struct {
+ // ImageReference - The image reference.
+ ImageReference *ImageReference `json:"imageReference,omitempty"`
+ // OsDisk - The OS disk.
+ OsDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"`
+ // DataDisks - The data disks.
+ DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"`
+}
+
+// VirtualMachineScaleSetsUpdateInstancesFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachineScaleSetsUpdateInstancesFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetsUpdateInstancesFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsUpdateInstancesFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.UpdateInstancesResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.UpdateInstancesResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetVM describes a virtual machine scale set virtual machine.
+type VirtualMachineScaleSetVM struct {
+ autorest.Response `json:"-"`
+ // InstanceID - The virtual machine instance ID.
+ InstanceID *string `json:"instanceId,omitempty"`
+ // Sku - The virtual machine SKU.
+ Sku *Sku `json:"sku,omitempty"`
+ *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"`
+ // Plan - Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**.
+ Plan *Plan `json:"plan,omitempty"`
+ // Resources - The virtual machine child extension resources.
+ Resources *[]VirtualMachineExtension `json:"resources,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for VirtualMachineScaleSetVM.
+func (vmssv VirtualMachineScaleSetVM) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if vmssv.InstanceID != nil {
+ objectMap["instanceId"] = vmssv.InstanceID
+ }
+ if vmssv.Sku != nil {
+ objectMap["sku"] = vmssv.Sku
+ }
+ if vmssv.VirtualMachineScaleSetVMProperties != nil {
+ objectMap["properties"] = vmssv.VirtualMachineScaleSetVMProperties
+ }
+ if vmssv.Plan != nil {
+ objectMap["plan"] = vmssv.Plan
+ }
+ if vmssv.Resources != nil {
+ objectMap["resources"] = vmssv.Resources
+ }
+ if vmssv.ID != nil {
+ objectMap["id"] = vmssv.ID
+ }
+ if vmssv.Name != nil {
+ objectMap["name"] = vmssv.Name
+ }
+ if vmssv.Type != nil {
+ objectMap["type"] = vmssv.Type
+ }
+ if vmssv.Location != nil {
+ objectMap["location"] = vmssv.Location
+ }
+ if vmssv.Tags != nil {
+ objectMap["tags"] = vmssv.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetVM struct.
+func (vmssv *VirtualMachineScaleSetVM) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "instanceId":
+ if v != nil {
+ var instanceID string
+ err = json.Unmarshal(*v, &instanceID)
+ if err != nil {
+ return err
+ }
+ vmssv.InstanceID = &instanceID
+ }
+ case "sku":
+ if v != nil {
+ var sku Sku
+ err = json.Unmarshal(*v, &sku)
+ if err != nil {
+ return err
+ }
+ vmssv.Sku = &sku
+ }
+ case "properties":
+ if v != nil {
+ var virtualMachineScaleSetVMProperties VirtualMachineScaleSetVMProperties
+ err = json.Unmarshal(*v, &virtualMachineScaleSetVMProperties)
+ if err != nil {
+ return err
+ }
+ vmssv.VirtualMachineScaleSetVMProperties = &virtualMachineScaleSetVMProperties
+ }
+ case "plan":
+ if v != nil {
+ var plan Plan
+ err = json.Unmarshal(*v, &plan)
+ if err != nil {
+ return err
+ }
+ vmssv.Plan = &plan
+ }
+ case "resources":
+ if v != nil {
+ var resources []VirtualMachineExtension
+ err = json.Unmarshal(*v, &resources)
+ if err != nil {
+ return err
+ }
+ vmssv.Resources = &resources
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ vmssv.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ vmssv.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ vmssv.Type = &typeVar
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ vmssv.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ vmssv.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// VirtualMachineScaleSetVMExtensionsSummary extensions summary for virtual machines of a virtual machine scale
+// set.
+type VirtualMachineScaleSetVMExtensionsSummary struct {
+ // Name - The extension name.
+ Name *string `json:"name,omitempty"`
+ // StatusesSummary - The extensions information.
+ StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"`
+}
+
+// VirtualMachineScaleSetVMInstanceIDs specifies a list of virtual machine instance IDs from the VM scale set.
+type VirtualMachineScaleSetVMInstanceIDs struct {
+ // InstanceIds - The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set.
+ InstanceIds *[]string `json:"instanceIds,omitempty"`
+}
+
+// VirtualMachineScaleSetVMInstanceRequiredIDs specifies a list of virtual machine instance IDs from the VM scale
+// set.
+type VirtualMachineScaleSetVMInstanceRequiredIDs struct {
+ // InstanceIds - The virtual machine scale set instance ids.
+ InstanceIds *[]string `json:"instanceIds,omitempty"`
+}
+
+// VirtualMachineScaleSetVMInstanceView the instance view of a virtual machine scale set VM.
+type VirtualMachineScaleSetVMInstanceView struct {
+ autorest.Response `json:"-"`
+ // PlatformUpdateDomain - The Update Domain count.
+ PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"`
+ // PlatformFaultDomain - The Fault Domain count.
+ PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"`
+ // RdpThumbPrint - The Remote desktop certificate thumbprint.
+ RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"`
+ // VMAgent - The VM Agent running on the virtual machine.
+ VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"`
+ // Disks - The disks information.
+ Disks *[]DiskInstanceView `json:"disks,omitempty"`
+ // Extensions - The extensions information.
+ Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"`
+ // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status.
For Linux Virtual Machines, you can easily view the output of your console log.
For both Windows and Linux virtual machines, Azure also enables you to see a screenshot of the VM from the hypervisor.
+ BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"`
+ // Statuses - The resource status information.
+ Statuses *[]InstanceViewStatus `json:"statuses,omitempty"`
+ // PlacementGroupID - The placement group in which the VM is running. If the VM is deallocated it will not have a placementGroupId.
+ PlacementGroupID *string `json:"placementGroupId,omitempty"`
+}
+
+// VirtualMachineScaleSetVMListResult the List Virtual Machine Scale Set VMs operation response.
+type VirtualMachineScaleSetVMListResult struct {
+ autorest.Response `json:"-"`
+ // Value - The list of virtual machine scale sets VMs.
+ Value *[]VirtualMachineScaleSetVM `json:"value,omitempty"`
+ // NextLink - The uri to fetch the next page of Virtual Machine Scale Set VMs. Call ListNext() with this to fetch the next page of VMSS VMs
+ NextLink *string `json:"nextLink,omitempty"`
+}
+
+// VirtualMachineScaleSetVMListResultIterator provides access to a complete listing of VirtualMachineScaleSetVM
+// values.
+type VirtualMachineScaleSetVMListResultIterator struct {
+ i int
+ page VirtualMachineScaleSetVMListResultPage
+}
+
+// Next advances to the next value. If there was an error making
+// the request the iterator does not advance and the error is returned.
+func (iter *VirtualMachineScaleSetVMListResultIterator) Next() error {
+ iter.i++
+ if iter.i < len(iter.page.Values()) {
+ return nil
+ }
+ err := iter.page.Next()
+ if err != nil {
+ iter.i--
+ return err
+ }
+ iter.i = 0
+ return nil
+}
+
+// NotDone returns true if the enumeration should be started or is not yet complete.
+func (iter VirtualMachineScaleSetVMListResultIterator) NotDone() bool {
+ return iter.page.NotDone() && iter.i < len(iter.page.Values())
+}
+
+// Response returns the raw server response from the last page request.
+func (iter VirtualMachineScaleSetVMListResultIterator) Response() VirtualMachineScaleSetVMListResult {
+ return iter.page.Response()
+}
+
+// Value returns the current value or a zero-initialized value if the
+// iterator has advanced beyond the end of the collection.
+func (iter VirtualMachineScaleSetVMListResultIterator) Value() VirtualMachineScaleSetVM {
+ if !iter.page.NotDone() {
+ return VirtualMachineScaleSetVM{}
+ }
+ return iter.page.Values()[iter.i]
+}
+
+// IsEmpty returns true if the ListResult contains no values.
+func (vmssvlr VirtualMachineScaleSetVMListResult) IsEmpty() bool {
+ return vmssvlr.Value == nil || len(*vmssvlr.Value) == 0
+}
+
+// virtualMachineScaleSetVMListResultPreparer prepares a request to retrieve the next set of results.
+// It returns nil if no more results exist.
+func (vmssvlr VirtualMachineScaleSetVMListResult) virtualMachineScaleSetVMListResultPreparer() (*http.Request, error) {
+ if vmssvlr.NextLink == nil || len(to.String(vmssvlr.NextLink)) < 1 {
+ return nil, nil
+ }
+ return autorest.Prepare(&http.Request{},
+ autorest.AsJSON(),
+ autorest.AsGet(),
+ autorest.WithBaseURL(to.String(vmssvlr.NextLink)))
+}
+
+// VirtualMachineScaleSetVMListResultPage contains a page of VirtualMachineScaleSetVM values.
+type VirtualMachineScaleSetVMListResultPage struct {
+ fn func(VirtualMachineScaleSetVMListResult) (VirtualMachineScaleSetVMListResult, error)
+ vmssvlr VirtualMachineScaleSetVMListResult
+}
+
+// Next advances to the next page of values. If there was an error making
+// the request the page does not advance and the error is returned.
+func (page *VirtualMachineScaleSetVMListResultPage) Next() error {
+ next, err := page.fn(page.vmssvlr)
+ if err != nil {
+ return err
+ }
+ page.vmssvlr = next
+ return nil
+}
+
+// NotDone returns true if the page enumeration should be started or is not yet complete.
+func (page VirtualMachineScaleSetVMListResultPage) NotDone() bool {
+ return !page.vmssvlr.IsEmpty()
+}
+
+// Response returns the raw server response from the last page request.
+func (page VirtualMachineScaleSetVMListResultPage) Response() VirtualMachineScaleSetVMListResult {
+ return page.vmssvlr
+}
+
+// Values returns the slice of values for the current page or nil if there are no values.
+func (page VirtualMachineScaleSetVMListResultPage) Values() []VirtualMachineScaleSetVM {
+ if page.vmssvlr.IsEmpty() {
+ return nil
+ }
+ return *page.vmssvlr.Value
+}
+
+// VirtualMachineScaleSetVMProfile describes a virtual machine scale set virtual machine profile.
+type VirtualMachineScaleSetVMProfile struct {
+ // OsProfile - The virtual machine scale set OS profile.
+ OsProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"`
+ // StorageProfile - The virtual machine scale set storage profile.
+ StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"`
+ // NetworkProfile - The virtual machine scale set network profile.
+ NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"`
+ // ExtensionProfile - The virtual machine scale set extension profile.
+ ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"`
+}
+
+// VirtualMachineScaleSetVMProperties describes the properties of a virtual machine scale set virtual machine.
+type VirtualMachineScaleSetVMProperties struct {
+ // LatestModelApplied - Specifies whether the latest model has been applied to the virtual machine.
+ LatestModelApplied *bool `json:"latestModelApplied,omitempty"`
+ // VMID - Azure VM unique ID.
+ VMID *string `json:"vmId,omitempty"`
+ // InstanceView - The virtual machine instance view.
+ InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"`
+ // HardwareProfile - Specifies the hardware settings for the virtual machine.
+ HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"`
+ // StorageProfile - Specifies the storage settings for the virtual machine disks.
+ StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
+ // OsProfile - Specifies the operating system settings for the virtual machine.
+ OsProfile *OSProfile `json:"osProfile,omitempty"`
+ // NetworkProfile - Specifies the network interfaces of the virtual machine.
+ NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"`
+ // DiagnosticsProfile - Specifies the boot diagnostic settings state.
Minimum api-version: 2015-06-15.
+ DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"`
+ // AvailabilitySet - Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
For more information on Azure planned maintainance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set.
+ AvailabilitySet *SubResource `json:"availabilitySet,omitempty"`
+ // ProvisioningState - The provisioning state, which only appears in the response.
+ ProvisioningState *string `json:"provisioningState,omitempty"`
+ // LicenseType - Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system.
Possible values are:
Windows_Client
Windows_Server
If this element is included in a request for an update, the value must match the initial value. This value cannot be updated.
For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
Minimum api-version: 2015-06-15
+ LicenseType *string `json:"licenseType,omitempty"`
+}
+
+// VirtualMachineScaleSetVMsDeallocateFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachineScaleSetVMsDeallocateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetVMsDeallocateFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeallocateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.DeallocateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.DeallocateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetVMsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachineScaleSetVMsDeleteFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetVMsDeleteFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeleteFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.DeleteResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.DeleteResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetVMsPowerOffFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachineScaleSetVMsPowerOffFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetVMsPowerOffFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsPowerOffFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.PowerOffResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.PowerOffResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetVMsReimageAllFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachineScaleSetVMsReimageAllFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetVMsReimageAllFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageAllFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.ReimageAllResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.ReimageAllResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetVMsReimageFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachineScaleSetVMsReimageFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetVMsReimageFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.ReimageResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.ReimageResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetVMsRestartFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachineScaleSetVMsRestartFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetVMsRestartFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRestartFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.RestartResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.RestartResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineScaleSetVMsStartFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachineScaleSetVMsStartFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachineScaleSetVMsStartFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsStartFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.StartResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.StartResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachinesCaptureFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachinesCaptureFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachinesCaptureFuture) Result(client VirtualMachinesClient) (vmcr VirtualMachineCaptureResult, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return vmcr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCaptureFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ vmcr, err = client.CaptureResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ vmcr, err = client.CaptureResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachinesConvertToManagedDisksFuture an abstraction for monitoring and retrieving the results of a
+// long-running operation.
+type VirtualMachinesConvertToManagedDisksFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachinesConvertToManagedDisksFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesConvertToManagedDisksFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.ConvertToManagedDisksResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.ConvertToManagedDisksResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachinesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachinesCreateOrUpdateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachinesCreateOrUpdateFuture) Result(client VirtualMachinesClient) (VM VirtualMachine, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return VM, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCreateOrUpdateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ VM, err = client.CreateOrUpdateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ VM, err = client.CreateOrUpdateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachinesDeallocateFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachinesDeallocateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachinesDeallocateFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeallocateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.DeallocateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.DeallocateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachinesDeleteFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachinesDeleteFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeleteFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.DeleteResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.DeleteResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineSize describes the properties of a VM size.
+type VirtualMachineSize struct {
+ // Name - The name of the virtual machine size.
+ Name *string `json:"name,omitempty"`
+ // NumberOfCores - The number of cores supported by the virtual machine size.
+ NumberOfCores *int32 `json:"numberOfCores,omitempty"`
+ // OsDiskSizeInMB - The OS disk size, in MB, allowed by the virtual machine size.
+ OsDiskSizeInMB *int32 `json:"osDiskSizeInMB,omitempty"`
+ // ResourceDiskSizeInMB - The resource disk size, in MB, allowed by the virtual machine size.
+ ResourceDiskSizeInMB *int32 `json:"resourceDiskSizeInMB,omitempty"`
+ // MemoryInMB - The amount of memory, in MB, supported by the virtual machine size.
+ MemoryInMB *int32 `json:"memoryInMB,omitempty"`
+ // MaxDataDiskCount - The maximum number of data disks that can be attached to the virtual machine size.
+ MaxDataDiskCount *int32 `json:"maxDataDiskCount,omitempty"`
+}
+
+// VirtualMachineSizeListResult the List Virtual Machine operation response.
+type VirtualMachineSizeListResult struct {
+ autorest.Response `json:"-"`
+ // Value - The list of virtual machine sizes.
+ Value *[]VirtualMachineSize `json:"value,omitempty"`
+}
+
+// VirtualMachinesPowerOffFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachinesPowerOffFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachinesPowerOffFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesPowerOffFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.PowerOffResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.PowerOffResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachinesRedeployFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachinesRedeployFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachinesRedeployFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRedeployFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.RedeployResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.RedeployResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachinesRestartFuture an abstraction for monitoring and retrieving the results of a long-running
+// operation.
+type VirtualMachinesRestartFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachinesRestartFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRestartFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.RestartResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.RestartResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachinesStartFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type VirtualMachinesStartFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future VirtualMachinesStartFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return osr, azure.NewAsyncOpIncompleteError("compute.VirtualMachinesStartFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ osr, err = client.StartResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ osr, err = client.StartResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// VirtualMachineStatusCodeCount the status code and count of the virtual machine scale set instance view status
+// summary.
+type VirtualMachineStatusCodeCount struct {
+ // Code - The instance view status code.
+ Code *string `json:"code,omitempty"`
+ // Count - The number of instances having a particular status code.
+ Count *int32 `json:"count,omitempty"`
+}
+
+// WindowsConfiguration specifies Windows operating system settings on the virtual machine.
+type WindowsConfiguration struct {
+ // ProvisionVMAgent - Indicates whether virtual machine agent should be provisioned on the virtual machine.
When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later.
+ ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"`
+ // EnableAutomaticUpdates - Indicates whether virtual machine is enabled for automatic updates.
+ EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"`
+ // TimeZone - Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time"
+ TimeZone *string `json:"timeZone,omitempty"`
+ // AdditionalUnattendContent - Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup.
+ AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"`
+ // WinRM - Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell.
+ WinRM *WinRMConfiguration `json:"winRM,omitempty"`
+}
+
+// WinRMConfiguration describes Windows Remote Management configuration of the VM
+type WinRMConfiguration struct {
+ // Listeners - The list of Windows Remote Management listeners
+ Listeners *[]WinRMListener `json:"listeners,omitempty"`
+}
+
+// WinRMListener describes Protocol and thumbprint of Windows Remote Management listener
+type WinRMListener struct {
+ // Protocol - Specifies the protocol of listener.
Possible values are:
**http**
**https**. Possible values include: 'HTTP', 'HTTPS'
+ Protocol ProtocolTypes `json:"protocol,omitempty"`
+ // CertificateURL - This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8:
{
"data":"",
"dataType":"pfx",
"password":""
}
+ CertificateURL *string `json:"certificateUrl,omitempty"`
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/snapshots.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/snapshots.go
new file mode 100644
index 000000000000..11ccd0dd0ca0
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/snapshots.go
@@ -0,0 +1,671 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "github.com/Azure/go-autorest/autorest/validation"
+ "net/http"
+)
+
+// SnapshotsClient is the compute Client
+type SnapshotsClient struct {
+ BaseClient
+}
+
+// NewSnapshotsClient creates an instance of the SnapshotsClient client.
+func NewSnapshotsClient(subscriptionID string) SnapshotsClient {
+ return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient client.
+func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient {
+ return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// CreateOrUpdate creates or updates a snapshot.
+//
+// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot within the given
+// subscription and resource group. snapshot is snapshot object supplied in the body of the Put disk operation.
+func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot) (result SnapshotsCreateOrUpdateFuture, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: snapshot,
+ Constraints: []validation.Constraint{{Target: "snapshot.DiskProperties", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.CreationData", Name: validation.Null, Rule: true,
+ Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.CreationData.ImageReference", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.CreationData.ImageReference.ID", Name: validation.Null, Rule: true, Chain: nil}}},
+ }},
+ {Target: "snapshot.DiskProperties.EncryptionSettings", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
+ {Target: "snapshot.DiskProperties.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil},
+ }},
+ {Target: "snapshot.DiskProperties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "snapshot.DiskProperties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
+ {Target: "snapshot.DiskProperties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil},
+ }},
+ }},
+ }}}}}); err != nil {
+ return result, validation.NewError("compute.SnapshotsClient", "CreateOrUpdate", err.Error())
+ }
+
+ req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.CreateOrUpdateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
+func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "snapshotName": autorest.Encode("path", snapshotName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPut(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
+ autorest.WithJSON(snapshot),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
+// http.Response Body if it receives an error.
+func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (future SnapshotsCreateOrUpdateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
+// closes the http.Response Body.
+func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Delete deletes a snapshot.
+//
+// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot within the given
+// subscription and resource group.
+func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsDeleteFuture, err error) {
+ req, err := client.DeletePreparer(ctx, resourceGroupName, snapshotName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Delete", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeleteSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Delete", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeletePreparer prepares the Delete request.
+func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "snapshotName": autorest.Encode("path", snapshotName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsDelete(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeleteSender sends the Delete request. The method will close the
+// http.Response Body if it receives an error.
+func (client SnapshotsClient) DeleteSender(req *http.Request) (future SnapshotsDeleteFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
+ return
+}
+
+// DeleteResponder handles the response to the Delete request. The method always
+// closes the http.Response Body.
+func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Get gets information about a snapshot.
+//
+// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot within the given
+// subscription and resource group.
+func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, snapshotName string) (result Snapshot, err error) {
+ req, err := client.GetPreparer(ctx, resourceGroupName, snapshotName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Get", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetPreparer prepares the Get request.
+func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "snapshotName": autorest.Encode("path", snapshotName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetSender sends the Get request. The method will close the
+// http.Response Body if it receives an error.
+func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetResponder handles the response to the Get request. The method always
+// closes the http.Response Body.
+func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// GrantAccess grants access to a snapshot.
+//
+// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot within the given
+// subscription and resource group. grantAccessData is access data object supplied in the body of the get snapshot
+// access operation.
+func (client SnapshotsClient) GrantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (result SnapshotsGrantAccessFuture, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: grantAccessData,
+ Constraints: []validation.Constraint{{Target: "grantAccessData.DurationInSeconds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
+ return result, validation.NewError("compute.SnapshotsClient", "GrantAccess", err.Error())
+ }
+
+ req, err := client.GrantAccessPreparer(ctx, resourceGroupName, snapshotName, grantAccessData)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "GrantAccess", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.GrantAccessSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "GrantAccess", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// GrantAccessPreparer prepares the GrantAccess request.
+func (client SnapshotsClient) GrantAccessPreparer(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "snapshotName": autorest.Encode("path", snapshotName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", pathParameters),
+ autorest.WithJSON(grantAccessData),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GrantAccessSender sends the GrantAccess request. The method will close the
+// http.Response Body if it receives an error.
+func (client SnapshotsClient) GrantAccessSender(req *http.Request) (future SnapshotsGrantAccessFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// GrantAccessResponder handles the response to the GrantAccess request. The method always
+// closes the http.Response Body.
+func (client SnapshotsClient) GrantAccessResponder(resp *http.Response) (result AccessURI, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// List lists snapshots under a subscription.
+func (client SnapshotsClient) List(ctx context.Context) (result SnapshotListPage, err error) {
+ result.fn = client.listNextResults
+ req, err := client.ListPreparer(ctx)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.sl.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", resp, "Failure sending request")
+ return
+ }
+
+ result.sl, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "List", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListPreparer prepares the List request.
+func (client SnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSender sends the List request. The method will close the
+// http.Response Body if it receives an error.
+func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListResponder handles the response to the List request. The method always
+// closes the http.Response Body.
+func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotList, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listNextResults retrieves the next set of results, if any.
+func (client SnapshotsClient) listNextResults(lastResults SnapshotList) (result SnapshotList, err error) {
+ req, err := lastResults.snapshotListPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListComplete enumerates all values, automatically crossing page boundaries as required.
+func (client SnapshotsClient) ListComplete(ctx context.Context) (result SnapshotListIterator, err error) {
+ result.page, err = client.List(ctx)
+ return
+}
+
+// ListByResourceGroup lists snapshots under a resource group.
+//
+// resourceGroupName is the name of the resource group.
+func (client SnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SnapshotListPage, err error) {
+ result.fn = client.listByResourceGroupNextResults
+ req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListByResourceGroupSender(req)
+ if err != nil {
+ result.sl.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request")
+ return
+ }
+
+ result.sl, err = client.ListByResourceGroupResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
+func (client SnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
+// http.Response Body if it receives an error.
+func (client SnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
+// closes the http.Response Body.
+func (client SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotList, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listByResourceGroupNextResults retrieves the next set of results, if any.
+func (client SnapshotsClient) listByResourceGroupNextResults(lastResults SnapshotList) (result SnapshotList, err error) {
+ req, err := lastResults.snapshotListPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListByResourceGroupSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListByResourceGroupResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
+func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SnapshotListIterator, err error) {
+ result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
+ return
+}
+
+// RevokeAccess revokes access to a snapshot.
+//
+// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot within the given
+// subscription and resource group.
+func (client SnapshotsClient) RevokeAccess(ctx context.Context, resourceGroupName string, snapshotName string) (result SnapshotsRevokeAccessFuture, err error) {
+ req, err := client.RevokeAccessPreparer(ctx, resourceGroupName, snapshotName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "RevokeAccess", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.RevokeAccessSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "RevokeAccess", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// RevokeAccessPreparer prepares the RevokeAccess request.
+func (client SnapshotsClient) RevokeAccessPreparer(ctx context.Context, resourceGroupName string, snapshotName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "snapshotName": autorest.Encode("path", snapshotName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// RevokeAccessSender sends the RevokeAccess request. The method will close the
+// http.Response Body if it receives an error.
+func (client SnapshotsClient) RevokeAccessSender(req *http.Request) (future SnapshotsRevokeAccessFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// RevokeAccessResponder handles the response to the RevokeAccess request. The method always
+// closes the http.Response Body.
+func (client SnapshotsClient) RevokeAccessResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Update updates (patches) a snapshot.
+//
+// resourceGroupName is the name of the resource group. snapshotName is the name of the snapshot within the given
+// subscription and resource group. snapshot is snapshot object supplied in the body of the Patch snapshot
+// operation.
+func (client SnapshotsClient) Update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate) (result SnapshotsUpdateFuture, err error) {
+ req, err := client.UpdatePreparer(ctx, resourceGroupName, snapshotName, snapshot)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Update", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.UpdateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.SnapshotsClient", "Update", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// UpdatePreparer prepares the Update request.
+func (client SnapshotsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "snapshotName": autorest.Encode("path", snapshotName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPatch(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", pathParameters),
+ autorest.WithJSON(snapshot),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// UpdateSender sends the Update request. The method will close the
+// http.Response Body if it receives an error.
+func (client SnapshotsClient) UpdateSender(req *http.Request) (future SnapshotsUpdateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// UpdateResponder handles the response to the Update request. The method always
+// closes the http.Response Body.
+func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/usage.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/usage.go
new file mode 100644
index 000000000000..02d17641f957
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/usage.go
@@ -0,0 +1,141 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "github.com/Azure/go-autorest/autorest/validation"
+ "net/http"
+)
+
+// UsageClient is the compute Client
+type UsageClient struct {
+ BaseClient
+}
+
+// NewUsageClient creates an instance of the UsageClient client.
+func NewUsageClient(subscriptionID string) UsageClient {
+ return NewUsageClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewUsageClientWithBaseURI creates an instance of the UsageClient client.
+func NewUsageClientWithBaseURI(baseURI string, subscriptionID string) UsageClient {
+ return UsageClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// List gets, for the specified location, the current compute resource usage information as well as the limits for
+// compute resources under the subscription.
+//
+// location is the location for which resource usage is queried.
+func (client UsageClient) List(ctx context.Context, location string) (result ListUsagesResultPage, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: location,
+ Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
+ return result, validation.NewError("compute.UsageClient", "List", err.Error())
+ }
+
+ result.fn = client.listNextResults
+ req, err := client.ListPreparer(ctx, location)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.lur.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure sending request")
+ return
+ }
+
+ result.lur, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.UsageClient", "List", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListPreparer prepares the List request.
+func (client UsageClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "location": autorest.Encode("path", location),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSender sends the List request. The method will close the
+// http.Response Body if it receives an error.
+func (client UsageClient) ListSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListResponder handles the response to the List request. The method always
+// closes the http.Response Body.
+func (client UsageClient) ListResponder(resp *http.Response) (result ListUsagesResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listNextResults retrieves the next set of results, if any.
+func (client UsageClient) listNextResults(lastResults ListUsagesResult) (result ListUsagesResult, err error) {
+ req, err := lastResults.listUsagesResultPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.UsageClient", "listNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListComplete enumerates all values, automatically crossing page boundaries as required.
+func (client UsageClient) ListComplete(ctx context.Context, location string) (result ListUsagesResultIterator, err error) {
+ result.page, err = client.List(ctx, location)
+ return
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/version.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/version.go
new file mode 100644
index 000000000000..70acf09227eb
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/version.go
@@ -0,0 +1,30 @@
+package compute
+
+import "github.com/Azure/azure-sdk-for-go/version"
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// UserAgent returns the UserAgent string to use when sending http.Requests.
+func UserAgent() string {
+ return "Azure-SDK-For-Go/" + version.Number + " compute/2016-04-30-preview"
+}
+
+// Version returns the semantic version (see http://semver.org) of the client.
+func Version() string {
+ return version.Number
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachineextensionimages.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachineextensionimages.go
new file mode 100644
index 000000000000..be80a1e1a460
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachineextensionimages.go
@@ -0,0 +1,251 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "net/http"
+)
+
+// VirtualMachineExtensionImagesClient is the compute Client
+type VirtualMachineExtensionImagesClient struct {
+ BaseClient
+}
+
+// NewVirtualMachineExtensionImagesClient creates an instance of the VirtualMachineExtensionImagesClient client.
+func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachineExtensionImagesClient {
+ return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of the VirtualMachineExtensionImagesClient
+// client.
+func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient {
+ return VirtualMachineExtensionImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// Get gets a virtual machine extension image.
+//
+// location is the name of a supported Azure region.
+func (client VirtualMachineExtensionImagesClient) Get(ctx context.Context, location string, publisherName string, typeParameter string, version string) (result VirtualMachineExtensionImage, err error) {
+ req, err := client.GetPreparer(ctx, location, publisherName, typeParameter, version)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "Get", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetPreparer prepares the Get request.
+func (client VirtualMachineExtensionImagesClient) GetPreparer(ctx context.Context, location string, publisherName string, typeParameter string, version string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "location": autorest.Encode("path", location),
+ "publisherName": autorest.Encode("path", publisherName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "type": autorest.Encode("path", typeParameter),
+ "version": autorest.Encode("path", version),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetSender sends the Get request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineExtensionImagesClient) GetSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetResponder handles the response to the Get request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineExtensionImagesClient) GetResponder(resp *http.Response) (result VirtualMachineExtensionImage, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// ListTypes gets a list of virtual machine extension image types.
+//
+// location is the name of a supported Azure region.
+func (client VirtualMachineExtensionImagesClient) ListTypes(ctx context.Context, location string, publisherName string) (result ListVirtualMachineExtensionImage, err error) {
+ req, err := client.ListTypesPreparer(ctx, location, publisherName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListTypesSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.ListTypesResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListTypesPreparer prepares the ListTypes request.
+func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(ctx context.Context, location string, publisherName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "location": autorest.Encode("path", location),
+ "publisherName": autorest.Encode("path", publisherName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListTypesSender sends the ListTypes request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineExtensionImagesClient) ListTypesSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListTypesResponder handles the response to the ListTypes request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result.Value),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// ListVersions gets a list of virtual machine extension image versions.
+//
+// location is the name of a supported Azure region. filter is the filter to apply on the operation.
+func (client VirtualMachineExtensionImagesClient) ListVersions(ctx context.Context, location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (result ListVirtualMachineExtensionImage, err error) {
+ req, err := client.ListVersionsPreparer(ctx, location, publisherName, typeParameter, filter, top, orderby)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListVersionsSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.ListVersionsResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListVersionsPreparer prepares the ListVersions request.
+func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(ctx context.Context, location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "location": autorest.Encode("path", location),
+ "publisherName": autorest.Encode("path", publisherName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "type": autorest.Encode("path", typeParameter),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+ if len(filter) > 0 {
+ queryParameters["$filter"] = autorest.Encode("query", filter)
+ }
+ if top != nil {
+ queryParameters["$top"] = autorest.Encode("query", *top)
+ }
+ if len(orderby) > 0 {
+ queryParameters["$orderby"] = autorest.Encode("query", orderby)
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListVersionsSender sends the ListVersions request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineExtensionImagesClient) ListVersionsSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListVersionsResponder handles the response to the ListVersions request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineExtensionImagesClient) ListVersionsResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result.Value),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachineextensions.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachineextensions.go
new file mode 100644
index 000000000000..e0e6e36080d2
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachineextensions.go
@@ -0,0 +1,328 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "net/http"
+)
+
+// VirtualMachineExtensionsClient is the compute Client
+type VirtualMachineExtensionsClient struct {
+ BaseClient
+}
+
+// NewVirtualMachineExtensionsClient creates an instance of the VirtualMachineExtensionsClient client.
+func NewVirtualMachineExtensionsClient(subscriptionID string) VirtualMachineExtensionsClient {
+ return NewVirtualMachineExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewVirtualMachineExtensionsClientWithBaseURI creates an instance of the VirtualMachineExtensionsClient client.
+func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionsClient {
+ return VirtualMachineExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// CreateOrUpdate the operation to create or update the extension.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine where the
+// extension should be created or updated. VMExtensionName is the name of the virtual machine extension.
+// extensionParameters is parameters supplied to the Create Virtual Machine Extension operation.
+func (client VirtualMachineExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (result VirtualMachineExtensionsCreateOrUpdateFuture, err error) {
+ req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.CreateOrUpdateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
+func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtension) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmExtensionName": autorest.Encode("path", VMExtensionName),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPut(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
+ autorest.WithJSON(extensionParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineExtensionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineExtensionsCreateOrUpdateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
+ return
+}
+
+// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineExtension, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Delete the operation to delete the extension.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine where the
+// extension should be deleted. VMExtensionName is the name of the virtual machine extension.
+func (client VirtualMachineExtensionsClient) Delete(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (result VirtualMachineExtensionsDeleteFuture, err error) {
+ req, err := client.DeletePreparer(ctx, resourceGroupName, VMName, VMExtensionName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeleteSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Delete", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeletePreparer prepares the Delete request.
+func (client VirtualMachineExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmExtensionName": autorest.Encode("path", VMExtensionName),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsDelete(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeleteSender sends the Delete request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineExtensionsClient) DeleteSender(req *http.Request) (future VirtualMachineExtensionsDeleteFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
+ return
+}
+
+// DeleteResponder handles the response to the Delete request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Get the operation to get the extension.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine containing the
+// extension. VMExtensionName is the name of the virtual machine extension. expand is the expand expression to
+// apply on the operation.
+func (client VirtualMachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (result VirtualMachineExtension, err error) {
+ req, err := client.GetPreparer(ctx, resourceGroupName, VMName, VMExtensionName, expand)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Get", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetPreparer prepares the Get request.
+func (client VirtualMachineExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, expand string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmExtensionName": autorest.Encode("path", VMExtensionName),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+ if len(expand) > 0 {
+ queryParameters["$expand"] = autorest.Encode("query", expand)
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetSender sends the Get request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineExtensionsClient) GetSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetResponder handles the response to the Get request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineExtensionsClient) GetResponder(resp *http.Response) (result VirtualMachineExtension, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Update the operation to update the extension.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine where the
+// extension should be updated. VMExtensionName is the name of the virtual machine extension. extensionParameters
+// is parameters supplied to the Update Virtual Machine Extension operation.
+func (client VirtualMachineExtensionsClient) Update(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtensionUpdate) (result VirtualMachineExtensionsUpdateFuture, err error) {
+ req, err := client.UpdatePreparer(ctx, resourceGroupName, VMName, VMExtensionName, extensionParameters)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Update", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.UpdateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsClient", "Update", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// UpdatePreparer prepares the Update request.
+func (client VirtualMachineExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, VMExtensionName string, extensionParameters VirtualMachineExtensionUpdate) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmExtensionName": autorest.Encode("path", VMExtensionName),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPatch(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
+ autorest.WithJSON(extensionParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// UpdateSender sends the Update request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineExtensionsClient) UpdateSender(req *http.Request) (future VirtualMachineExtensionsUpdateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK))
+ return
+}
+
+// UpdateResponder handles the response to the Update request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineExtensionsClient) UpdateResponder(resp *http.Response) (result VirtualMachineExtension, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachineimages.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachineimages.go
new file mode 100644
index 000000000000..b38a346620d6
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachineimages.go
@@ -0,0 +1,387 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "net/http"
+)
+
+// VirtualMachineImagesClient is the compute Client
+type VirtualMachineImagesClient struct {
+ BaseClient
+}
+
+// NewVirtualMachineImagesClient creates an instance of the VirtualMachineImagesClient client.
+func NewVirtualMachineImagesClient(subscriptionID string) VirtualMachineImagesClient {
+ return NewVirtualMachineImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewVirtualMachineImagesClientWithBaseURI creates an instance of the VirtualMachineImagesClient client.
+func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineImagesClient {
+ return VirtualMachineImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// Get gets a virtual machine image.
+//
+// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid
+// image publisher offer. skus is a valid image SKU. version is a valid image SKU version.
+func (client VirtualMachineImagesClient) Get(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (result VirtualMachineImage, err error) {
+ req, err := client.GetPreparer(ctx, location, publisherName, offer, skus, version)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "Get", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetPreparer prepares the Get request.
+func (client VirtualMachineImagesClient) GetPreparer(ctx context.Context, location string, publisherName string, offer string, skus string, version string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "location": autorest.Encode("path", location),
+ "offer": autorest.Encode("path", offer),
+ "publisherName": autorest.Encode("path", publisherName),
+ "skus": autorest.Encode("path", skus),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "version": autorest.Encode("path", version),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetSender sends the Get request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineImagesClient) GetSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetResponder handles the response to the Get request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineImagesClient) GetResponder(resp *http.Response) (result VirtualMachineImage, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// List gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU.
+//
+// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid
+// image publisher offer. skus is a valid image SKU. filter is the filter to apply on the operation.
+func (client VirtualMachineImagesClient) List(ctx context.Context, location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (result ListVirtualMachineImageResource, err error) {
+ req, err := client.ListPreparer(ctx, location, publisherName, offer, skus, filter, top, orderby)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "List", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListPreparer prepares the List request.
+func (client VirtualMachineImagesClient) ListPreparer(ctx context.Context, location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "location": autorest.Encode("path", location),
+ "offer": autorest.Encode("path", offer),
+ "publisherName": autorest.Encode("path", publisherName),
+ "skus": autorest.Encode("path", skus),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+ if len(filter) > 0 {
+ queryParameters["$filter"] = autorest.Encode("query", filter)
+ }
+ if top != nil {
+ queryParameters["$top"] = autorest.Encode("query", *top)
+ }
+ if len(orderby) > 0 {
+ queryParameters["$orderby"] = autorest.Encode("query", orderby)
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSender sends the List request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineImagesClient) ListSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListResponder handles the response to the List request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineImagesClient) ListResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result.Value),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// ListOffers gets a list of virtual machine image offers for the specified location and publisher.
+//
+// location is the name of a supported Azure region. publisherName is a valid image publisher.
+func (client VirtualMachineImagesClient) ListOffers(ctx context.Context, location string, publisherName string) (result ListVirtualMachineImageResource, err error) {
+ req, err := client.ListOffersPreparer(ctx, location, publisherName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListOffersSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.ListOffersResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListOffers", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListOffersPreparer prepares the ListOffers request.
+func (client VirtualMachineImagesClient) ListOffersPreparer(ctx context.Context, location string, publisherName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "location": autorest.Encode("path", location),
+ "publisherName": autorest.Encode("path", publisherName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListOffersSender sends the ListOffers request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineImagesClient) ListOffersSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListOffersResponder handles the response to the ListOffers request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineImagesClient) ListOffersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result.Value),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// ListPublishers gets a list of virtual machine image publishers for the specified Azure location.
+//
+// location is the name of a supported Azure region.
+func (client VirtualMachineImagesClient) ListPublishers(ctx context.Context, location string) (result ListVirtualMachineImageResource, err error) {
+ req, err := client.ListPublishersPreparer(ctx, location)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListPublishersSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.ListPublishersResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListPublishers", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListPublishersPreparer prepares the ListPublishers request.
+func (client VirtualMachineImagesClient) ListPublishersPreparer(ctx context.Context, location string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "location": autorest.Encode("path", location),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListPublishersSender sends the ListPublishers request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineImagesClient) ListPublishersSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListPublishersResponder handles the response to the ListPublishers request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineImagesClient) ListPublishersResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result.Value),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// ListSkus gets a list of virtual machine image SKUs for the specified location, publisher, and offer.
+//
+// location is the name of a supported Azure region. publisherName is a valid image publisher. offer is a valid
+// image publisher offer.
+func (client VirtualMachineImagesClient) ListSkus(ctx context.Context, location string, publisherName string, offer string) (result ListVirtualMachineImageResource, err error) {
+ req, err := client.ListSkusPreparer(ctx, location, publisherName, offer)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSkusSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.ListSkusResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineImagesClient", "ListSkus", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListSkusPreparer prepares the ListSkus request.
+func (client VirtualMachineImagesClient) ListSkusPreparer(ctx context.Context, location string, publisherName string, offer string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "location": autorest.Encode("path", location),
+ "offer": autorest.Encode("path", offer),
+ "publisherName": autorest.Encode("path", publisherName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSkusSender sends the ListSkus request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineImagesClient) ListSkusSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListSkusResponder handles the response to the ListSkus request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineImagesClient) ListSkusResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result.Value),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachines.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachines.go
new file mode 100644
index 000000000000..4cb80e1a1514
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachines.go
@@ -0,0 +1,1149 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "github.com/Azure/go-autorest/autorest/validation"
+ "net/http"
+)
+
+// VirtualMachinesClient is the compute Client
+type VirtualMachinesClient struct {
+ BaseClient
+}
+
+// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient client.
+func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient {
+ return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewVirtualMachinesClientWithBaseURI creates an instance of the VirtualMachinesClient client.
+func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient {
+ return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// Capture captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create
+// similar VMs.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. parameters is
+// parameters supplied to the Capture Virtual Machine operation.
+func (client VirtualMachinesClient) Capture(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters) (result VirtualMachinesCaptureFuture, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: parameters,
+ Constraints: []validation.Constraint{{Target: "parameters.VhdPrefix", Name: validation.Null, Rule: true, Chain: nil},
+ {Target: "parameters.DestinationContainerName", Name: validation.Null, Rule: true, Chain: nil},
+ {Target: "parameters.OverwriteVhds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
+ return result, validation.NewError("compute.VirtualMachinesClient", "Capture", err.Error())
+ }
+
+ req, err := client.CapturePreparer(ctx, resourceGroupName, VMName, parameters)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.CaptureSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Capture", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// CapturePreparer prepares the Capture request.
+func (client VirtualMachinesClient) CapturePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachineCaptureParameters) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", pathParameters),
+ autorest.WithJSON(parameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// CaptureSender sends the Capture request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) CaptureSender(req *http.Request) (future VirtualMachinesCaptureFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// CaptureResponder handles the response to the Capture request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) CaptureResponder(resp *http.Response) (result VirtualMachineCaptureResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// ConvertToManagedDisks converts virtual machine disks from blob-based to managed disks. Virtual machine must be
+// stop-deallocated before invoking this operation.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine.
+func (client VirtualMachinesClient) ConvertToManagedDisks(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesConvertToManagedDisksFuture, err error) {
+ req, err := client.ConvertToManagedDisksPreparer(ctx, resourceGroupName, VMName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.ConvertToManagedDisksSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ConvertToManagedDisks", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// ConvertToManagedDisksPreparer prepares the ConvertToManagedDisks request.
+func (client VirtualMachinesClient) ConvertToManagedDisksPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ConvertToManagedDisksSender sends the ConvertToManagedDisks request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) ConvertToManagedDisksSender(req *http.Request) (future VirtualMachinesConvertToManagedDisksFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// ConvertToManagedDisksResponder handles the response to the ConvertToManagedDisks request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) ConvertToManagedDisksResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// CreateOrUpdate the operation to create or update a virtual machine.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. parameters is
+// parameters supplied to the Create Virtual Machine operation.
+func (client VirtualMachinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachine) (result VirtualMachinesCreateOrUpdateFuture, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: parameters,
+ Constraints: []validation.Constraint{{Target: "parameters.VirtualMachineProperties", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SecretURL", Name: validation.Null, Rule: true, Chain: nil},
+ {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.DiskEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
+ }},
+ {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil},
+ {Target: "parameters.VirtualMachineProperties.StorageProfile.OsDisk.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
+ }},
+ }},
+ }},
+ }},
+ }}}}}); err != nil {
+ return result, validation.NewError("compute.VirtualMachinesClient", "CreateOrUpdate", err.Error())
+ }
+
+ req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, VMName, parameters)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.CreateOrUpdateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
+func (client VirtualMachinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, VMName string, parameters VirtualMachine) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPut(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters),
+ autorest.WithJSON(parameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachinesCreateOrUpdateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
+ return
+}
+
+// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachine, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Deallocate shuts down the virtual machine and releases the compute resources. You are not billed for the compute
+// resources that this virtual machine uses.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine.
+func (client VirtualMachinesClient) Deallocate(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesDeallocateFuture, err error) {
+ req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeallocateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Deallocate", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeallocatePreparer prepares the Deallocate request.
+func (client VirtualMachinesClient) DeallocatePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeallocateSender sends the Deallocate request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) DeallocateSender(req *http.Request) (future VirtualMachinesDeallocateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// DeallocateResponder handles the response to the Deallocate request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) DeallocateResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Delete the operation to delete a virtual machine.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine.
+func (client VirtualMachinesClient) Delete(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesDeleteFuture, err error) {
+ req, err := client.DeletePreparer(ctx, resourceGroupName, VMName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeleteSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Delete", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeletePreparer prepares the Delete request.
+func (client VirtualMachinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsDelete(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeleteSender sends the Delete request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) DeleteSender(req *http.Request) (future VirtualMachinesDeleteFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
+ return
+}
+
+// DeleteResponder handles the response to the Delete request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Generalize sets the state of the virtual machine to generalized.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine.
+func (client VirtualMachinesClient) Generalize(ctx context.Context, resourceGroupName string, VMName string) (result OperationStatusResponse, err error) {
+ req, err := client.GeneralizePreparer(ctx, resourceGroupName, VMName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GeneralizeSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GeneralizeResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Generalize", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GeneralizePreparer prepares the Generalize request.
+func (client VirtualMachinesClient) GeneralizePreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GeneralizeSender sends the Generalize request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) GeneralizeSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GeneralizeResponder handles the response to the Generalize request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Get retrieves information about the model view or the instance view of a virtual machine.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine. expand is the
+// expand expression to apply on the operation.
+func (client VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, VMName string, expand InstanceViewTypes) (result VirtualMachine, err error) {
+ req, err := client.GetPreparer(ctx, resourceGroupName, VMName, expand)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetPreparer prepares the Get request.
+func (client VirtualMachinesClient) GetPreparer(ctx context.Context, resourceGroupName string, VMName string, expand InstanceViewTypes) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+ if len(string(expand)) > 0 {
+ queryParameters["$expand"] = autorest.Encode("query", expand)
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetSender sends the Get request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetResponder handles the response to the Get request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) GetResponder(resp *http.Response) (result VirtualMachine, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// GetExtensions the operation to get all extensions of a Virtual Machine.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine containing the
+// extension. expand is the expand expression to apply on the operation.
+func (client VirtualMachinesClient) GetExtensions(ctx context.Context, resourceGroupName string, VMName string, expand string) (result VirtualMachineExtensionsListResult, err error) {
+ req, err := client.GetExtensionsPreparer(ctx, resourceGroupName, VMName, expand)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "GetExtensions", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetExtensionsSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "GetExtensions", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetExtensionsResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "GetExtensions", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetExtensionsPreparer prepares the GetExtensions request.
+func (client VirtualMachinesClient) GetExtensionsPreparer(ctx context.Context, resourceGroupName string, VMName string, expand string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+ if len(expand) > 0 {
+ queryParameters["$expand"] = autorest.Encode("query", expand)
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetExtensionsSender sends the GetExtensions request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) GetExtensionsSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetExtensionsResponder handles the response to the GetExtensions request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) GetExtensionsResponder(resp *http.Response) (result VirtualMachineExtensionsListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// List lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to
+// get the next page of virtual machines.
+//
+// resourceGroupName is the name of the resource group.
+func (client VirtualMachinesClient) List(ctx context.Context, resourceGroupName string) (result VirtualMachineListResultPage, err error) {
+ result.fn = client.listNextResults
+ req, err := client.ListPreparer(ctx, resourceGroupName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.vmlr.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure sending request")
+ return
+ }
+
+ result.vmlr, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListPreparer prepares the List request.
+func (client VirtualMachinesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSender sends the List request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListResponder handles the response to the List request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result VirtualMachineListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listNextResults retrieves the next set of results, if any.
+func (client VirtualMachinesClient) listNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) {
+ req, err := lastResults.virtualMachineListResultPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListComplete enumerates all values, automatically crossing page boundaries as required.
+func (client VirtualMachinesClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualMachineListResultIterator, err error) {
+ result.page, err = client.List(ctx, resourceGroupName)
+ return
+}
+
+// ListAll lists all of the virtual machines in the specified subscription. Use the nextLink property in the response
+// to get the next page of virtual machines.
+func (client VirtualMachinesClient) ListAll(ctx context.Context) (result VirtualMachineListResultPage, err error) {
+ result.fn = client.listAllNextResults
+ req, err := client.ListAllPreparer(ctx)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListAllSender(req)
+ if err != nil {
+ result.vmlr.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure sending request")
+ return
+ }
+
+ result.vmlr, err = client.ListAllResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAll", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListAllPreparer prepares the ListAll request.
+func (client VirtualMachinesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListAllSender sends the ListAll request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) ListAllSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListAllResponder handles the response to the ListAll request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) ListAllResponder(resp *http.Response) (result VirtualMachineListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listAllNextResults retrieves the next set of results, if any.
+func (client VirtualMachinesClient) listAllNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) {
+ req, err := lastResults.virtualMachineListResultPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListAllSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListAllResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "listAllNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListAllComplete enumerates all values, automatically crossing page boundaries as required.
+func (client VirtualMachinesClient) ListAllComplete(ctx context.Context) (result VirtualMachineListResultIterator, err error) {
+ result.page, err = client.ListAll(ctx)
+ return
+}
+
+// ListAvailableSizes lists all available virtual machine sizes to which the specified virtual machine can be resized.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine.
+func (client VirtualMachinesClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachineSizeListResult, err error) {
+ req, err := client.ListAvailableSizesPreparer(ctx, resourceGroupName, VMName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListAvailableSizesSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.ListAvailableSizesResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListAvailableSizesPreparer prepares the ListAvailableSizes request.
+func (client VirtualMachinesClient) ListAvailableSizesPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) ListAvailableSizesSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListAvailableSizesResponder handles the response to the ListAvailableSizes request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// PowerOff the operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
+// provisioned resources. You are still charged for this virtual machine.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine.
+func (client VirtualMachinesClient) PowerOff(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesPowerOffFuture, err error) {
+ req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.PowerOffSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "PowerOff", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// PowerOffPreparer prepares the PowerOff request.
+func (client VirtualMachinesClient) PowerOffPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// PowerOffSender sends the PowerOff request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) PowerOffSender(req *http.Request) (future VirtualMachinesPowerOffFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// PowerOffResponder handles the response to the PowerOff request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) PowerOffResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Redeploy the operation to redeploy a virtual machine.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine.
+func (client VirtualMachinesClient) Redeploy(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesRedeployFuture, err error) {
+ req, err := client.RedeployPreparer(ctx, resourceGroupName, VMName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.RedeploySender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// RedeployPreparer prepares the Redeploy request.
+func (client VirtualMachinesClient) RedeployPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// RedeploySender sends the Redeploy request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) RedeploySender(req *http.Request) (future VirtualMachinesRedeployFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// RedeployResponder handles the response to the Redeploy request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) RedeployResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Restart the operation to restart a virtual machine.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine.
+func (client VirtualMachinesClient) Restart(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesRestartFuture, err error) {
+ req, err := client.RestartPreparer(ctx, resourceGroupName, VMName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.RestartSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Restart", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// RestartPreparer prepares the Restart request.
+func (client VirtualMachinesClient) RestartPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// RestartSender sends the Restart request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) RestartSender(req *http.Request) (future VirtualMachinesRestartFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// RestartResponder handles the response to the Restart request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) RestartResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Start the operation to start a virtual machine.
+//
+// resourceGroupName is the name of the resource group. VMName is the name of the virtual machine.
+func (client VirtualMachinesClient) Start(ctx context.Context, resourceGroupName string, VMName string) (result VirtualMachinesStartFuture, err error) {
+ req, err := client.StartPreparer(ctx, resourceGroupName, VMName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.StartSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Start", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// StartPreparer prepares the Start request.
+func (client VirtualMachinesClient) StartPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmName": autorest.Encode("path", VMName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// StartSender sends the Start request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachinesClient) StartSender(req *http.Request) (future VirtualMachinesStartFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// StartResponder handles the response to the Start request. The method always
+// closes the http.Response Body.
+func (client VirtualMachinesClient) StartResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachinescalesets.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachinescalesets.go
new file mode 100644
index 000000000000..cc345b526672
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachinescalesets.go
@@ -0,0 +1,1181 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "github.com/Azure/go-autorest/autorest/validation"
+ "net/http"
+)
+
+// VirtualMachineScaleSetsClient is the compute Client
+type VirtualMachineScaleSetsClient struct {
+ BaseClient
+}
+
+// NewVirtualMachineScaleSetsClient creates an instance of the VirtualMachineScaleSetsClient client.
+func NewVirtualMachineScaleSetsClient(subscriptionID string) VirtualMachineScaleSetsClient {
+ return NewVirtualMachineScaleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewVirtualMachineScaleSetsClientWithBaseURI creates an instance of the VirtualMachineScaleSetsClient client.
+func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetsClient {
+ return VirtualMachineScaleSetsClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// CreateOrUpdate create or update a VM scale set.
+//
+// resourceGroupName is the name of the resource group. name is the name of the VM scale set to create or update.
+// parameters is the scale set object.
+func (client VirtualMachineScaleSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters VirtualMachineScaleSet) (result VirtualMachineScaleSetsCreateOrUpdateFuture, err error) {
+ req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, parameters)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.CreateOrUpdateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
+func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, parameters VirtualMachineScaleSet) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", name),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPut(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters),
+ autorest.WithJSON(parameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineScaleSetsCreateOrUpdateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
+ return
+}
+
+// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Deallocate deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the
+// compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+// VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
+func (client VirtualMachineScaleSetsClient) Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsDeallocateFuture, err error) {
+ req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeallocateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Deallocate", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeallocatePreparer prepares the Deallocate request.
+func (client VirtualMachineScaleSetsClient) DeallocatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ if VMInstanceIDs != nil {
+ preparer = autorest.DecoratePreparer(preparer,
+ autorest.WithJSON(VMInstanceIDs))
+ }
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeallocateSender sends the Deallocate request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) DeallocateSender(req *http.Request) (future VirtualMachineScaleSetsDeallocateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// DeallocateResponder handles the response to the Deallocate request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) DeallocateResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Delete deletes a VM scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+func (client VirtualMachineScaleSetsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetsDeleteFuture, err error) {
+ req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeleteSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Delete", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeletePreparer prepares the Delete request.
+func (client VirtualMachineScaleSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsDelete(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeleteSender sends the Delete request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) DeleteSender(req *http.Request) (future VirtualMachineScaleSetsDeleteFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
+ return
+}
+
+// DeleteResponder handles the response to the Delete request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// DeleteInstances deletes virtual machines in a VM scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+// VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
+func (client VirtualMachineScaleSetsClient) DeleteInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result VirtualMachineScaleSetsDeleteInstancesFuture, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: VMInstanceIDs,
+ Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
+ return result, validation.NewError("compute.VirtualMachineScaleSetsClient", "DeleteInstances", err.Error())
+ }
+
+ req, err := client.DeleteInstancesPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeleteInstancesSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "DeleteInstances", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeleteInstancesPreparer prepares the DeleteInstances request.
+func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", pathParameters),
+ autorest.WithJSON(VMInstanceIDs),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeleteInstancesSender sends the DeleteInstances request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) DeleteInstancesSender(req *http.Request) (future VirtualMachineScaleSetsDeleteInstancesFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// DeleteInstancesResponder handles the response to the DeleteInstances request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) DeleteInstancesResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Get display information about a virtual machine scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+func (client VirtualMachineScaleSetsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSet, err error) {
+ req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Get", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetPreparer prepares the Get request.
+func (client VirtualMachineScaleSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetSender sends the Get request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) GetSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetResponder handles the response to the Get request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSet, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// GetInstanceView gets the status of a VM scale set instance.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+func (client VirtualMachineScaleSetsClient) GetInstanceView(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetInstanceView, err error) {
+ req, err := client.GetInstanceViewPreparer(ctx, resourceGroupName, VMScaleSetName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetInstanceViewSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetInstanceViewResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "GetInstanceView", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetInstanceViewPreparer prepares the GetInstanceView request.
+func (client VirtualMachineScaleSetsClient) GetInstanceViewPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetInstanceViewSender sends the GetInstanceView request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetInstanceViewResponder handles the response to the GetInstanceView request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) GetInstanceViewResponder(resp *http.Response) (result VirtualMachineScaleSetInstanceView, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// List gets a list of all VM scale sets under a resource group.
+//
+// resourceGroupName is the name of the resource group.
+func (client VirtualMachineScaleSetsClient) List(ctx context.Context, resourceGroupName string) (result VirtualMachineScaleSetListResultPage, err error) {
+ result.fn = client.listNextResults
+ req, err := client.ListPreparer(ctx, resourceGroupName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.vmsslr.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure sending request")
+ return
+ }
+
+ result.vmsslr, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "List", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListPreparer prepares the List request.
+func (client VirtualMachineScaleSetsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSender sends the List request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) ListSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListResponder handles the response to the List request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listNextResults retrieves the next set of results, if any.
+func (client VirtualMachineScaleSetsClient) listNextResults(lastResults VirtualMachineScaleSetListResult) (result VirtualMachineScaleSetListResult, err error) {
+ req, err := lastResults.virtualMachineScaleSetListResultPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListComplete enumerates all values, automatically crossing page boundaries as required.
+func (client VirtualMachineScaleSetsClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualMachineScaleSetListResultIterator, err error) {
+ result.page, err = client.List(ctx, resourceGroupName)
+ return
+}
+
+// ListAll gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use
+// nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all
+// the VM Scale Sets.
+func (client VirtualMachineScaleSetsClient) ListAll(ctx context.Context) (result VirtualMachineScaleSetListWithLinkResultPage, err error) {
+ result.fn = client.listAllNextResults
+ req, err := client.ListAllPreparer(ctx)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListAllSender(req)
+ if err != nil {
+ result.vmsslwlr.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure sending request")
+ return
+ }
+
+ result.vmsslwlr, err = client.ListAllResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListAll", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListAllPreparer prepares the ListAll request.
+func (client VirtualMachineScaleSetsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListAllSender sends the ListAll request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) ListAllSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListAllResponder handles the response to the ListAll request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) ListAllResponder(resp *http.Response) (result VirtualMachineScaleSetListWithLinkResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listAllNextResults retrieves the next set of results, if any.
+func (client VirtualMachineScaleSetsClient) listAllNextResults(lastResults VirtualMachineScaleSetListWithLinkResult) (result VirtualMachineScaleSetListWithLinkResult, err error) {
+ req, err := lastResults.virtualMachineScaleSetListWithLinkResultPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listAllNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListAllSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listAllNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListAllResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listAllNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListAllComplete enumerates all values, automatically crossing page boundaries as required.
+func (client VirtualMachineScaleSetsClient) ListAllComplete(ctx context.Context) (result VirtualMachineScaleSetListWithLinkResultIterator, err error) {
+ result.page, err = client.ListAll(ctx)
+ return
+}
+
+// ListSkus gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed
+// for each SKU.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+func (client VirtualMachineScaleSetsClient) ListSkus(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListSkusResultPage, err error) {
+ result.fn = client.listSkusNextResults
+ req, err := client.ListSkusPreparer(ctx, resourceGroupName, VMScaleSetName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSkusSender(req)
+ if err != nil {
+ result.vmsslsr.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure sending request")
+ return
+ }
+
+ result.vmsslsr, err = client.ListSkusResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ListSkus", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListSkusPreparer prepares the ListSkus request.
+func (client VirtualMachineScaleSetsClient) ListSkusPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSkusSender sends the ListSkus request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) ListSkusSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListSkusResponder handles the response to the ListSkus request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) ListSkusResponder(resp *http.Response) (result VirtualMachineScaleSetListSkusResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listSkusNextResults retrieves the next set of results, if any.
+func (client VirtualMachineScaleSetsClient) listSkusNextResults(lastResults VirtualMachineScaleSetListSkusResult) (result VirtualMachineScaleSetListSkusResult, err error) {
+ req, err := lastResults.virtualMachineScaleSetListSkusResultPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listSkusNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListSkusSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listSkusNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListSkusResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "listSkusNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListSkusComplete enumerates all values, automatically crossing page boundaries as required.
+func (client VirtualMachineScaleSetsClient) ListSkusComplete(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetListSkusResultIterator, err error) {
+ result.page, err = client.ListSkus(ctx, resourceGroupName, VMScaleSetName)
+ return
+}
+
+// PowerOff power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and
+// you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+// VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
+func (client VirtualMachineScaleSetsClient) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsPowerOffFuture, err error) {
+ req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.PowerOffSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "PowerOff", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// PowerOffPreparer prepares the PowerOff request.
+func (client VirtualMachineScaleSetsClient) PowerOffPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ if VMInstanceIDs != nil {
+ preparer = autorest.DecoratePreparer(preparer,
+ autorest.WithJSON(VMInstanceIDs))
+ }
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// PowerOffSender sends the PowerOff request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) PowerOffSender(req *http.Request) (future VirtualMachineScaleSetsPowerOffFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// PowerOffResponder handles the response to the PowerOff request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Reimage reimages (upgrade the operating system) one or more virtual machines in a VM scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+func (client VirtualMachineScaleSetsClient) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetsReimageFuture, err error) {
+ req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.ReimageSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// ReimagePreparer prepares the Reimage request.
+func (client VirtualMachineScaleSetsClient) ReimagePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ReimageSender sends the Reimage request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) ReimageSender(req *http.Request) (future VirtualMachineScaleSetsReimageFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// ReimageResponder handles the response to the Reimage request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// ReimageAll reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation
+// is only supported for managed disks.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+func (client VirtualMachineScaleSetsClient) ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string) (result VirtualMachineScaleSetsReimageAllFuture, err error) {
+ req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.ReimageAllSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "ReimageAll", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// ReimageAllPreparer prepares the ReimageAll request.
+func (client VirtualMachineScaleSetsClient) ReimageAllPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ReimageAllSender sends the ReimageAll request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) ReimageAllSender(req *http.Request) (future VirtualMachineScaleSetsReimageAllFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// ReimageAllResponder handles the response to the ReimageAll request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) ReimageAllResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Restart restarts one or more virtual machines in a VM scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+// VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
+func (client VirtualMachineScaleSetsClient) Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsRestartFuture, err error) {
+ req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.RestartSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Restart", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// RestartPreparer prepares the Restart request.
+func (client VirtualMachineScaleSetsClient) RestartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ if VMInstanceIDs != nil {
+ preparer = autorest.DecoratePreparer(preparer,
+ autorest.WithJSON(VMInstanceIDs))
+ }
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// RestartSender sends the Restart request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) RestartSender(req *http.Request) (future VirtualMachineScaleSetsRestartFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// RestartResponder handles the response to the Restart request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Start starts one or more virtual machines in a VM scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+// VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
+func (client VirtualMachineScaleSetsClient) Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (result VirtualMachineScaleSetsStartFuture, err error) {
+ req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.StartSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Start", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// StartPreparer prepares the Start request.
+func (client VirtualMachineScaleSetsClient) StartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs *VirtualMachineScaleSetVMInstanceIDs) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ if VMInstanceIDs != nil {
+ preparer = autorest.DecoratePreparer(preparer,
+ autorest.WithJSON(VMInstanceIDs))
+ }
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// StartSender sends the Start request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) StartSender(req *http.Request) (future VirtualMachineScaleSetsStartFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// StartResponder handles the response to the Start request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) StartResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// UpdateInstances upgrades one or more virtual machines to the latest SKU set in the VM scale set model.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set.
+// VMInstanceIDs is a list of virtual machine instance IDs from the VM scale set.
+func (client VirtualMachineScaleSetsClient) UpdateInstances(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (result VirtualMachineScaleSetsUpdateInstancesFuture, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: VMInstanceIDs,
+ Constraints: []validation.Constraint{{Target: "VMInstanceIDs.InstanceIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
+ return result, validation.NewError("compute.VirtualMachineScaleSetsClient", "UpdateInstances", err.Error())
+ }
+
+ req, err := client.UpdateInstancesPreparer(ctx, resourceGroupName, VMScaleSetName, VMInstanceIDs)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.UpdateInstancesSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "UpdateInstances", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// UpdateInstancesPreparer prepares the UpdateInstances request.
+func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, VMInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", pathParameters),
+ autorest.WithJSON(VMInstanceIDs),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// UpdateInstancesSender sends the UpdateInstances request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetsClient) UpdateInstancesSender(req *http.Request) (future VirtualMachineScaleSetsUpdateInstancesFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// UpdateInstancesResponder handles the response to the UpdateInstances request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetsClient) UpdateInstancesResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachinescalesetvms.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachinescalesetvms.go
new file mode 100644
index 000000000000..63a1aaf70910
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachinescalesetvms.go
@@ -0,0 +1,775 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "net/http"
+)
+
+// VirtualMachineScaleSetVMsClient is the compute Client
+type VirtualMachineScaleSetVMsClient struct {
+ BaseClient
+}
+
+// NewVirtualMachineScaleSetVMsClient creates an instance of the VirtualMachineScaleSetVMsClient client.
+func NewVirtualMachineScaleSetVMsClient(subscriptionID string) VirtualMachineScaleSetVMsClient {
+ return NewVirtualMachineScaleSetVMsClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewVirtualMachineScaleSetVMsClientWithBaseURI creates an instance of the VirtualMachineScaleSetVMsClient client.
+func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetVMsClient {
+ return VirtualMachineScaleSetVMsClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// Deallocate deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the
+// compute resources it uses. You are not billed for the compute resources of this virtual machine once it is
+// deallocated.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
+// is the instance ID of the virtual machine.
+func (client VirtualMachineScaleSetVMsClient) Deallocate(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsDeallocateFuture, err error) {
+ req, err := client.DeallocatePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeallocateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Deallocate", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeallocatePreparer prepares the Deallocate request.
+func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "instanceId": autorest.Encode("path", instanceID),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeallocateSender sends the Deallocate request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetVMsClient) DeallocateSender(req *http.Request) (future VirtualMachineScaleSetVMsDeallocateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// DeallocateResponder handles the response to the Deallocate request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Delete deletes a virtual machine from a VM scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
+// is the instance ID of the virtual machine.
+func (client VirtualMachineScaleSetVMsClient) Delete(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsDeleteFuture, err error) {
+ req, err := client.DeletePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeleteSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Delete", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeletePreparer prepares the Delete request.
+func (client VirtualMachineScaleSetVMsClient) DeletePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "instanceId": autorest.Encode("path", instanceID),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsDelete(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeleteSender sends the Delete request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetVMsClient) DeleteSender(req *http.Request) (future VirtualMachineScaleSetVMsDeleteFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
+ return
+}
+
+// DeleteResponder handles the response to the Delete request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Get gets a virtual machine from a VM scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
+// is the instance ID of the virtual machine.
+func (client VirtualMachineScaleSetVMsClient) Get(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVM, err error) {
+ req, err := client.GetPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Get", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetPreparer prepares the Get request.
+func (client VirtualMachineScaleSetVMsClient) GetPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "instanceId": autorest.Encode("path", instanceID),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetSender sends the Get request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetVMsClient) GetSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetResponder handles the response to the Get request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response) (result VirtualMachineScaleSetVM, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// GetInstanceView gets the status of a virtual machine from a VM scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
+// is the instance ID of the virtual machine.
+func (client VirtualMachineScaleSetVMsClient) GetInstanceView(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMInstanceView, err error) {
+ req, err := client.GetInstanceViewPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetInstanceViewSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetInstanceViewResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "GetInstanceView", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetInstanceViewPreparer prepares the GetInstanceView request.
+func (client VirtualMachineScaleSetVMsClient) GetInstanceViewPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "instanceId": autorest.Encode("path", instanceID),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetInstanceViewSender sends the GetInstanceView request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetVMsClient) GetInstanceViewSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetInstanceViewResponder handles the response to the GetInstanceView request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetVMsClient) GetInstanceViewResponder(resp *http.Response) (result VirtualMachineScaleSetVMInstanceView, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// List gets a list of all virtual machines in a VM scale sets.
+//
+// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the VM scale set.
+// filter is the filter to apply to the operation. selectParameter is the list parameters. expand is the expand
+// expression to apply to the operation.
+func (client VirtualMachineScaleSetVMsClient) List(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResultPage, err error) {
+ result.fn = client.listNextResults
+ req, err := client.ListPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.vmssvlr.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure sending request")
+ return
+ }
+
+ result.vmssvlr, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "List", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListPreparer prepares the List request.
+func (client VirtualMachineScaleSetVMsClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+ if len(filter) > 0 {
+ queryParameters["$filter"] = autorest.Encode("query", filter)
+ }
+ if len(selectParameter) > 0 {
+ queryParameters["$select"] = autorest.Encode("query", selectParameter)
+ }
+ if len(expand) > 0 {
+ queryParameters["$expand"] = autorest.Encode("query", expand)
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSender sends the List request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetVMsClient) ListSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListResponder handles the response to the List request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetVMsClient) ListResponder(resp *http.Response) (result VirtualMachineScaleSetVMListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// listNextResults retrieves the next set of results, if any.
+func (client VirtualMachineScaleSetVMsClient) listNextResults(lastResults VirtualMachineScaleSetVMListResult) (result VirtualMachineScaleSetVMListResult, err error) {
+ req, err := lastResults.virtualMachineScaleSetVMListResultPreparer()
+ if err != nil {
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "listNextResults", nil, "Failure preparing next results request")
+ }
+ if req == nil {
+ return
+ }
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "listNextResults", resp, "Failure sending next results request")
+ }
+ result, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "listNextResults", resp, "Failure responding to next results request")
+ }
+ return
+}
+
+// ListComplete enumerates all values, automatically crossing page boundaries as required.
+func (client VirtualMachineScaleSetVMsClient) ListComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (result VirtualMachineScaleSetVMListResultIterator, err error) {
+ result.page, err = client.List(ctx, resourceGroupName, virtualMachineScaleSetName, filter, selectParameter, expand)
+ return
+}
+
+// PowerOff power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are
+// getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
+// is the instance ID of the virtual machine.
+func (client VirtualMachineScaleSetVMsClient) PowerOff(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsPowerOffFuture, err error) {
+ req, err := client.PowerOffPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.PowerOffSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "PowerOff", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// PowerOffPreparer prepares the PowerOff request.
+func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "instanceId": autorest.Encode("path", instanceID),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// PowerOffSender sends the PowerOff request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetVMsClient) PowerOffSender(req *http.Request) (future VirtualMachineScaleSetVMsPowerOffFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// PowerOffResponder handles the response to the PowerOff request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Reimage reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
+// is the instance ID of the virtual machine.
+func (client VirtualMachineScaleSetVMsClient) Reimage(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsReimageFuture, err error) {
+ req, err := client.ReimagePreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.ReimageSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// ReimagePreparer prepares the Reimage request.
+func (client VirtualMachineScaleSetVMsClient) ReimagePreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "instanceId": autorest.Encode("path", instanceID),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ReimageSender sends the Reimage request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetVMsClient) ReimageSender(req *http.Request) (future VirtualMachineScaleSetVMsReimageFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// ReimageResponder handles the response to the Reimage request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetVMsClient) ReimageResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// ReimageAll allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This
+// operation is only supported for managed disks.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
+// is the instance ID of the virtual machine.
+func (client VirtualMachineScaleSetVMsClient) ReimageAll(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsReimageAllFuture, err error) {
+ req, err := client.ReimageAllPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.ReimageAllSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "ReimageAll", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// ReimageAllPreparer prepares the ReimageAll request.
+func (client VirtualMachineScaleSetVMsClient) ReimageAllPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "instanceId": autorest.Encode("path", instanceID),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ReimageAllSender sends the ReimageAll request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetVMsClient) ReimageAllSender(req *http.Request) (future VirtualMachineScaleSetVMsReimageAllFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// ReimageAllResponder handles the response to the ReimageAll request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetVMsClient) ReimageAllResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Restart restarts a virtual machine in a VM scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
+// is the instance ID of the virtual machine.
+func (client VirtualMachineScaleSetVMsClient) Restart(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsRestartFuture, err error) {
+ req, err := client.RestartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.RestartSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Restart", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// RestartPreparer prepares the Restart request.
+func (client VirtualMachineScaleSetVMsClient) RestartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "instanceId": autorest.Encode("path", instanceID),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// RestartSender sends the Restart request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetVMsClient) RestartSender(req *http.Request) (future VirtualMachineScaleSetVMsRestartFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// RestartResponder handles the response to the Restart request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Start starts a virtual machine in a VM scale set.
+//
+// resourceGroupName is the name of the resource group. VMScaleSetName is the name of the VM scale set. instanceID
+// is the instance ID of the virtual machine.
+func (client VirtualMachineScaleSetVMsClient) Start(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (result VirtualMachineScaleSetVMsStartFuture, err error) {
+ req, err := client.StartPreparer(ctx, resourceGroupName, VMScaleSetName, instanceID)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.StartSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Start", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// StartPreparer prepares the Start request.
+func (client VirtualMachineScaleSetVMsClient) StartPreparer(ctx context.Context, resourceGroupName string, VMScaleSetName string, instanceID string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "instanceId": autorest.Encode("path", instanceID),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ "vmScaleSetName": autorest.Encode("path", VMScaleSetName),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// StartSender sends the Start request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineScaleSetVMsClient) StartSender(req *http.Request) (future VirtualMachineScaleSetVMsStartFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
+ return
+}
+
+// StartResponder handles the response to the Start request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineScaleSetVMsClient) StartResponder(resp *http.Response) (result OperationStatusResponse, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
diff --git a/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachinesizes.go b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachinesizes.go
new file mode 100644
index 000000000000..7e0933c27238
--- /dev/null
+++ b/services/preview/compute/mgmt/2016-04-30-preview/compute/virtualmachinesizes.go
@@ -0,0 +1,112 @@
+package compute
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "github.com/Azure/go-autorest/autorest/validation"
+ "net/http"
+)
+
+// VirtualMachineSizesClient is the compute Client
+type VirtualMachineSizesClient struct {
+ BaseClient
+}
+
+// NewVirtualMachineSizesClient creates an instance of the VirtualMachineSizesClient client.
+func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient {
+ return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewVirtualMachineSizesClientWithBaseURI creates an instance of the VirtualMachineSizesClient client.
+func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient {
+ return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// List lists all available virtual machine sizes for a subscription in a location.
+//
+// location is the location upon which virtual-machine-sizes is queried.
+func (client VirtualMachineSizesClient) List(ctx context.Context, location string) (result VirtualMachineSizeListResult, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: location,
+ Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil {
+ return result, validation.NewError("compute.VirtualMachineSizesClient", "List", err.Error())
+ }
+
+ req, err := client.ListPreparer(ctx, location)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.ListResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListPreparer prepares the List request.
+func (client VirtualMachineSizesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "location": autorest.Encode("path", location),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2016-04-30-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListSender sends the List request. The method will close the
+// http.Response Body if it receives an error.
+func (client VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListResponder handles the response to the List request. The method always
+// closes the http.Response Body.
+func (client VirtualMachineSizesClient) ListResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
diff --git a/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/client.go b/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/client.go
new file mode 100644
index 000000000000..b89393d7cfb8
--- /dev/null
+++ b/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/client.go
@@ -0,0 +1,51 @@
+// Package containerservice implements the Azure ARM Containerservice service API version 2015-11-01-preview.
+//
+// Compute Client
+package containerservice
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "github.com/Azure/go-autorest/autorest"
+)
+
+const (
+ // DefaultBaseURI is the default URI used for the service Containerservice
+ DefaultBaseURI = "https://management.azure.com"
+)
+
+// BaseClient is the base client for Containerservice.
+type BaseClient struct {
+ autorest.Client
+ BaseURI string
+ SubscriptionID string
+}
+
+// New creates an instance of the BaseClient client.
+func New(subscriptionID string) BaseClient {
+ return NewWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewWithBaseURI creates an instance of the BaseClient client.
+func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
+ return BaseClient{
+ Client: autorest.NewClientWithUserAgent(UserAgent()),
+ BaseURI: baseURI,
+ SubscriptionID: subscriptionID,
+ }
+}
diff --git a/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/containerservice.go b/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/containerservice.go
new file mode 100644
index 000000000000..d33e5569acaf
--- /dev/null
+++ b/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/containerservice.go
@@ -0,0 +1,331 @@
+package containerservice
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "context"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "github.com/Azure/go-autorest/autorest/validation"
+ "net/http"
+)
+
+// Client is the compute Client
+type Client struct {
+ BaseClient
+}
+
+// NewClient creates an instance of the Client client.
+func NewClient(subscriptionID string) Client {
+ return NewClientWithBaseURI(DefaultBaseURI, subscriptionID)
+}
+
+// NewClientWithBaseURI creates an instance of the Client client.
+func NewClientWithBaseURI(baseURI string, subscriptionID string) Client {
+ return Client{NewWithBaseURI(baseURI, subscriptionID)}
+}
+
+// CreateOrUpdate the operation to create or update a container service.
+//
+// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service
+// within the given subscription and resource group. parameters is parameters supplied to the Create Container
+// Service operation.
+func (client Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (result CreateOrUpdateFuture, err error) {
+ if err := validation.Validate([]validation.Validation{
+ {TargetValue: parameters,
+ Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "parameters.Properties.MasterProfile", Name: validation.Null, Rule: true,
+ Chain: []validation.Constraint{{Target: "parameters.Properties.MasterProfile.DNSPrefix", Name: validation.Null, Rule: true, Chain: nil}}},
+ {Target: "parameters.Properties.AgentPoolProfiles", Name: validation.Null, Rule: true, Chain: nil},
+ {Target: "parameters.Properties.WindowsProfile", Name: validation.Null, Rule: false,
+ Chain: []validation.Constraint{{Target: "parameters.Properties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true, Chain: nil},
+ {Target: "parameters.Properties.WindowsProfile.AdminPassword", Name: validation.Null, Rule: true, Chain: nil},
+ }},
+ {Target: "parameters.Properties.LinuxProfile", Name: validation.Null, Rule: true,
+ Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true, Chain: nil},
+ {Target: "parameters.Properties.LinuxProfile.SSH", Name: validation.Null, Rule: true, Chain: nil},
+ }},
+ }}}}}); err != nil {
+ return result, validation.NewError("containerservice.Client", "CreateOrUpdate", err.Error())
+ }
+
+ req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, containerServiceName, parameters)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.Client", "CreateOrUpdate", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.CreateOrUpdateSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.Client", "CreateOrUpdate", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
+func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "containerServiceName": autorest.Encode("path", containerServiceName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2015-11-01-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsContentType("application/json; charset=utf-8"),
+ autorest.AsPut(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters),
+ autorest.WithJSON(parameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
+// http.Response Body if it receives an error.
+func (client Client) CreateOrUpdateSender(req *http.Request) (future CreateOrUpdateFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted))
+ return
+}
+
+// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
+// closes the http.Response Body.
+func (client Client) CreateOrUpdateResponder(resp *http.Response) (result ContainerService, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// Delete the operation to delete a container service.
+//
+// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service
+// within the given subscription and resource group.
+func (client Client) Delete(ctx context.Context, resourceGroupName string, containerServiceName string) (result DeleteFuture, err error) {
+ req, err := client.DeletePreparer(ctx, resourceGroupName, containerServiceName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.Client", "Delete", nil, "Failure preparing request")
+ return
+ }
+
+ result, err = client.DeleteSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.Client", "Delete", result.Response(), "Failure sending request")
+ return
+ }
+
+ return
+}
+
+// DeletePreparer prepares the Delete request.
+func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "containerServiceName": autorest.Encode("path", containerServiceName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2015-11-01-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsDelete(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// DeleteSender sends the Delete request. The method will close the
+// http.Response Body if it receives an error.
+func (client Client) DeleteSender(req *http.Request) (future DeleteFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
+ return
+}
+
+// DeleteResponder handles the response to the Delete request. The method always
+// closes the http.Response Body.
+func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
+ autorest.ByClosing())
+ result.Response = resp
+ return
+}
+
+// Get the operation to get a container service.
+//
+// resourceGroupName is the name of the resource group. containerServiceName is the name of the container service
+// within the given subscription and resource group.
+func (client Client) Get(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerService, err error) {
+ req, err := client.GetPreparer(ctx, resourceGroupName, containerServiceName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.Client", "Get", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.GetSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "containerservice.Client", "Get", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.GetResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.Client", "Get", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// GetPreparer prepares the Get request.
+func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "containerServiceName": autorest.Encode("path", containerServiceName),
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2015-11-01-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// GetSender sends the Get request. The method will close the
+// http.Response Body if it receives an error.
+func (client Client) GetSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// GetResponder handles the response to the Get request. The method always
+// closes the http.Response Body.
+func (client Client) GetResponder(resp *http.Response) (result ContainerService, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
+
+// ListByResourceGroup the operation to list container services.
+//
+// resourceGroupName is the name of the resource group.
+func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListResult, err error) {
+ req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.Client", "ListByResourceGroup", nil, "Failure preparing request")
+ return
+ }
+
+ resp, err := client.ListByResourceGroupSender(req)
+ if err != nil {
+ result.Response = autorest.Response{Response: resp}
+ err = autorest.NewErrorWithError(err, "containerservice.Client", "ListByResourceGroup", resp, "Failure sending request")
+ return
+ }
+
+ result, err = client.ListByResourceGroupResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.Client", "ListByResourceGroup", resp, "Failure responding to request")
+ }
+
+ return
+}
+
+// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
+func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
+ pathParameters := map[string]interface{}{
+ "resourceGroupName": autorest.Encode("path", resourceGroupName),
+ "subscriptionId": autorest.Encode("path", client.SubscriptionID),
+ }
+
+ const APIVersion = "2015-11-01-preview"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(client.BaseURI),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices", pathParameters),
+ autorest.WithQueryParameters(queryParameters))
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
+}
+
+// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
+// http.Response Body if it receives an error.
+func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
+}
+
+// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
+// closes the http.Response Body.
+func (client Client) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) {
+ err = autorest.Respond(
+ resp,
+ client.ByInspecting(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&result),
+ autorest.ByClosing())
+ result.Response = autorest.Response{Response: resp}
+ return
+}
diff --git a/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/models.go b/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/models.go
new file mode 100644
index 000000000000..5c03ec5d270a
--- /dev/null
+++ b/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/models.go
@@ -0,0 +1,484 @@
+package containerservice
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "encoding/json"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "net/http"
+)
+
+// OchestratorTypes enumerates the values for ochestrator types.
+type OchestratorTypes string
+
+const (
+ // DCOS ...
+ DCOS OchestratorTypes = "DCOS"
+ // Mesos ...
+ Mesos OchestratorTypes = "Mesos"
+ // SwarmPreview ...
+ SwarmPreview OchestratorTypes = "SwarmPreview"
+)
+
+// PossibleOchestratorTypesValues returns an array of possible values for the OchestratorTypes const type.
+func PossibleOchestratorTypesValues() []OchestratorTypes {
+ return []OchestratorTypes{DCOS, Mesos, SwarmPreview}
+}
+
+// VMSizeTypes enumerates the values for vm size types.
+type VMSizeTypes string
+
+const (
+ // StandardA0 ...
+ StandardA0 VMSizeTypes = "Standard_A0"
+ // StandardA1 ...
+ StandardA1 VMSizeTypes = "Standard_A1"
+ // StandardA10 ...
+ StandardA10 VMSizeTypes = "Standard_A10"
+ // StandardA11 ...
+ StandardA11 VMSizeTypes = "Standard_A11"
+ // StandardA2 ...
+ StandardA2 VMSizeTypes = "Standard_A2"
+ // StandardA3 ...
+ StandardA3 VMSizeTypes = "Standard_A3"
+ // StandardA4 ...
+ StandardA4 VMSizeTypes = "Standard_A4"
+ // StandardA5 ...
+ StandardA5 VMSizeTypes = "Standard_A5"
+ // StandardA6 ...
+ StandardA6 VMSizeTypes = "Standard_A6"
+ // StandardA7 ...
+ StandardA7 VMSizeTypes = "Standard_A7"
+ // StandardA8 ...
+ StandardA8 VMSizeTypes = "Standard_A8"
+ // StandardA9 ...
+ StandardA9 VMSizeTypes = "Standard_A9"
+ // StandardD1 ...
+ StandardD1 VMSizeTypes = "Standard_D1"
+ // StandardD11 ...
+ StandardD11 VMSizeTypes = "Standard_D11"
+ // StandardD11V2 ...
+ StandardD11V2 VMSizeTypes = "Standard_D11_v2"
+ // StandardD12 ...
+ StandardD12 VMSizeTypes = "Standard_D12"
+ // StandardD12V2 ...
+ StandardD12V2 VMSizeTypes = "Standard_D12_v2"
+ // StandardD13 ...
+ StandardD13 VMSizeTypes = "Standard_D13"
+ // StandardD13V2 ...
+ StandardD13V2 VMSizeTypes = "Standard_D13_v2"
+ // StandardD14 ...
+ StandardD14 VMSizeTypes = "Standard_D14"
+ // StandardD14V2 ...
+ StandardD14V2 VMSizeTypes = "Standard_D14_v2"
+ // StandardD1V2 ...
+ StandardD1V2 VMSizeTypes = "Standard_D1_v2"
+ // StandardD2 ...
+ StandardD2 VMSizeTypes = "Standard_D2"
+ // StandardD2V2 ...
+ StandardD2V2 VMSizeTypes = "Standard_D2_v2"
+ // StandardD3 ...
+ StandardD3 VMSizeTypes = "Standard_D3"
+ // StandardD3V2 ...
+ StandardD3V2 VMSizeTypes = "Standard_D3_v2"
+ // StandardD4 ...
+ StandardD4 VMSizeTypes = "Standard_D4"
+ // StandardD4V2 ...
+ StandardD4V2 VMSizeTypes = "Standard_D4_v2"
+ // StandardD5V2 ...
+ StandardD5V2 VMSizeTypes = "Standard_D5_v2"
+ // StandardDS1 ...
+ StandardDS1 VMSizeTypes = "Standard_DS1"
+ // StandardDS11 ...
+ StandardDS11 VMSizeTypes = "Standard_DS11"
+ // StandardDS12 ...
+ StandardDS12 VMSizeTypes = "Standard_DS12"
+ // StandardDS13 ...
+ StandardDS13 VMSizeTypes = "Standard_DS13"
+ // StandardDS14 ...
+ StandardDS14 VMSizeTypes = "Standard_DS14"
+ // StandardDS2 ...
+ StandardDS2 VMSizeTypes = "Standard_DS2"
+ // StandardDS3 ...
+ StandardDS3 VMSizeTypes = "Standard_DS3"
+ // StandardDS4 ...
+ StandardDS4 VMSizeTypes = "Standard_DS4"
+ // StandardG1 ...
+ StandardG1 VMSizeTypes = "Standard_G1"
+ // StandardG2 ...
+ StandardG2 VMSizeTypes = "Standard_G2"
+ // StandardG3 ...
+ StandardG3 VMSizeTypes = "Standard_G3"
+ // StandardG4 ...
+ StandardG4 VMSizeTypes = "Standard_G4"
+ // StandardG5 ...
+ StandardG5 VMSizeTypes = "Standard_G5"
+ // StandardGS1 ...
+ StandardGS1 VMSizeTypes = "Standard_GS1"
+ // StandardGS2 ...
+ StandardGS2 VMSizeTypes = "Standard_GS2"
+ // StandardGS3 ...
+ StandardGS3 VMSizeTypes = "Standard_GS3"
+ // StandardGS4 ...
+ StandardGS4 VMSizeTypes = "Standard_GS4"
+ // StandardGS5 ...
+ StandardGS5 VMSizeTypes = "Standard_GS5"
+)
+
+// PossibleVMSizeTypesValues returns an array of possible values for the VMSizeTypes const type.
+func PossibleVMSizeTypesValues() []VMSizeTypes {
+ return []VMSizeTypes{StandardA0, StandardA1, StandardA10, StandardA11, StandardA2, StandardA3, StandardA4, StandardA5, StandardA6, StandardA7, StandardA8, StandardA9, StandardD1, StandardD11, StandardD11V2, StandardD12, StandardD12V2, StandardD13, StandardD13V2, StandardD14, StandardD14V2, StandardD1V2, StandardD2, StandardD2V2, StandardD3, StandardD3V2, StandardD4, StandardD4V2, StandardD5V2, StandardDS1, StandardDS11, StandardDS12, StandardDS13, StandardDS14, StandardDS2, StandardDS3, StandardDS4, StandardG1, StandardG2, StandardG3, StandardG4, StandardG5, StandardGS1, StandardGS2, StandardGS3, StandardGS4, StandardGS5}
+}
+
+// AgentPoolProfile profile for container service agent pool
+type AgentPoolProfile struct {
+ // Name - Unique name of the agent pool profile within the context of the subscription and resource group
+ Name *string `json:"name,omitempty"`
+ // Count - No. of agents (VMs) that will host docker containers
+ Count *int32 `json:"count,omitempty"`
+ // VMSize - Size of agent VMs. Possible values include: 'StandardA0', 'StandardA1', 'StandardA2', 'StandardA3', 'StandardA4', 'StandardA5', 'StandardA6', 'StandardA7', 'StandardA8', 'StandardA9', 'StandardA10', 'StandardA11', 'StandardD1', 'StandardD2', 'StandardD3', 'StandardD4', 'StandardD11', 'StandardD12', 'StandardD13', 'StandardD14', 'StandardD1V2', 'StandardD2V2', 'StandardD3V2', 'StandardD4V2', 'StandardD5V2', 'StandardD11V2', 'StandardD12V2', 'StandardD13V2', 'StandardD14V2', 'StandardG1', 'StandardG2', 'StandardG3', 'StandardG4', 'StandardG5', 'StandardDS1', 'StandardDS2', 'StandardDS3', 'StandardDS4', 'StandardDS11', 'StandardDS12', 'StandardDS13', 'StandardDS14', 'StandardGS1', 'StandardGS2', 'StandardGS3', 'StandardGS4', 'StandardGS5'
+ VMSize VMSizeTypes `json:"vmSize,omitempty"`
+ // DNSPrefix - DNS prefix to be used to create FQDN for this agent pool
+ DNSPrefix *string `json:"dnsPrefix,omitempty"`
+ // Fqdn - FDQN for the agent pool
+ Fqdn *string `json:"fqdn,omitempty"`
+}
+
+// ContainerService container service
+type ContainerService struct {
+ autorest.Response `json:"-"`
+ *Properties `json:"properties,omitempty"`
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for ContainerService.
+func (cs ContainerService) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if cs.Properties != nil {
+ objectMap["properties"] = cs.Properties
+ }
+ if cs.ID != nil {
+ objectMap["id"] = cs.ID
+ }
+ if cs.Name != nil {
+ objectMap["name"] = cs.Name
+ }
+ if cs.Type != nil {
+ objectMap["type"] = cs.Type
+ }
+ if cs.Location != nil {
+ objectMap["location"] = cs.Location
+ }
+ if cs.Tags != nil {
+ objectMap["tags"] = cs.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for ContainerService struct.
+func (cs *ContainerService) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "properties":
+ if v != nil {
+ var properties Properties
+ err = json.Unmarshal(*v, &properties)
+ if err != nil {
+ return err
+ }
+ cs.Properties = &properties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ cs.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ cs.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ cs.Type = &typeVar
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ cs.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ cs.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type CreateOrUpdateFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future CreateOrUpdateFuture) Result(client Client) (cs ContainerService, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return cs, azure.NewAsyncOpIncompleteError("containerservice.CreateOrUpdateFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ cs, err = client.CreateOrUpdateResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.CreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.CreateOrUpdateFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ cs, err = client.CreateOrUpdateResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.CreateOrUpdateFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type DeleteFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future DeleteFuture) Result(client Client) (ar autorest.Response, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.DeleteFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return ar, azure.NewAsyncOpIncompleteError("containerservice.DeleteFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ ar, err = client.DeleteResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.DeleteFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.DeleteFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ ar, err = client.DeleteResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "containerservice.DeleteFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
+
+// DiagnosticsProfile ...
+type DiagnosticsProfile struct {
+ // VMDiagnostics - Profile for container service VM diagnostic agent
+ VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"`
+}
+
+// LinuxProfile profile for Linux VM
+type LinuxProfile struct {
+ // AdminUsername - The administrator username to use for all Linux VMs
+ AdminUsername *string `json:"adminUsername,omitempty"`
+ // SSH - Specifies the ssh key configuration for Linux VMs
+ SSH *SSHConfiguration `json:"ssh,omitempty"`
+}
+
+// ListResult the List Container Service operation response
+type ListResult struct {
+ autorest.Response `json:"-"`
+ // Value - Gets or sets the list of container services.
+ Value *[]ContainerService `json:"value,omitempty"`
+}
+
+// MasterProfile profile for container service master
+type MasterProfile struct {
+ // Count - Number of masters (VMs) in the container cluster
+ Count *int32 `json:"count,omitempty"`
+ // DNSPrefix - DNS prefix to be used to create FQDN for master
+ DNSPrefix *string `json:"dnsPrefix,omitempty"`
+ // Fqdn - FDQN for the master
+ Fqdn *string `json:"fqdn,omitempty"`
+}
+
+// OrchestratorProfile profile for Orchestrator
+type OrchestratorProfile struct {
+ // OrchestratorType - Specifies what orchestrator will be used to manage container cluster resources. Possible values include: 'Mesos', 'SwarmPreview', 'DCOS'
+ OrchestratorType OchestratorTypes `json:"orchestratorType,omitempty"`
+}
+
+// Properties properties of container service
+type Properties struct {
+ // ProvisioningState - Gets the provisioning state, which only appears in the response.
+ ProvisioningState *string `json:"provisioningState,omitempty"`
+ // OrchestratorProfile - Properties of orchestrator
+ OrchestratorProfile *OrchestratorProfile `json:"orchestratorProfile,omitempty"`
+ // MasterProfile - Properties of master agents
+ MasterProfile *MasterProfile `json:"masterProfile,omitempty"`
+ // AgentPoolProfiles - Properties of agent pools
+ AgentPoolProfiles *[]AgentPoolProfile `json:"agentPoolProfiles,omitempty"`
+ // WindowsProfile - Properties of Windows VMs
+ WindowsProfile *WindowsProfile `json:"windowsProfile,omitempty"`
+ // LinuxProfile - Properties for Linux VMs
+ LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"`
+ // DiagnosticsProfile - Properties for Diagnostic Agent
+ DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"`
+}
+
+// Resource the Resource model definition.
+type Resource struct {
+ // ID - Resource Id
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for Resource.
+func (r Resource) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if r.ID != nil {
+ objectMap["id"] = r.ID
+ }
+ if r.Name != nil {
+ objectMap["name"] = r.Name
+ }
+ if r.Type != nil {
+ objectMap["type"] = r.Type
+ }
+ if r.Location != nil {
+ objectMap["location"] = r.Location
+ }
+ if r.Tags != nil {
+ objectMap["tags"] = r.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// SSHConfiguration SSH configuration for Linux based VMs running on Azure
+type SSHConfiguration struct {
+ // PublicKeys - Gets or sets the list of SSH public keys used to authenticate with Linux based VMs
+ PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"`
+}
+
+// SSHPublicKey contains information about SSH certificate public key data.
+type SSHPublicKey struct {
+ // KeyData - Gets or sets Certificate public key used to authenticate with VM through SSH. The certificate must be in Pem format with or without headers.
+ KeyData *string `json:"keyData,omitempty"`
+}
+
+// VMDiagnostics describes VM Diagnostics.
+type VMDiagnostics struct {
+ // Enabled - Gets or sets whether VM Diagnostic Agent should be provisioned on the Virtual Machine.
+ Enabled *bool `json:"enabled,omitempty"`
+ // StorageURI - Gets or sets whether VM Diagnostic Agent should be provisioned on the Virtual Machine.
+ StorageURI *string `json:"storageUri,omitempty"`
+}
+
+// WindowsProfile profile for Windows jumpbox
+type WindowsProfile struct {
+ // AdminUsername - The administrator username to use for Windows jumpbox
+ AdminUsername *string `json:"adminUsername,omitempty"`
+ // AdminPassword - The administrator password to use for Windows jumpbox
+ AdminPassword *string `json:"adminPassword,omitempty"`
+}
diff --git a/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/version.go b/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/version.go
new file mode 100644
index 000000000000..4a7c07f401c0
--- /dev/null
+++ b/services/preview/containerservice/mgmt/2015-11-01-preview/containerservice/version.go
@@ -0,0 +1,30 @@
+package containerservice
+
+import "github.com/Azure/azure-sdk-for-go/version"
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// UserAgent returns the UserAgent string to use when sending http.Requests.
+func UserAgent() string {
+ return "Azure-SDK-For-Go/" + version.Number + " containerservice/2015-11-01-preview"
+}
+
+// Version returns the semantic version (see http://semver.org) of the client.
+func Version() string {
+ return version.Number
+}