1package compute 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "github.com/Azure/go-autorest/autorest/date" 15 "github.com/Azure/go-autorest/autorest/to" 16 "github.com/Azure/go-autorest/tracing" 17 "net/http" 18) 19 20// The package's fully qualified name. 21const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/compute/mgmt/2016-04-30-preview/compute" 22 23// AccessURI a disk access SAS uri. 24type AccessURI struct { 25 autorest.Response `json:"-"` 26 // AccessURIOutput - Operation output data (raw JSON) 27 *AccessURIOutput `json:"properties,omitempty"` 28} 29 30// MarshalJSON is the custom marshaler for AccessURI. 31func (au AccessURI) MarshalJSON() ([]byte, error) { 32 objectMap := make(map[string]interface{}) 33 if au.AccessURIOutput != nil { 34 objectMap["properties"] = au.AccessURIOutput 35 } 36 return json.Marshal(objectMap) 37} 38 39// UnmarshalJSON is the custom unmarshaler for AccessURI struct. 40func (au *AccessURI) UnmarshalJSON(body []byte) error { 41 var m map[string]*json.RawMessage 42 err := json.Unmarshal(body, &m) 43 if err != nil { 44 return err 45 } 46 for k, v := range m { 47 switch k { 48 case "properties": 49 if v != nil { 50 var accessURIOutput AccessURIOutput 51 err = json.Unmarshal(*v, &accessURIOutput) 52 if err != nil { 53 return err 54 } 55 au.AccessURIOutput = &accessURIOutput 56 } 57 } 58 } 59 60 return nil 61} 62 63// AccessURIOutput azure properties, including output. 64type AccessURIOutput struct { 65 // AccessURIRaw - Operation output data (raw JSON) 66 *AccessURIRaw `json:"output,omitempty"` 67} 68 69// MarshalJSON is the custom marshaler for AccessURIOutput. 70func (auo AccessURIOutput) MarshalJSON() ([]byte, error) { 71 objectMap := make(map[string]interface{}) 72 if auo.AccessURIRaw != nil { 73 objectMap["output"] = auo.AccessURIRaw 74 } 75 return json.Marshal(objectMap) 76} 77 78// UnmarshalJSON is the custom unmarshaler for AccessURIOutput struct. 79func (auo *AccessURIOutput) UnmarshalJSON(body []byte) error { 80 var m map[string]*json.RawMessage 81 err := json.Unmarshal(body, &m) 82 if err != nil { 83 return err 84 } 85 for k, v := range m { 86 switch k { 87 case "output": 88 if v != nil { 89 var accessURIRaw AccessURIRaw 90 err = json.Unmarshal(*v, &accessURIRaw) 91 if err != nil { 92 return err 93 } 94 auo.AccessURIRaw = &accessURIRaw 95 } 96 } 97 } 98 99 return nil 100} 101 102// AccessURIRaw this object gets 'bubbled up' through flattening. 103type AccessURIRaw struct { 104 // AccessSAS - READ-ONLY; A SAS uri for accessing a disk. 105 AccessSAS *string `json:"accessSAS,omitempty"` 106} 107 108// MarshalJSON is the custom marshaler for AccessURIRaw. 109func (aur AccessURIRaw) MarshalJSON() ([]byte, error) { 110 objectMap := make(map[string]interface{}) 111 return json.Marshal(objectMap) 112} 113 114// AdditionalUnattendContent specifies additional XML formatted information that can be included in the 115// Unattend.xml file, which is used by Windows Setup. Contents are defined by setting name, component name, 116// and the pass in which the content is applied. 117type AdditionalUnattendContent struct { 118 // PassName - The pass name. Currently, the only allowable value is OobeSystem. Possible values include: 'OobeSystem' 119 PassName PassNames `json:"passName,omitempty"` 120 // ComponentName - The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. Possible values include: 'MicrosoftWindowsShellSetup' 121 ComponentName ComponentNames `json:"componentName,omitempty"` 122 // SettingName - Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. Possible values include: 'AutoLogon', 'FirstLogonCommands' 123 SettingName SettingNames `json:"settingName,omitempty"` 124 // 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. 125 Content *string `json:"content,omitempty"` 126} 127 128// APIEntityReference the API entity reference. 129type APIEntityReference struct { 130 // ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... 131 ID *string `json:"id,omitempty"` 132} 133 134// APIError api error. 135type APIError struct { 136 // Details - The Api error details 137 Details *[]APIErrorBase `json:"details,omitempty"` 138 // Innererror - The Api inner error 139 Innererror *InnerError `json:"innererror,omitempty"` 140 // Code - The error code. 141 Code *string `json:"code,omitempty"` 142 // Target - The target of the particular error. 143 Target *string `json:"target,omitempty"` 144 // Message - The error message. 145 Message *string `json:"message,omitempty"` 146} 147 148// APIErrorBase api error base. 149type APIErrorBase struct { 150 // Code - The error code. 151 Code *string `json:"code,omitempty"` 152 // Target - The target of the particular error. 153 Target *string `json:"target,omitempty"` 154 // Message - The error message. 155 Message *string `json:"message,omitempty"` 156} 157 158// AvailabilitySet specifies information about the availability set that the virtual machine should be 159// assigned to. Virtual machines specified in the same availability set are allocated to different nodes to 160// maximize availability. For more information about availability sets, see [Manage the availability of 161// virtual 162// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). 163// <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual 164// machines in 165// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) 166// <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot 167// be added to an availability set. 168type AvailabilitySet struct { 169 autorest.Response `json:"-"` 170 *AvailabilitySetProperties `json:"properties,omitempty"` 171 // Sku - Sku of the availability set 172 Sku *Sku `json:"sku,omitempty"` 173 // ID - READ-ONLY; Resource Id 174 ID *string `json:"id,omitempty"` 175 // Name - READ-ONLY; Resource name 176 Name *string `json:"name,omitempty"` 177 // Type - READ-ONLY; Resource type 178 Type *string `json:"type,omitempty"` 179 // Location - Resource location 180 Location *string `json:"location,omitempty"` 181 // Tags - Resource tags 182 Tags map[string]*string `json:"tags"` 183} 184 185// MarshalJSON is the custom marshaler for AvailabilitySet. 186func (as AvailabilitySet) MarshalJSON() ([]byte, error) { 187 objectMap := make(map[string]interface{}) 188 if as.AvailabilitySetProperties != nil { 189 objectMap["properties"] = as.AvailabilitySetProperties 190 } 191 if as.Sku != nil { 192 objectMap["sku"] = as.Sku 193 } 194 if as.Location != nil { 195 objectMap["location"] = as.Location 196 } 197 if as.Tags != nil { 198 objectMap["tags"] = as.Tags 199 } 200 return json.Marshal(objectMap) 201} 202 203// UnmarshalJSON is the custom unmarshaler for AvailabilitySet struct. 204func (as *AvailabilitySet) UnmarshalJSON(body []byte) error { 205 var m map[string]*json.RawMessage 206 err := json.Unmarshal(body, &m) 207 if err != nil { 208 return err 209 } 210 for k, v := range m { 211 switch k { 212 case "properties": 213 if v != nil { 214 var availabilitySetProperties AvailabilitySetProperties 215 err = json.Unmarshal(*v, &availabilitySetProperties) 216 if err != nil { 217 return err 218 } 219 as.AvailabilitySetProperties = &availabilitySetProperties 220 } 221 case "sku": 222 if v != nil { 223 var sku Sku 224 err = json.Unmarshal(*v, &sku) 225 if err != nil { 226 return err 227 } 228 as.Sku = &sku 229 } 230 case "id": 231 if v != nil { 232 var ID string 233 err = json.Unmarshal(*v, &ID) 234 if err != nil { 235 return err 236 } 237 as.ID = &ID 238 } 239 case "name": 240 if v != nil { 241 var name string 242 err = json.Unmarshal(*v, &name) 243 if err != nil { 244 return err 245 } 246 as.Name = &name 247 } 248 case "type": 249 if v != nil { 250 var typeVar string 251 err = json.Unmarshal(*v, &typeVar) 252 if err != nil { 253 return err 254 } 255 as.Type = &typeVar 256 } 257 case "location": 258 if v != nil { 259 var location string 260 err = json.Unmarshal(*v, &location) 261 if err != nil { 262 return err 263 } 264 as.Location = &location 265 } 266 case "tags": 267 if v != nil { 268 var tags map[string]*string 269 err = json.Unmarshal(*v, &tags) 270 if err != nil { 271 return err 272 } 273 as.Tags = tags 274 } 275 } 276 } 277 278 return nil 279} 280 281// AvailabilitySetListResult the List Availability Set operation response. 282type AvailabilitySetListResult struct { 283 autorest.Response `json:"-"` 284 // Value - The list of availability sets 285 Value *[]AvailabilitySet `json:"value,omitempty"` 286 // NextLink - The URI to fetch the next page of AvailabilitySets. Call ListNext() with this URI to fetch the next page of AvailabilitySets. 287 NextLink *string `json:"nextLink,omitempty"` 288} 289 290// AvailabilitySetListResultIterator provides access to a complete listing of AvailabilitySet values. 291type AvailabilitySetListResultIterator struct { 292 i int 293 page AvailabilitySetListResultPage 294} 295 296// NextWithContext advances to the next value. If there was an error making 297// the request the iterator does not advance and the error is returned. 298func (iter *AvailabilitySetListResultIterator) NextWithContext(ctx context.Context) (err error) { 299 if tracing.IsEnabled() { 300 ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetListResultIterator.NextWithContext") 301 defer func() { 302 sc := -1 303 if iter.Response().Response.Response != nil { 304 sc = iter.Response().Response.Response.StatusCode 305 } 306 tracing.EndSpan(ctx, sc, err) 307 }() 308 } 309 iter.i++ 310 if iter.i < len(iter.page.Values()) { 311 return nil 312 } 313 err = iter.page.NextWithContext(ctx) 314 if err != nil { 315 iter.i-- 316 return err 317 } 318 iter.i = 0 319 return nil 320} 321 322// Next advances to the next value. If there was an error making 323// the request the iterator does not advance and the error is returned. 324// Deprecated: Use NextWithContext() instead. 325func (iter *AvailabilitySetListResultIterator) Next() error { 326 return iter.NextWithContext(context.Background()) 327} 328 329// NotDone returns true if the enumeration should be started or is not yet complete. 330func (iter AvailabilitySetListResultIterator) NotDone() bool { 331 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 332} 333 334// Response returns the raw server response from the last page request. 335func (iter AvailabilitySetListResultIterator) Response() AvailabilitySetListResult { 336 return iter.page.Response() 337} 338 339// Value returns the current value or a zero-initialized value if the 340// iterator has advanced beyond the end of the collection. 341func (iter AvailabilitySetListResultIterator) Value() AvailabilitySet { 342 if !iter.page.NotDone() { 343 return AvailabilitySet{} 344 } 345 return iter.page.Values()[iter.i] 346} 347 348// Creates a new instance of the AvailabilitySetListResultIterator type. 349func NewAvailabilitySetListResultIterator(page AvailabilitySetListResultPage) AvailabilitySetListResultIterator { 350 return AvailabilitySetListResultIterator{page: page} 351} 352 353// IsEmpty returns true if the ListResult contains no values. 354func (aslr AvailabilitySetListResult) IsEmpty() bool { 355 return aslr.Value == nil || len(*aslr.Value) == 0 356} 357 358// hasNextLink returns true if the NextLink is not empty. 359func (aslr AvailabilitySetListResult) hasNextLink() bool { 360 return aslr.NextLink != nil && len(*aslr.NextLink) != 0 361} 362 363// availabilitySetListResultPreparer prepares a request to retrieve the next set of results. 364// It returns nil if no more results exist. 365func (aslr AvailabilitySetListResult) availabilitySetListResultPreparer(ctx context.Context) (*http.Request, error) { 366 if !aslr.hasNextLink() { 367 return nil, nil 368 } 369 return autorest.Prepare((&http.Request{}).WithContext(ctx), 370 autorest.AsJSON(), 371 autorest.AsGet(), 372 autorest.WithBaseURL(to.String(aslr.NextLink))) 373} 374 375// AvailabilitySetListResultPage contains a page of AvailabilitySet values. 376type AvailabilitySetListResultPage struct { 377 fn func(context.Context, AvailabilitySetListResult) (AvailabilitySetListResult, error) 378 aslr AvailabilitySetListResult 379} 380 381// NextWithContext advances to the next page of values. If there was an error making 382// the request the page does not advance and the error is returned. 383func (page *AvailabilitySetListResultPage) NextWithContext(ctx context.Context) (err error) { 384 if tracing.IsEnabled() { 385 ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetListResultPage.NextWithContext") 386 defer func() { 387 sc := -1 388 if page.Response().Response.Response != nil { 389 sc = page.Response().Response.Response.StatusCode 390 } 391 tracing.EndSpan(ctx, sc, err) 392 }() 393 } 394 for { 395 next, err := page.fn(ctx, page.aslr) 396 if err != nil { 397 return err 398 } 399 page.aslr = next 400 if !next.hasNextLink() || !next.IsEmpty() { 401 break 402 } 403 } 404 return nil 405} 406 407// Next advances to the next page of values. If there was an error making 408// the request the page does not advance and the error is returned. 409// Deprecated: Use NextWithContext() instead. 410func (page *AvailabilitySetListResultPage) Next() error { 411 return page.NextWithContext(context.Background()) 412} 413 414// NotDone returns true if the page enumeration should be started or is not yet complete. 415func (page AvailabilitySetListResultPage) NotDone() bool { 416 return !page.aslr.IsEmpty() 417} 418 419// Response returns the raw server response from the last page request. 420func (page AvailabilitySetListResultPage) Response() AvailabilitySetListResult { 421 return page.aslr 422} 423 424// Values returns the slice of values for the current page or nil if there are no values. 425func (page AvailabilitySetListResultPage) Values() []AvailabilitySet { 426 if page.aslr.IsEmpty() { 427 return nil 428 } 429 return *page.aslr.Value 430} 431 432// Creates a new instance of the AvailabilitySetListResultPage type. 433func NewAvailabilitySetListResultPage(cur AvailabilitySetListResult, getNextPage func(context.Context, AvailabilitySetListResult) (AvailabilitySetListResult, error)) AvailabilitySetListResultPage { 434 return AvailabilitySetListResultPage{ 435 fn: getNextPage, 436 aslr: cur, 437 } 438} 439 440// AvailabilitySetProperties the instance view of a resource. 441type AvailabilitySetProperties struct { 442 // PlatformUpdateDomainCount - Update Domain count. 443 PlatformUpdateDomainCount *int32 `json:"platformUpdateDomainCount,omitempty"` 444 // PlatformFaultDomainCount - Fault Domain count. 445 PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` 446 // VirtualMachines - A list of references to all virtual machines in the availability set. 447 VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"` 448 // Statuses - READ-ONLY; The resource status information. 449 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 450 // Managed - If the availability set supports managed disks. 451 Managed *bool `json:"managed,omitempty"` 452} 453 454// MarshalJSON is the custom marshaler for AvailabilitySetProperties. 455func (asp AvailabilitySetProperties) MarshalJSON() ([]byte, error) { 456 objectMap := make(map[string]interface{}) 457 if asp.PlatformUpdateDomainCount != nil { 458 objectMap["platformUpdateDomainCount"] = asp.PlatformUpdateDomainCount 459 } 460 if asp.PlatformFaultDomainCount != nil { 461 objectMap["platformFaultDomainCount"] = asp.PlatformFaultDomainCount 462 } 463 if asp.VirtualMachines != nil { 464 objectMap["virtualMachines"] = asp.VirtualMachines 465 } 466 if asp.Managed != nil { 467 objectMap["managed"] = asp.Managed 468 } 469 return json.Marshal(objectMap) 470} 471 472// BootDiagnostics boot Diagnostics is a debugging feature which allows you to view Console Output and 473// Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> 474// Azure also enables you to see a screenshot of the VM from the hypervisor. 475type BootDiagnostics struct { 476 // Enabled - Whether boot diagnostics should be enabled on the Virtual Machine. 477 Enabled *bool `json:"enabled,omitempty"` 478 // StorageURI - Uri of the storage account to use for placing the console output and screenshot. 479 StorageURI *string `json:"storageUri,omitempty"` 480} 481 482// BootDiagnosticsInstanceView the instance view of a virtual machine boot diagnostics. 483type BootDiagnosticsInstanceView struct { 484 // ConsoleScreenshotBlobURI - READ-ONLY; The console screenshot blob URI. 485 ConsoleScreenshotBlobURI *string `json:"consoleScreenshotBlobUri,omitempty"` 486 // SerialConsoleLogBlobURI - READ-ONLY; The Linux serial console log blob Uri. 487 SerialConsoleLogBlobURI *string `json:"serialConsoleLogBlobUri,omitempty"` 488} 489 490// MarshalJSON is the custom marshaler for BootDiagnosticsInstanceView. 491func (bdiv BootDiagnosticsInstanceView) MarshalJSON() ([]byte, error) { 492 objectMap := make(map[string]interface{}) 493 return json.Marshal(objectMap) 494} 495 496// CreationData data used when creating a disk. 497type CreationData struct { 498 // CreateOption - This enumerates the possible sources of a disk's creation. Possible values include: 'Empty', 'Attach', 'FromImage', 'Import', 'Copy', 'Restore' 499 CreateOption DiskCreateOption `json:"createOption,omitempty"` 500 // 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 501 StorageAccountID *string `json:"storageAccountId,omitempty"` 502 // ImageReference - Disk source information. 503 ImageReference *ImageDiskReference `json:"imageReference,omitempty"` 504 // 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. 505 SourceURI *string `json:"sourceUri,omitempty"` 506 // 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. 507 SourceResourceID *string `json:"sourceResourceId,omitempty"` 508} 509 510// DataDisk describes a data disk. 511type DataDisk struct { 512 // 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. 513 Lun *int32 `json:"lun,omitempty"` 514 // Name - The disk name. 515 Name *string `json:"name,omitempty"` 516 // Vhd - The virtual hard disk. 517 Vhd *VirtualHardDisk `json:"vhd,omitempty"` 518 // 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. 519 Image *VirtualHardDisk `json:"image,omitempty"` 520 // Caching - Specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' 521 Caching CachingTypes `json:"caching,omitempty"` 522 // CreateOption - Specifies how the virtual machine should be created.<br><br> Possible values are:<br><br> **Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.<br><br> **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' 523 CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` 524 // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB 525 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 526 // ManagedDisk - The managed disk parameters. 527 ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` 528} 529 530// DataDiskImage contains the data disk images information. 531type DataDiskImage struct { 532 // Lun - READ-ONLY; 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. 533 Lun *int32 `json:"lun,omitempty"` 534} 535 536// MarshalJSON is the custom marshaler for DataDiskImage. 537func (ddi DataDiskImage) MarshalJSON() ([]byte, error) { 538 objectMap := make(map[string]interface{}) 539 return json.Marshal(objectMap) 540} 541 542// DiagnosticsProfile specifies the boot diagnostic settings state. <br><br>Minimum api-version: 543// 2015-06-15. 544type DiagnosticsProfile struct { 545 // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. 546 BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` 547} 548 549// Disk disk resource. 550type Disk struct { 551 autorest.Response `json:"-"` 552 *DiskProperties `json:"properties,omitempty"` 553 // ID - READ-ONLY; Resource Id 554 ID *string `json:"id,omitempty"` 555 // Name - READ-ONLY; Resource name 556 Name *string `json:"name,omitempty"` 557 // Type - READ-ONLY; Resource type 558 Type *string `json:"type,omitempty"` 559 // Location - Resource location 560 Location *string `json:"location,omitempty"` 561 // Tags - Resource tags 562 Tags map[string]*string `json:"tags"` 563} 564 565// MarshalJSON is the custom marshaler for Disk. 566func (d Disk) MarshalJSON() ([]byte, error) { 567 objectMap := make(map[string]interface{}) 568 if d.DiskProperties != nil { 569 objectMap["properties"] = d.DiskProperties 570 } 571 if d.Location != nil { 572 objectMap["location"] = d.Location 573 } 574 if d.Tags != nil { 575 objectMap["tags"] = d.Tags 576 } 577 return json.Marshal(objectMap) 578} 579 580// UnmarshalJSON is the custom unmarshaler for Disk struct. 581func (d *Disk) UnmarshalJSON(body []byte) error { 582 var m map[string]*json.RawMessage 583 err := json.Unmarshal(body, &m) 584 if err != nil { 585 return err 586 } 587 for k, v := range m { 588 switch k { 589 case "properties": 590 if v != nil { 591 var diskProperties DiskProperties 592 err = json.Unmarshal(*v, &diskProperties) 593 if err != nil { 594 return err 595 } 596 d.DiskProperties = &diskProperties 597 } 598 case "id": 599 if v != nil { 600 var ID string 601 err = json.Unmarshal(*v, &ID) 602 if err != nil { 603 return err 604 } 605 d.ID = &ID 606 } 607 case "name": 608 if v != nil { 609 var name string 610 err = json.Unmarshal(*v, &name) 611 if err != nil { 612 return err 613 } 614 d.Name = &name 615 } 616 case "type": 617 if v != nil { 618 var typeVar string 619 err = json.Unmarshal(*v, &typeVar) 620 if err != nil { 621 return err 622 } 623 d.Type = &typeVar 624 } 625 case "location": 626 if v != nil { 627 var location string 628 err = json.Unmarshal(*v, &location) 629 if err != nil { 630 return err 631 } 632 d.Location = &location 633 } 634 case "tags": 635 if v != nil { 636 var tags map[string]*string 637 err = json.Unmarshal(*v, &tags) 638 if err != nil { 639 return err 640 } 641 d.Tags = tags 642 } 643 } 644 } 645 646 return nil 647} 648 649// DiskEncryptionSettings describes a Encryption Settings for a Disk 650type DiskEncryptionSettings struct { 651 // DiskEncryptionKey - Specifies the location of the disk encryption key, which is a Key Vault Secret. 652 DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` 653 // KeyEncryptionKey - Specifies the location of the key encryption key in Key Vault. 654 KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` 655 // Enabled - Specifies whether disk encryption should be enabled on the virtual machine. 656 Enabled *bool `json:"enabled,omitempty"` 657} 658 659// DiskInstanceView the instance view of the disk. 660type DiskInstanceView struct { 661 // Name - The disk name. 662 Name *string `json:"name,omitempty"` 663 // Statuses - The resource status information. 664 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 665} 666 667// DiskList the List Disks operation response. 668type DiskList struct { 669 autorest.Response `json:"-"` 670 // Value - A list of disks. 671 Value *[]Disk `json:"value,omitempty"` 672 // NextLink - the uri to fetch the next page of disks. Call ListNext() with this to fetch the next page of disks. 673 NextLink *string `json:"nextLink,omitempty"` 674} 675 676// DiskListIterator provides access to a complete listing of Disk values. 677type DiskListIterator struct { 678 i int 679 page DiskListPage 680} 681 682// NextWithContext advances to the next value. If there was an error making 683// the request the iterator does not advance and the error is returned. 684func (iter *DiskListIterator) NextWithContext(ctx context.Context) (err error) { 685 if tracing.IsEnabled() { 686 ctx = tracing.StartSpan(ctx, fqdn+"/DiskListIterator.NextWithContext") 687 defer func() { 688 sc := -1 689 if iter.Response().Response.Response != nil { 690 sc = iter.Response().Response.Response.StatusCode 691 } 692 tracing.EndSpan(ctx, sc, err) 693 }() 694 } 695 iter.i++ 696 if iter.i < len(iter.page.Values()) { 697 return nil 698 } 699 err = iter.page.NextWithContext(ctx) 700 if err != nil { 701 iter.i-- 702 return err 703 } 704 iter.i = 0 705 return nil 706} 707 708// Next advances to the next value. If there was an error making 709// the request the iterator does not advance and the error is returned. 710// Deprecated: Use NextWithContext() instead. 711func (iter *DiskListIterator) Next() error { 712 return iter.NextWithContext(context.Background()) 713} 714 715// NotDone returns true if the enumeration should be started or is not yet complete. 716func (iter DiskListIterator) NotDone() bool { 717 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 718} 719 720// Response returns the raw server response from the last page request. 721func (iter DiskListIterator) Response() DiskList { 722 return iter.page.Response() 723} 724 725// Value returns the current value or a zero-initialized value if the 726// iterator has advanced beyond the end of the collection. 727func (iter DiskListIterator) Value() Disk { 728 if !iter.page.NotDone() { 729 return Disk{} 730 } 731 return iter.page.Values()[iter.i] 732} 733 734// Creates a new instance of the DiskListIterator type. 735func NewDiskListIterator(page DiskListPage) DiskListIterator { 736 return DiskListIterator{page: page} 737} 738 739// IsEmpty returns true if the ListResult contains no values. 740func (dl DiskList) IsEmpty() bool { 741 return dl.Value == nil || len(*dl.Value) == 0 742} 743 744// hasNextLink returns true if the NextLink is not empty. 745func (dl DiskList) hasNextLink() bool { 746 return dl.NextLink != nil && len(*dl.NextLink) != 0 747} 748 749// diskListPreparer prepares a request to retrieve the next set of results. 750// It returns nil if no more results exist. 751func (dl DiskList) diskListPreparer(ctx context.Context) (*http.Request, error) { 752 if !dl.hasNextLink() { 753 return nil, nil 754 } 755 return autorest.Prepare((&http.Request{}).WithContext(ctx), 756 autorest.AsJSON(), 757 autorest.AsGet(), 758 autorest.WithBaseURL(to.String(dl.NextLink))) 759} 760 761// DiskListPage contains a page of Disk values. 762type DiskListPage struct { 763 fn func(context.Context, DiskList) (DiskList, error) 764 dl DiskList 765} 766 767// NextWithContext advances to the next page of values. If there was an error making 768// the request the page does not advance and the error is returned. 769func (page *DiskListPage) NextWithContext(ctx context.Context) (err error) { 770 if tracing.IsEnabled() { 771 ctx = tracing.StartSpan(ctx, fqdn+"/DiskListPage.NextWithContext") 772 defer func() { 773 sc := -1 774 if page.Response().Response.Response != nil { 775 sc = page.Response().Response.Response.StatusCode 776 } 777 tracing.EndSpan(ctx, sc, err) 778 }() 779 } 780 for { 781 next, err := page.fn(ctx, page.dl) 782 if err != nil { 783 return err 784 } 785 page.dl = next 786 if !next.hasNextLink() || !next.IsEmpty() { 787 break 788 } 789 } 790 return nil 791} 792 793// Next advances to the next page of values. If there was an error making 794// the request the page does not advance and the error is returned. 795// Deprecated: Use NextWithContext() instead. 796func (page *DiskListPage) Next() error { 797 return page.NextWithContext(context.Background()) 798} 799 800// NotDone returns true if the page enumeration should be started or is not yet complete. 801func (page DiskListPage) NotDone() bool { 802 return !page.dl.IsEmpty() 803} 804 805// Response returns the raw server response from the last page request. 806func (page DiskListPage) Response() DiskList { 807 return page.dl 808} 809 810// Values returns the slice of values for the current page or nil if there are no values. 811func (page DiskListPage) Values() []Disk { 812 if page.dl.IsEmpty() { 813 return nil 814 } 815 return *page.dl.Value 816} 817 818// Creates a new instance of the DiskListPage type. 819func NewDiskListPage(cur DiskList, getNextPage func(context.Context, DiskList) (DiskList, error)) DiskListPage { 820 return DiskListPage{ 821 fn: getNextPage, 822 dl: cur, 823 } 824} 825 826// DiskProperties disk resource properties. 827type DiskProperties struct { 828 // AccountType - the storage account type of the disk. Possible values include: 'StandardLRS', 'PremiumLRS' 829 AccountType StorageAccountTypes `json:"accountType,omitempty"` 830 // TimeCreated - READ-ONLY; The time when the disk was created. 831 TimeCreated *date.Time `json:"timeCreated,omitempty"` 832 // OsType - The Operating System type. Possible values include: 'Windows', 'Linux' 833 OsType OperatingSystemTypes `json:"osType,omitempty"` 834 // CreationData - Disk source information. CreationData information cannot be changed after the disk has been created. 835 CreationData *CreationData `json:"creationData,omitempty"` 836 // 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. 837 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 838 // EncryptionSettings - Encryption settings for disk or snapshot 839 EncryptionSettings *EncryptionSettings `json:"encryptionSettings,omitempty"` 840 // OwnerID - READ-ONLY; A relative URI containing the VM id that has the disk attached. 841 OwnerID *string `json:"ownerId,omitempty"` 842 // ProvisioningState - READ-ONLY; The disk provisioning state. 843 ProvisioningState *string `json:"provisioningState,omitempty"` 844} 845 846// MarshalJSON is the custom marshaler for DiskProperties. 847func (dp DiskProperties) MarshalJSON() ([]byte, error) { 848 objectMap := make(map[string]interface{}) 849 if dp.AccountType != "" { 850 objectMap["accountType"] = dp.AccountType 851 } 852 if dp.OsType != "" { 853 objectMap["osType"] = dp.OsType 854 } 855 if dp.CreationData != nil { 856 objectMap["creationData"] = dp.CreationData 857 } 858 if dp.DiskSizeGB != nil { 859 objectMap["diskSizeGB"] = dp.DiskSizeGB 860 } 861 if dp.EncryptionSettings != nil { 862 objectMap["encryptionSettings"] = dp.EncryptionSettings 863 } 864 return json.Marshal(objectMap) 865} 866 867// DisksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 868// operation. 869type DisksCreateOrUpdateFuture struct { 870 azure.FutureAPI 871 // Result returns the result of the asynchronous operation. 872 // If the operation has not completed it will return an error. 873 Result func(DisksClient) (Disk, error) 874} 875 876// UnmarshalJSON is the custom unmarshaller for CreateFuture. 877func (future *DisksCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 878 var azFuture azure.Future 879 if err := json.Unmarshal(body, &azFuture); err != nil { 880 return err 881 } 882 future.FutureAPI = &azFuture 883 future.Result = future.result 884 return nil 885} 886 887// result is the default implementation for DisksCreateOrUpdateFuture.Result. 888func (future *DisksCreateOrUpdateFuture) result(client DisksClient) (d Disk, err error) { 889 var done bool 890 done, err = future.DoneWithContext(context.Background(), client) 891 if err != nil { 892 err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 893 return 894 } 895 if !done { 896 d.Response.Response = future.Response() 897 err = azure.NewAsyncOpIncompleteError("compute.DisksCreateOrUpdateFuture") 898 return 899 } 900 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 901 if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { 902 d, err = client.CreateOrUpdateResponder(d.Response.Response) 903 if err != nil { 904 err = autorest.NewErrorWithError(err, "compute.DisksCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") 905 } 906 } 907 return 908} 909 910// DisksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 911type DisksDeleteFuture struct { 912 azure.FutureAPI 913 // Result returns the result of the asynchronous operation. 914 // If the operation has not completed it will return an error. 915 Result func(DisksClient) (OperationStatusResponse, error) 916} 917 918// UnmarshalJSON is the custom unmarshaller for CreateFuture. 919func (future *DisksDeleteFuture) UnmarshalJSON(body []byte) error { 920 var azFuture azure.Future 921 if err := json.Unmarshal(body, &azFuture); err != nil { 922 return err 923 } 924 future.FutureAPI = &azFuture 925 future.Result = future.result 926 return nil 927} 928 929// result is the default implementation for DisksDeleteFuture.Result. 930func (future *DisksDeleteFuture) result(client DisksClient) (osr OperationStatusResponse, err error) { 931 var done bool 932 done, err = future.DoneWithContext(context.Background(), client) 933 if err != nil { 934 err = autorest.NewErrorWithError(err, "compute.DisksDeleteFuture", "Result", future.Response(), "Polling failure") 935 return 936 } 937 if !done { 938 osr.Response.Response = future.Response() 939 err = azure.NewAsyncOpIncompleteError("compute.DisksDeleteFuture") 940 return 941 } 942 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 943 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 944 osr, err = client.DeleteResponder(osr.Response.Response) 945 if err != nil { 946 err = autorest.NewErrorWithError(err, "compute.DisksDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") 947 } 948 } 949 return 950} 951 952// DisksGrantAccessFuture an abstraction for monitoring and retrieving the results of a long-running 953// operation. 954type DisksGrantAccessFuture struct { 955 azure.FutureAPI 956 // Result returns the result of the asynchronous operation. 957 // If the operation has not completed it will return an error. 958 Result func(DisksClient) (AccessURI, error) 959} 960 961// UnmarshalJSON is the custom unmarshaller for CreateFuture. 962func (future *DisksGrantAccessFuture) UnmarshalJSON(body []byte) error { 963 var azFuture azure.Future 964 if err := json.Unmarshal(body, &azFuture); err != nil { 965 return err 966 } 967 future.FutureAPI = &azFuture 968 future.Result = future.result 969 return nil 970} 971 972// result is the default implementation for DisksGrantAccessFuture.Result. 973func (future *DisksGrantAccessFuture) result(client DisksClient) (au AccessURI, err error) { 974 var done bool 975 done, err = future.DoneWithContext(context.Background(), client) 976 if err != nil { 977 err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", future.Response(), "Polling failure") 978 return 979 } 980 if !done { 981 au.Response.Response = future.Response() 982 err = azure.NewAsyncOpIncompleteError("compute.DisksGrantAccessFuture") 983 return 984 } 985 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 986 if au.Response.Response, err = future.GetResult(sender); err == nil && au.Response.Response.StatusCode != http.StatusNoContent { 987 au, err = client.GrantAccessResponder(au.Response.Response) 988 if err != nil { 989 err = autorest.NewErrorWithError(err, "compute.DisksGrantAccessFuture", "Result", au.Response.Response, "Failure responding to request") 990 } 991 } 992 return 993} 994 995// DisksRevokeAccessFuture an abstraction for monitoring and retrieving the results of a long-running 996// operation. 997type DisksRevokeAccessFuture struct { 998 azure.FutureAPI 999 // Result returns the result of the asynchronous operation. 1000 // If the operation has not completed it will return an error. 1001 Result func(DisksClient) (OperationStatusResponse, error) 1002} 1003 1004// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1005func (future *DisksRevokeAccessFuture) UnmarshalJSON(body []byte) error { 1006 var azFuture azure.Future 1007 if err := json.Unmarshal(body, &azFuture); err != nil { 1008 return err 1009 } 1010 future.FutureAPI = &azFuture 1011 future.Result = future.result 1012 return nil 1013} 1014 1015// result is the default implementation for DisksRevokeAccessFuture.Result. 1016func (future *DisksRevokeAccessFuture) result(client DisksClient) (osr OperationStatusResponse, err error) { 1017 var done bool 1018 done, err = future.DoneWithContext(context.Background(), client) 1019 if err != nil { 1020 err = autorest.NewErrorWithError(err, "compute.DisksRevokeAccessFuture", "Result", future.Response(), "Polling failure") 1021 return 1022 } 1023 if !done { 1024 osr.Response.Response = future.Response() 1025 err = azure.NewAsyncOpIncompleteError("compute.DisksRevokeAccessFuture") 1026 return 1027 } 1028 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1029 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 1030 osr, err = client.RevokeAccessResponder(osr.Response.Response) 1031 if err != nil { 1032 err = autorest.NewErrorWithError(err, "compute.DisksRevokeAccessFuture", "Result", osr.Response.Response, "Failure responding to request") 1033 } 1034 } 1035 return 1036} 1037 1038// DisksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1039type DisksUpdateFuture struct { 1040 azure.FutureAPI 1041 // Result returns the result of the asynchronous operation. 1042 // If the operation has not completed it will return an error. 1043 Result func(DisksClient) (Disk, error) 1044} 1045 1046// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1047func (future *DisksUpdateFuture) UnmarshalJSON(body []byte) error { 1048 var azFuture azure.Future 1049 if err := json.Unmarshal(body, &azFuture); err != nil { 1050 return err 1051 } 1052 future.FutureAPI = &azFuture 1053 future.Result = future.result 1054 return nil 1055} 1056 1057// result is the default implementation for DisksUpdateFuture.Result. 1058func (future *DisksUpdateFuture) result(client DisksClient) (d Disk, err error) { 1059 var done bool 1060 done, err = future.DoneWithContext(context.Background(), client) 1061 if err != nil { 1062 err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", future.Response(), "Polling failure") 1063 return 1064 } 1065 if !done { 1066 d.Response.Response = future.Response() 1067 err = azure.NewAsyncOpIncompleteError("compute.DisksUpdateFuture") 1068 return 1069 } 1070 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1071 if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { 1072 d, err = client.UpdateResponder(d.Response.Response) 1073 if err != nil { 1074 err = autorest.NewErrorWithError(err, "compute.DisksUpdateFuture", "Result", d.Response.Response, "Failure responding to request") 1075 } 1076 } 1077 return 1078} 1079 1080// DiskUpdate disk update resource. 1081type DiskUpdate struct { 1082 *DiskUpdateProperties `json:"properties,omitempty"` 1083 // Tags - Resource tags 1084 Tags map[string]*string `json:"tags"` 1085} 1086 1087// MarshalJSON is the custom marshaler for DiskUpdate. 1088func (du DiskUpdate) MarshalJSON() ([]byte, error) { 1089 objectMap := make(map[string]interface{}) 1090 if du.DiskUpdateProperties != nil { 1091 objectMap["properties"] = du.DiskUpdateProperties 1092 } 1093 if du.Tags != nil { 1094 objectMap["tags"] = du.Tags 1095 } 1096 return json.Marshal(objectMap) 1097} 1098 1099// UnmarshalJSON is the custom unmarshaler for DiskUpdate struct. 1100func (du *DiskUpdate) UnmarshalJSON(body []byte) error { 1101 var m map[string]*json.RawMessage 1102 err := json.Unmarshal(body, &m) 1103 if err != nil { 1104 return err 1105 } 1106 for k, v := range m { 1107 switch k { 1108 case "properties": 1109 if v != nil { 1110 var diskUpdateProperties DiskUpdateProperties 1111 err = json.Unmarshal(*v, &diskUpdateProperties) 1112 if err != nil { 1113 return err 1114 } 1115 du.DiskUpdateProperties = &diskUpdateProperties 1116 } 1117 case "tags": 1118 if v != nil { 1119 var tags map[string]*string 1120 err = json.Unmarshal(*v, &tags) 1121 if err != nil { 1122 return err 1123 } 1124 du.Tags = tags 1125 } 1126 } 1127 } 1128 1129 return nil 1130} 1131 1132// DiskUpdateProperties disk resource update properties. 1133type DiskUpdateProperties struct { 1134 // AccountType - the storage account type of the disk. Possible values include: 'StandardLRS', 'PremiumLRS' 1135 AccountType StorageAccountTypes `json:"accountType,omitempty"` 1136 // OsType - the Operating System type. Possible values include: 'Windows', 'Linux' 1137 OsType OperatingSystemTypes `json:"osType,omitempty"` 1138 // CreationData - disk source information. CreationData information cannot be changed after the disk has been created. 1139 CreationData *CreationData `json:"creationData,omitempty"` 1140 // 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. 1141 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 1142 // EncryptionSettings - Encryption settings for disk or snapshot 1143 EncryptionSettings *EncryptionSettings `json:"encryptionSettings,omitempty"` 1144} 1145 1146// EncryptionSettings encryption settings for disk or snapshot 1147type EncryptionSettings struct { 1148 // 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. 1149 Enabled *bool `json:"enabled,omitempty"` 1150 // DiskEncryptionKey - Key Vault Secret Url and vault id of the disk encryption key 1151 DiskEncryptionKey *KeyVaultAndSecretReference `json:"diskEncryptionKey,omitempty"` 1152 // KeyEncryptionKey - Key Vault Key Url and vault id of the key encryption key 1153 KeyEncryptionKey *KeyVaultAndKeyReference `json:"keyEncryptionKey,omitempty"` 1154} 1155 1156// GrantAccessData data used for requesting a SAS. 1157type GrantAccessData struct { 1158 // Access - Possible values include: 'None', 'Read' 1159 Access AccessLevel `json:"access,omitempty"` 1160 // DurationInSeconds - Time duration in seconds until the SAS access expires. 1161 DurationInSeconds *int32 `json:"durationInSeconds,omitempty"` 1162} 1163 1164// HardwareProfile specifies the hardware settings for the virtual machine. 1165type HardwareProfile struct { 1166 // 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). <br><br> The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: <br><br> [List all available virtual machine sizes in an availability set](virtualmachines-list-sizes-availability-set.md) <br><br> [List all available virtual machine sizes in a region](virtualmachines-list-sizes-region.md) <br><br> [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' 1167 VMSize VirtualMachineSizeTypes `json:"vmSize,omitempty"` 1168} 1169 1170// Image the source user image virtual hard disk. The virtual hard disk will be copied before being 1171// attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not 1172// exist. 1173type Image struct { 1174 autorest.Response `json:"-"` 1175 *ImageProperties `json:"properties,omitempty"` 1176 // ID - READ-ONLY; Resource Id 1177 ID *string `json:"id,omitempty"` 1178 // Name - READ-ONLY; Resource name 1179 Name *string `json:"name,omitempty"` 1180 // Type - READ-ONLY; Resource type 1181 Type *string `json:"type,omitempty"` 1182 // Location - Resource location 1183 Location *string `json:"location,omitempty"` 1184 // Tags - Resource tags 1185 Tags map[string]*string `json:"tags"` 1186} 1187 1188// MarshalJSON is the custom marshaler for Image. 1189func (i Image) MarshalJSON() ([]byte, error) { 1190 objectMap := make(map[string]interface{}) 1191 if i.ImageProperties != nil { 1192 objectMap["properties"] = i.ImageProperties 1193 } 1194 if i.Location != nil { 1195 objectMap["location"] = i.Location 1196 } 1197 if i.Tags != nil { 1198 objectMap["tags"] = i.Tags 1199 } 1200 return json.Marshal(objectMap) 1201} 1202 1203// UnmarshalJSON is the custom unmarshaler for Image struct. 1204func (i *Image) UnmarshalJSON(body []byte) error { 1205 var m map[string]*json.RawMessage 1206 err := json.Unmarshal(body, &m) 1207 if err != nil { 1208 return err 1209 } 1210 for k, v := range m { 1211 switch k { 1212 case "properties": 1213 if v != nil { 1214 var imageProperties ImageProperties 1215 err = json.Unmarshal(*v, &imageProperties) 1216 if err != nil { 1217 return err 1218 } 1219 i.ImageProperties = &imageProperties 1220 } 1221 case "id": 1222 if v != nil { 1223 var ID string 1224 err = json.Unmarshal(*v, &ID) 1225 if err != nil { 1226 return err 1227 } 1228 i.ID = &ID 1229 } 1230 case "name": 1231 if v != nil { 1232 var name string 1233 err = json.Unmarshal(*v, &name) 1234 if err != nil { 1235 return err 1236 } 1237 i.Name = &name 1238 } 1239 case "type": 1240 if v != nil { 1241 var typeVar string 1242 err = json.Unmarshal(*v, &typeVar) 1243 if err != nil { 1244 return err 1245 } 1246 i.Type = &typeVar 1247 } 1248 case "location": 1249 if v != nil { 1250 var location string 1251 err = json.Unmarshal(*v, &location) 1252 if err != nil { 1253 return err 1254 } 1255 i.Location = &location 1256 } 1257 case "tags": 1258 if v != nil { 1259 var tags map[string]*string 1260 err = json.Unmarshal(*v, &tags) 1261 if err != nil { 1262 return err 1263 } 1264 i.Tags = tags 1265 } 1266 } 1267 } 1268 1269 return nil 1270} 1271 1272// ImageDataDisk describes a data disk. 1273type ImageDataDisk struct { 1274 // 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. 1275 Lun *int32 `json:"lun,omitempty"` 1276 // Snapshot - The snapshot. 1277 Snapshot *SubResource `json:"snapshot,omitempty"` 1278 // ManagedDisk - The managedDisk. 1279 ManagedDisk *SubResource `json:"managedDisk,omitempty"` 1280 // BlobURI - The Virtual Hard Disk. 1281 BlobURI *string `json:"blobUri,omitempty"` 1282 // Caching - Specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' 1283 Caching CachingTypes `json:"caching,omitempty"` 1284 // 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. <br><br> This value cannot be larger than 1023 GB 1285 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 1286} 1287 1288// ImageDiskReference the source image used for creating the disk. 1289type ImageDiskReference struct { 1290 // ID - A relative uri containing either a Platform Image Repository or user image reference. 1291 ID *string `json:"id,omitempty"` 1292 // 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. 1293 Lun *int32 `json:"lun,omitempty"` 1294} 1295 1296// ImageListResult the List Image operation response. 1297type ImageListResult struct { 1298 autorest.Response `json:"-"` 1299 // Value - The list of Images. 1300 Value *[]Image `json:"value,omitempty"` 1301 // NextLink - The uri to fetch the next page of Images. Call ListNext() with this to fetch the next page of Images. 1302 NextLink *string `json:"nextLink,omitempty"` 1303} 1304 1305// ImageListResultIterator provides access to a complete listing of Image values. 1306type ImageListResultIterator struct { 1307 i int 1308 page ImageListResultPage 1309} 1310 1311// NextWithContext advances to the next value. If there was an error making 1312// the request the iterator does not advance and the error is returned. 1313func (iter *ImageListResultIterator) NextWithContext(ctx context.Context) (err error) { 1314 if tracing.IsEnabled() { 1315 ctx = tracing.StartSpan(ctx, fqdn+"/ImageListResultIterator.NextWithContext") 1316 defer func() { 1317 sc := -1 1318 if iter.Response().Response.Response != nil { 1319 sc = iter.Response().Response.Response.StatusCode 1320 } 1321 tracing.EndSpan(ctx, sc, err) 1322 }() 1323 } 1324 iter.i++ 1325 if iter.i < len(iter.page.Values()) { 1326 return nil 1327 } 1328 err = iter.page.NextWithContext(ctx) 1329 if err != nil { 1330 iter.i-- 1331 return err 1332 } 1333 iter.i = 0 1334 return nil 1335} 1336 1337// Next advances to the next value. If there was an error making 1338// the request the iterator does not advance and the error is returned. 1339// Deprecated: Use NextWithContext() instead. 1340func (iter *ImageListResultIterator) Next() error { 1341 return iter.NextWithContext(context.Background()) 1342} 1343 1344// NotDone returns true if the enumeration should be started or is not yet complete. 1345func (iter ImageListResultIterator) NotDone() bool { 1346 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1347} 1348 1349// Response returns the raw server response from the last page request. 1350func (iter ImageListResultIterator) Response() ImageListResult { 1351 return iter.page.Response() 1352} 1353 1354// Value returns the current value or a zero-initialized value if the 1355// iterator has advanced beyond the end of the collection. 1356func (iter ImageListResultIterator) Value() Image { 1357 if !iter.page.NotDone() { 1358 return Image{} 1359 } 1360 return iter.page.Values()[iter.i] 1361} 1362 1363// Creates a new instance of the ImageListResultIterator type. 1364func NewImageListResultIterator(page ImageListResultPage) ImageListResultIterator { 1365 return ImageListResultIterator{page: page} 1366} 1367 1368// IsEmpty returns true if the ListResult contains no values. 1369func (ilr ImageListResult) IsEmpty() bool { 1370 return ilr.Value == nil || len(*ilr.Value) == 0 1371} 1372 1373// hasNextLink returns true if the NextLink is not empty. 1374func (ilr ImageListResult) hasNextLink() bool { 1375 return ilr.NextLink != nil && len(*ilr.NextLink) != 0 1376} 1377 1378// imageListResultPreparer prepares a request to retrieve the next set of results. 1379// It returns nil if no more results exist. 1380func (ilr ImageListResult) imageListResultPreparer(ctx context.Context) (*http.Request, error) { 1381 if !ilr.hasNextLink() { 1382 return nil, nil 1383 } 1384 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1385 autorest.AsJSON(), 1386 autorest.AsGet(), 1387 autorest.WithBaseURL(to.String(ilr.NextLink))) 1388} 1389 1390// ImageListResultPage contains a page of Image values. 1391type ImageListResultPage struct { 1392 fn func(context.Context, ImageListResult) (ImageListResult, error) 1393 ilr ImageListResult 1394} 1395 1396// NextWithContext advances to the next page of values. If there was an error making 1397// the request the page does not advance and the error is returned. 1398func (page *ImageListResultPage) NextWithContext(ctx context.Context) (err error) { 1399 if tracing.IsEnabled() { 1400 ctx = tracing.StartSpan(ctx, fqdn+"/ImageListResultPage.NextWithContext") 1401 defer func() { 1402 sc := -1 1403 if page.Response().Response.Response != nil { 1404 sc = page.Response().Response.Response.StatusCode 1405 } 1406 tracing.EndSpan(ctx, sc, err) 1407 }() 1408 } 1409 for { 1410 next, err := page.fn(ctx, page.ilr) 1411 if err != nil { 1412 return err 1413 } 1414 page.ilr = next 1415 if !next.hasNextLink() || !next.IsEmpty() { 1416 break 1417 } 1418 } 1419 return nil 1420} 1421 1422// Next advances to the next page of values. If there was an error making 1423// the request the page does not advance and the error is returned. 1424// Deprecated: Use NextWithContext() instead. 1425func (page *ImageListResultPage) Next() error { 1426 return page.NextWithContext(context.Background()) 1427} 1428 1429// NotDone returns true if the page enumeration should be started or is not yet complete. 1430func (page ImageListResultPage) NotDone() bool { 1431 return !page.ilr.IsEmpty() 1432} 1433 1434// Response returns the raw server response from the last page request. 1435func (page ImageListResultPage) Response() ImageListResult { 1436 return page.ilr 1437} 1438 1439// Values returns the slice of values for the current page or nil if there are no values. 1440func (page ImageListResultPage) Values() []Image { 1441 if page.ilr.IsEmpty() { 1442 return nil 1443 } 1444 return *page.ilr.Value 1445} 1446 1447// Creates a new instance of the ImageListResultPage type. 1448func NewImageListResultPage(cur ImageListResult, getNextPage func(context.Context, ImageListResult) (ImageListResult, error)) ImageListResultPage { 1449 return ImageListResultPage{ 1450 fn: getNextPage, 1451 ilr: cur, 1452 } 1453} 1454 1455// ImageOSDisk describes an Operating System disk. 1456type ImageOSDisk struct { 1457 // 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. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. Possible values include: 'Windows', 'Linux' 1458 OsType OperatingSystemTypes `json:"osType,omitempty"` 1459 // OsState - The OS State. Possible values include: 'Generalized', 'Specialized' 1460 OsState OperatingSystemStateTypes `json:"osState,omitempty"` 1461 // Snapshot - The snapshot. 1462 Snapshot *SubResource `json:"snapshot,omitempty"` 1463 // ManagedDisk - The managedDisk. 1464 ManagedDisk *SubResource `json:"managedDisk,omitempty"` 1465 // BlobURI - The Virtual Hard Disk. 1466 BlobURI *string `json:"blobUri,omitempty"` 1467 // Caching - Specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' 1468 Caching CachingTypes `json:"caching,omitempty"` 1469 // 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. <br><br> This value cannot be larger than 1023 GB 1470 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 1471} 1472 1473// ImageProperties describes the properties of an Image. 1474type ImageProperties struct { 1475 // SourceVirtualMachine - The source virtual machine from which Image is created. 1476 SourceVirtualMachine *SubResource `json:"sourceVirtualMachine,omitempty"` 1477 // StorageProfile - Specifies the storage settings for the virtual machine disks. 1478 StorageProfile *ImageStorageProfile `json:"storageProfile,omitempty"` 1479 // ProvisioningState - READ-ONLY; The provisioning state. 1480 ProvisioningState *string `json:"provisioningState,omitempty"` 1481} 1482 1483// MarshalJSON is the custom marshaler for ImageProperties. 1484func (IP ImageProperties) MarshalJSON() ([]byte, error) { 1485 objectMap := make(map[string]interface{}) 1486 if IP.SourceVirtualMachine != nil { 1487 objectMap["sourceVirtualMachine"] = IP.SourceVirtualMachine 1488 } 1489 if IP.StorageProfile != nil { 1490 objectMap["storageProfile"] = IP.StorageProfile 1491 } 1492 return json.Marshal(objectMap) 1493} 1494 1495// ImageReference specifies information about the image to use. You can specify information about platform 1496// images, marketplace images, or virtual machine images. This element is required when you want to use a 1497// platform image, marketplace image, or virtual machine image, but is not used in other creation 1498// operations. 1499type ImageReference struct { 1500 // Publisher - The image publisher. 1501 Publisher *string `json:"publisher,omitempty"` 1502 // Offer - Specifies the offer of the platform image or marketplace image used to create the virtual machine. 1503 Offer *string `json:"offer,omitempty"` 1504 // Sku - The image SKU. 1505 Sku *string `json:"sku,omitempty"` 1506 // 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. 1507 Version *string `json:"version,omitempty"` 1508 // ID - Resource Id 1509 ID *string `json:"id,omitempty"` 1510} 1511 1512// ImagesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1513// operation. 1514type ImagesCreateOrUpdateFuture struct { 1515 azure.FutureAPI 1516 // Result returns the result of the asynchronous operation. 1517 // If the operation has not completed it will return an error. 1518 Result func(ImagesClient) (Image, error) 1519} 1520 1521// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1522func (future *ImagesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1523 var azFuture azure.Future 1524 if err := json.Unmarshal(body, &azFuture); err != nil { 1525 return err 1526 } 1527 future.FutureAPI = &azFuture 1528 future.Result = future.result 1529 return nil 1530} 1531 1532// result is the default implementation for ImagesCreateOrUpdateFuture.Result. 1533func (future *ImagesCreateOrUpdateFuture) result(client ImagesClient) (i Image, err error) { 1534 var done bool 1535 done, err = future.DoneWithContext(context.Background(), client) 1536 if err != nil { 1537 err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1538 return 1539 } 1540 if !done { 1541 i.Response.Response = future.Response() 1542 err = azure.NewAsyncOpIncompleteError("compute.ImagesCreateOrUpdateFuture") 1543 return 1544 } 1545 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1546 if i.Response.Response, err = future.GetResult(sender); err == nil && i.Response.Response.StatusCode != http.StatusNoContent { 1547 i, err = client.CreateOrUpdateResponder(i.Response.Response) 1548 if err != nil { 1549 err = autorest.NewErrorWithError(err, "compute.ImagesCreateOrUpdateFuture", "Result", i.Response.Response, "Failure responding to request") 1550 } 1551 } 1552 return 1553} 1554 1555// ImagesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1556type ImagesDeleteFuture struct { 1557 azure.FutureAPI 1558 // Result returns the result of the asynchronous operation. 1559 // If the operation has not completed it will return an error. 1560 Result func(ImagesClient) (OperationStatusResponse, error) 1561} 1562 1563// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1564func (future *ImagesDeleteFuture) UnmarshalJSON(body []byte) error { 1565 var azFuture azure.Future 1566 if err := json.Unmarshal(body, &azFuture); err != nil { 1567 return err 1568 } 1569 future.FutureAPI = &azFuture 1570 future.Result = future.result 1571 return nil 1572} 1573 1574// result is the default implementation for ImagesDeleteFuture.Result. 1575func (future *ImagesDeleteFuture) result(client ImagesClient) (osr OperationStatusResponse, err error) { 1576 var done bool 1577 done, err = future.DoneWithContext(context.Background(), client) 1578 if err != nil { 1579 err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", future.Response(), "Polling failure") 1580 return 1581 } 1582 if !done { 1583 osr.Response.Response = future.Response() 1584 err = azure.NewAsyncOpIncompleteError("compute.ImagesDeleteFuture") 1585 return 1586 } 1587 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1588 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 1589 osr, err = client.DeleteResponder(osr.Response.Response) 1590 if err != nil { 1591 err = autorest.NewErrorWithError(err, "compute.ImagesDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") 1592 } 1593 } 1594 return 1595} 1596 1597// ImageStorageProfile describes a storage profile. 1598type ImageStorageProfile struct { 1599 // OsDisk - Specifies information about the operating system disk used by the virtual machine. <br><br> 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). 1600 OsDisk *ImageOSDisk `json:"osDisk,omitempty"` 1601 // DataDisks - Specifies the parameters that are used to add a data disk to a virtual machine. <br><br> 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). 1602 DataDisks *[]ImageDataDisk `json:"dataDisks,omitempty"` 1603} 1604 1605// InnerError inner error details. 1606type InnerError struct { 1607 // Exceptiontype - The exception type. 1608 Exceptiontype *string `json:"exceptiontype,omitempty"` 1609 // Errordetail - The internal error message or exception dump. 1610 Errordetail *string `json:"errordetail,omitempty"` 1611} 1612 1613// InstanceViewStatus instance view status. 1614type InstanceViewStatus struct { 1615 // Code - The status code. 1616 Code *string `json:"code,omitempty"` 1617 // Level - The level code. Possible values include: 'Info', 'Warning', 'Error' 1618 Level StatusLevelTypes `json:"level,omitempty"` 1619 // DisplayStatus - The short localizable label for the status. 1620 DisplayStatus *string `json:"displayStatus,omitempty"` 1621 // Message - The detailed status message, including for alerts and error messages. 1622 Message *string `json:"message,omitempty"` 1623 // Time - The time of the status. 1624 Time *date.Time `json:"time,omitempty"` 1625} 1626 1627// KeyVaultAndKeyReference key Vault Key Url and vault id of KeK, KeK is optional and when provided is used 1628// to unwrap the encryptionKey 1629type KeyVaultAndKeyReference struct { 1630 // SourceVault - Resource id of the KeyVault containing the key or secret 1631 SourceVault *SourceVault `json:"sourceVault,omitempty"` 1632 // KeyURL - Url pointing to a key or secret in KeyVault 1633 KeyURL *string `json:"keyUrl,omitempty"` 1634} 1635 1636// KeyVaultAndSecretReference key Vault Secret Url and vault id of the encryption key 1637type KeyVaultAndSecretReference struct { 1638 // SourceVault - Resource id of the KeyVault containing the key or secret 1639 SourceVault *SourceVault `json:"sourceVault,omitempty"` 1640 // SecretURL - Url pointing to a key or secret in KeyVault 1641 SecretURL *string `json:"secretUrl,omitempty"` 1642} 1643 1644// KeyVaultKeyReference describes a reference to Key Vault Key 1645type KeyVaultKeyReference struct { 1646 // KeyURL - The URL referencing a key encryption key in Key Vault. 1647 KeyURL *string `json:"keyUrl,omitempty"` 1648 // SourceVault - The relative URL of the Key Vault containing the key. 1649 SourceVault *SubResource `json:"sourceVault,omitempty"` 1650} 1651 1652// KeyVaultSecretReference describes a reference to Key Vault Secret 1653type KeyVaultSecretReference struct { 1654 // SecretURL - The URL referencing a secret in a Key Vault. 1655 SecretURL *string `json:"secretUrl,omitempty"` 1656 // SourceVault - The relative URL of the Key Vault containing the secret. 1657 SourceVault *SubResource `json:"sourceVault,omitempty"` 1658} 1659 1660// LinuxConfiguration specifies the Linux operating system settings on the virtual machine. <br><br>For a 1661// list of supported Linux distributions, see [Linux on Azure-Endorsed 1662// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) 1663// <br><br> For running non-endorsed distributions, see [Information for Non-Endorsed 1664// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). 1665type LinuxConfiguration struct { 1666 // DisablePasswordAuthentication - Specifies whether password authentication should be disabled. 1667 DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` 1668 // SSH - Specifies the ssh key configuration for a Linux OS. 1669 SSH *SSHConfiguration `json:"ssh,omitempty"` 1670} 1671 1672// ListUsagesResult the List Usages operation response. 1673type ListUsagesResult struct { 1674 autorest.Response `json:"-"` 1675 // Value - The list of compute resource usages. 1676 Value *[]Usage `json:"value,omitempty"` 1677 // 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. 1678 NextLink *string `json:"nextLink,omitempty"` 1679} 1680 1681// ListUsagesResultIterator provides access to a complete listing of Usage values. 1682type ListUsagesResultIterator struct { 1683 i int 1684 page ListUsagesResultPage 1685} 1686 1687// NextWithContext advances to the next value. If there was an error making 1688// the request the iterator does not advance and the error is returned. 1689func (iter *ListUsagesResultIterator) NextWithContext(ctx context.Context) (err error) { 1690 if tracing.IsEnabled() { 1691 ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultIterator.NextWithContext") 1692 defer func() { 1693 sc := -1 1694 if iter.Response().Response.Response != nil { 1695 sc = iter.Response().Response.Response.StatusCode 1696 } 1697 tracing.EndSpan(ctx, sc, err) 1698 }() 1699 } 1700 iter.i++ 1701 if iter.i < len(iter.page.Values()) { 1702 return nil 1703 } 1704 err = iter.page.NextWithContext(ctx) 1705 if err != nil { 1706 iter.i-- 1707 return err 1708 } 1709 iter.i = 0 1710 return nil 1711} 1712 1713// Next advances to the next value. If there was an error making 1714// the request the iterator does not advance and the error is returned. 1715// Deprecated: Use NextWithContext() instead. 1716func (iter *ListUsagesResultIterator) Next() error { 1717 return iter.NextWithContext(context.Background()) 1718} 1719 1720// NotDone returns true if the enumeration should be started or is not yet complete. 1721func (iter ListUsagesResultIterator) NotDone() bool { 1722 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1723} 1724 1725// Response returns the raw server response from the last page request. 1726func (iter ListUsagesResultIterator) Response() ListUsagesResult { 1727 return iter.page.Response() 1728} 1729 1730// Value returns the current value or a zero-initialized value if the 1731// iterator has advanced beyond the end of the collection. 1732func (iter ListUsagesResultIterator) Value() Usage { 1733 if !iter.page.NotDone() { 1734 return Usage{} 1735 } 1736 return iter.page.Values()[iter.i] 1737} 1738 1739// Creates a new instance of the ListUsagesResultIterator type. 1740func NewListUsagesResultIterator(page ListUsagesResultPage) ListUsagesResultIterator { 1741 return ListUsagesResultIterator{page: page} 1742} 1743 1744// IsEmpty returns true if the ListResult contains no values. 1745func (lur ListUsagesResult) IsEmpty() bool { 1746 return lur.Value == nil || len(*lur.Value) == 0 1747} 1748 1749// hasNextLink returns true if the NextLink is not empty. 1750func (lur ListUsagesResult) hasNextLink() bool { 1751 return lur.NextLink != nil && len(*lur.NextLink) != 0 1752} 1753 1754// listUsagesResultPreparer prepares a request to retrieve the next set of results. 1755// It returns nil if no more results exist. 1756func (lur ListUsagesResult) listUsagesResultPreparer(ctx context.Context) (*http.Request, error) { 1757 if !lur.hasNextLink() { 1758 return nil, nil 1759 } 1760 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1761 autorest.AsJSON(), 1762 autorest.AsGet(), 1763 autorest.WithBaseURL(to.String(lur.NextLink))) 1764} 1765 1766// ListUsagesResultPage contains a page of Usage values. 1767type ListUsagesResultPage struct { 1768 fn func(context.Context, ListUsagesResult) (ListUsagesResult, error) 1769 lur ListUsagesResult 1770} 1771 1772// NextWithContext advances to the next page of values. If there was an error making 1773// the request the page does not advance and the error is returned. 1774func (page *ListUsagesResultPage) NextWithContext(ctx context.Context) (err error) { 1775 if tracing.IsEnabled() { 1776 ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultPage.NextWithContext") 1777 defer func() { 1778 sc := -1 1779 if page.Response().Response.Response != nil { 1780 sc = page.Response().Response.Response.StatusCode 1781 } 1782 tracing.EndSpan(ctx, sc, err) 1783 }() 1784 } 1785 for { 1786 next, err := page.fn(ctx, page.lur) 1787 if err != nil { 1788 return err 1789 } 1790 page.lur = next 1791 if !next.hasNextLink() || !next.IsEmpty() { 1792 break 1793 } 1794 } 1795 return nil 1796} 1797 1798// Next advances to the next page of values. If there was an error making 1799// the request the page does not advance and the error is returned. 1800// Deprecated: Use NextWithContext() instead. 1801func (page *ListUsagesResultPage) Next() error { 1802 return page.NextWithContext(context.Background()) 1803} 1804 1805// NotDone returns true if the page enumeration should be started or is not yet complete. 1806func (page ListUsagesResultPage) NotDone() bool { 1807 return !page.lur.IsEmpty() 1808} 1809 1810// Response returns the raw server response from the last page request. 1811func (page ListUsagesResultPage) Response() ListUsagesResult { 1812 return page.lur 1813} 1814 1815// Values returns the slice of values for the current page or nil if there are no values. 1816func (page ListUsagesResultPage) Values() []Usage { 1817 if page.lur.IsEmpty() { 1818 return nil 1819 } 1820 return *page.lur.Value 1821} 1822 1823// Creates a new instance of the ListUsagesResultPage type. 1824func NewListUsagesResultPage(cur ListUsagesResult, getNextPage func(context.Context, ListUsagesResult) (ListUsagesResult, error)) ListUsagesResultPage { 1825 return ListUsagesResultPage{ 1826 fn: getNextPage, 1827 lur: cur, 1828 } 1829} 1830 1831// ListVirtualMachineExtensionImage ... 1832type ListVirtualMachineExtensionImage struct { 1833 autorest.Response `json:"-"` 1834 Value *[]VirtualMachineExtensionImage `json:"value,omitempty"` 1835} 1836 1837// ListVirtualMachineImageResource ... 1838type ListVirtualMachineImageResource struct { 1839 autorest.Response `json:"-"` 1840 Value *[]VirtualMachineImageResource `json:"value,omitempty"` 1841} 1842 1843// LongRunningOperationProperties compute-specific operation properties, including output 1844type LongRunningOperationProperties struct { 1845 // Output - Operation output data (raw JSON) 1846 Output interface{} `json:"output,omitempty"` 1847} 1848 1849// ManagedDiskParameters the parameters of a managed disk. 1850type ManagedDiskParameters struct { 1851 // StorageAccountType - Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'StandardLRS', 'PremiumLRS' 1852 StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` 1853 // ID - Resource Id 1854 ID *string `json:"id,omitempty"` 1855} 1856 1857// NetworkInterfaceReference describes a network interface reference. 1858type NetworkInterfaceReference struct { 1859 *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` 1860 // ID - Resource Id 1861 ID *string `json:"id,omitempty"` 1862} 1863 1864// MarshalJSON is the custom marshaler for NetworkInterfaceReference. 1865func (nir NetworkInterfaceReference) MarshalJSON() ([]byte, error) { 1866 objectMap := make(map[string]interface{}) 1867 if nir.NetworkInterfaceReferenceProperties != nil { 1868 objectMap["properties"] = nir.NetworkInterfaceReferenceProperties 1869 } 1870 if nir.ID != nil { 1871 objectMap["id"] = nir.ID 1872 } 1873 return json.Marshal(objectMap) 1874} 1875 1876// UnmarshalJSON is the custom unmarshaler for NetworkInterfaceReference struct. 1877func (nir *NetworkInterfaceReference) UnmarshalJSON(body []byte) error { 1878 var m map[string]*json.RawMessage 1879 err := json.Unmarshal(body, &m) 1880 if err != nil { 1881 return err 1882 } 1883 for k, v := range m { 1884 switch k { 1885 case "properties": 1886 if v != nil { 1887 var networkInterfaceReferenceProperties NetworkInterfaceReferenceProperties 1888 err = json.Unmarshal(*v, &networkInterfaceReferenceProperties) 1889 if err != nil { 1890 return err 1891 } 1892 nir.NetworkInterfaceReferenceProperties = &networkInterfaceReferenceProperties 1893 } 1894 case "id": 1895 if v != nil { 1896 var ID string 1897 err = json.Unmarshal(*v, &ID) 1898 if err != nil { 1899 return err 1900 } 1901 nir.ID = &ID 1902 } 1903 } 1904 } 1905 1906 return nil 1907} 1908 1909// NetworkInterfaceReferenceProperties describes a network interface reference properties. 1910type NetworkInterfaceReferenceProperties struct { 1911 // Primary - Specifies the primary network interface in case the virtual machine has more than 1 network interface. 1912 Primary *bool `json:"primary,omitempty"` 1913} 1914 1915// NetworkProfile specifies the network interfaces of the virtual machine. 1916type NetworkProfile struct { 1917 // NetworkInterfaces - Specifies the list of resource Ids for the network interfaces associated with the virtual machine. 1918 NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"` 1919} 1920 1921// OperationStatusResponse operation status response 1922type OperationStatusResponse struct { 1923 autorest.Response `json:"-"` 1924 // Name - READ-ONLY; Operation ID 1925 Name *string `json:"name,omitempty"` 1926 // Status - READ-ONLY; Operation status 1927 Status *string `json:"status,omitempty"` 1928 // StartTime - READ-ONLY; Start time of the operation 1929 StartTime *date.Time `json:"startTime,omitempty"` 1930 // EndTime - READ-ONLY; End time of the operation 1931 EndTime *date.Time `json:"endTime,omitempty"` 1932 // Error - READ-ONLY; Api error 1933 Error *APIError `json:"error,omitempty"` 1934} 1935 1936// MarshalJSON is the custom marshaler for OperationStatusResponse. 1937func (osr OperationStatusResponse) MarshalJSON() ([]byte, error) { 1938 objectMap := make(map[string]interface{}) 1939 return json.Marshal(objectMap) 1940} 1941 1942// OSDisk specifies information about the operating system disk used by the virtual machine. <br><br> For 1943// more information about disks, see [About disks and VHDs for Azure virtual 1944// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). 1945type OSDisk struct { 1946 // 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. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. Possible values include: 'Windows', 'Linux' 1947 OsType OperatingSystemTypes `json:"osType,omitempty"` 1948 // EncryptionSettings - Specifies the encryption settings for the OS Disk. <br><br> Minimum api-version: 2015-06-15 1949 EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` 1950 // Name - The disk name. 1951 Name *string `json:"name,omitempty"` 1952 // Vhd - The virtual hard disk. 1953 Vhd *VirtualHardDisk `json:"vhd,omitempty"` 1954 // 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. 1955 Image *VirtualHardDisk `json:"image,omitempty"` 1956 // Caching - Specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' 1957 Caching CachingTypes `json:"caching,omitempty"` 1958 // CreateOption - Specifies how the virtual machine should be created.<br><br> Possible values are:<br><br> **Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.<br><br> **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' 1959 CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` 1960 // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB 1961 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 1962 // ManagedDisk - The managed disk parameters. 1963 ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` 1964} 1965 1966// OSDiskImage contains the os disk image information. 1967type OSDiskImage struct { 1968 // OperatingSystem - The operating system of the osDiskImage. Possible values include: 'Windows', 'Linux' 1969 OperatingSystem OperatingSystemTypes `json:"operatingSystem,omitempty"` 1970} 1971 1972// OSProfile specifies the operating system settings for the virtual machine. 1973type OSProfile struct { 1974 // ComputerName - Specifies the host OS name of the virtual machine. <br><br> This name cannot be updated after the VM is created. <br><br> **Max-length (Windows):** 15 characters <br><br> **Max-length (Linux):** 64 characters. <br><br> 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). 1975 ComputerName *string `json:"computerName,omitempty"` 1976 // AdminUsername - Specifies the name of the administrator account. <br><br> **Windows-only restriction:** Cannot end in "." <br><br> **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". <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters <br><br><li> 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)<br><li> 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) 1977 AdminUsername *string `json:"adminUsername,omitempty"` 1978 // AdminPassword - Specifies the password of the administrator account. <br><br> **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> 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) <br><br> 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) 1979 AdminPassword *string `json:"adminPassword,omitempty"` 1980 // 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. <br><br> 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) 1981 CustomData *string `json:"customData,omitempty"` 1982 // WindowsConfiguration - Specifies Windows operating system settings on the virtual machine. 1983 WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` 1984 // LinuxConfiguration - Specifies the Linux operating system settings on the virtual machine. <br><br>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) <br><br> 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). 1985 LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` 1986 // Secrets - Specifies set of certificates that should be installed onto the virtual machine. 1987 Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` 1988} 1989 1990// Plan specifies information about the marketplace image used to create the virtual machine. This element 1991// is only used for marketplace images. Before you can use a marketplace image from an API, you must enable 1992// the image for programmatic use. In the Azure portal, find the marketplace image that you want to use 1993// and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and 1994// then click **Save**. 1995type Plan struct { 1996 // Name - The plan ID. 1997 Name *string `json:"name,omitempty"` 1998 // Publisher - The publisher ID. 1999 Publisher *string `json:"publisher,omitempty"` 2000 // Product - Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. 2001 Product *string `json:"product,omitempty"` 2002 // PromotionCode - The promotion code. 2003 PromotionCode *string `json:"promotionCode,omitempty"` 2004} 2005 2006// PurchasePlan used for establishing the purchase context of any 3rd Party artifact through MarketPlace. 2007type PurchasePlan struct { 2008 // Publisher - The publisher ID. 2009 Publisher *string `json:"publisher,omitempty"` 2010 // Name - The plan ID. 2011 Name *string `json:"name,omitempty"` 2012 // Product - Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. 2013 Product *string `json:"product,omitempty"` 2014} 2015 2016// Resource the Resource model definition. 2017type Resource struct { 2018 // ID - READ-ONLY; Resource Id 2019 ID *string `json:"id,omitempty"` 2020 // Name - READ-ONLY; Resource name 2021 Name *string `json:"name,omitempty"` 2022 // Type - READ-ONLY; Resource type 2023 Type *string `json:"type,omitempty"` 2024 // Location - Resource location 2025 Location *string `json:"location,omitempty"` 2026 // Tags - Resource tags 2027 Tags map[string]*string `json:"tags"` 2028} 2029 2030// MarshalJSON is the custom marshaler for Resource. 2031func (r Resource) MarshalJSON() ([]byte, error) { 2032 objectMap := make(map[string]interface{}) 2033 if r.Location != nil { 2034 objectMap["location"] = r.Location 2035 } 2036 if r.Tags != nil { 2037 objectMap["tags"] = r.Tags 2038 } 2039 return json.Marshal(objectMap) 2040} 2041 2042// ResourceUpdate the Resource model definition. 2043type ResourceUpdate struct { 2044 // Tags - Resource tags 2045 Tags map[string]*string `json:"tags"` 2046} 2047 2048// MarshalJSON is the custom marshaler for ResourceUpdate. 2049func (ru ResourceUpdate) MarshalJSON() ([]byte, error) { 2050 objectMap := make(map[string]interface{}) 2051 if ru.Tags != nil { 2052 objectMap["tags"] = ru.Tags 2053 } 2054 return json.Marshal(objectMap) 2055} 2056 2057// Sku describes a virtual machine scale set sku. 2058type Sku struct { 2059 // Name - The sku name. 2060 Name *string `json:"name,omitempty"` 2061 // Tier - Specifies the tier of virtual machines in a scale set.<br /><br /> Possible Values:<br /><br /> **Standard**<br /><br /> **Basic** 2062 Tier *string `json:"tier,omitempty"` 2063 // Capacity - Specifies the number of virtual machines in the scale set. 2064 Capacity *int64 `json:"capacity,omitempty"` 2065} 2066 2067// Snapshot snapshot resource. 2068type Snapshot struct { 2069 autorest.Response `json:"-"` 2070 *DiskProperties `json:"properties,omitempty"` 2071 // ID - READ-ONLY; Resource Id 2072 ID *string `json:"id,omitempty"` 2073 // Name - READ-ONLY; Resource name 2074 Name *string `json:"name,omitempty"` 2075 // Type - READ-ONLY; Resource type 2076 Type *string `json:"type,omitempty"` 2077 // Location - Resource location 2078 Location *string `json:"location,omitempty"` 2079 // Tags - Resource tags 2080 Tags map[string]*string `json:"tags"` 2081} 2082 2083// MarshalJSON is the custom marshaler for Snapshot. 2084func (s Snapshot) MarshalJSON() ([]byte, error) { 2085 objectMap := make(map[string]interface{}) 2086 if s.DiskProperties != nil { 2087 objectMap["properties"] = s.DiskProperties 2088 } 2089 if s.Location != nil { 2090 objectMap["location"] = s.Location 2091 } 2092 if s.Tags != nil { 2093 objectMap["tags"] = s.Tags 2094 } 2095 return json.Marshal(objectMap) 2096} 2097 2098// UnmarshalJSON is the custom unmarshaler for Snapshot struct. 2099func (s *Snapshot) UnmarshalJSON(body []byte) error { 2100 var m map[string]*json.RawMessage 2101 err := json.Unmarshal(body, &m) 2102 if err != nil { 2103 return err 2104 } 2105 for k, v := range m { 2106 switch k { 2107 case "properties": 2108 if v != nil { 2109 var diskProperties DiskProperties 2110 err = json.Unmarshal(*v, &diskProperties) 2111 if err != nil { 2112 return err 2113 } 2114 s.DiskProperties = &diskProperties 2115 } 2116 case "id": 2117 if v != nil { 2118 var ID string 2119 err = json.Unmarshal(*v, &ID) 2120 if err != nil { 2121 return err 2122 } 2123 s.ID = &ID 2124 } 2125 case "name": 2126 if v != nil { 2127 var name string 2128 err = json.Unmarshal(*v, &name) 2129 if err != nil { 2130 return err 2131 } 2132 s.Name = &name 2133 } 2134 case "type": 2135 if v != nil { 2136 var typeVar string 2137 err = json.Unmarshal(*v, &typeVar) 2138 if err != nil { 2139 return err 2140 } 2141 s.Type = &typeVar 2142 } 2143 case "location": 2144 if v != nil { 2145 var location string 2146 err = json.Unmarshal(*v, &location) 2147 if err != nil { 2148 return err 2149 } 2150 s.Location = &location 2151 } 2152 case "tags": 2153 if v != nil { 2154 var tags map[string]*string 2155 err = json.Unmarshal(*v, &tags) 2156 if err != nil { 2157 return err 2158 } 2159 s.Tags = tags 2160 } 2161 } 2162 } 2163 2164 return nil 2165} 2166 2167// SnapshotList the List Snapshots operation response. 2168type SnapshotList struct { 2169 autorest.Response `json:"-"` 2170 // Value - A list of snapshots. 2171 Value *[]Snapshot `json:"value,omitempty"` 2172 // NextLink - The uri to fetch the next page of snapshots. Call ListNext() with this to fetch the next page of snapshots. 2173 NextLink *string `json:"nextLink,omitempty"` 2174} 2175 2176// SnapshotListIterator provides access to a complete listing of Snapshot values. 2177type SnapshotListIterator struct { 2178 i int 2179 page SnapshotListPage 2180} 2181 2182// NextWithContext advances to the next value. If there was an error making 2183// the request the iterator does not advance and the error is returned. 2184func (iter *SnapshotListIterator) NextWithContext(ctx context.Context) (err error) { 2185 if tracing.IsEnabled() { 2186 ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListIterator.NextWithContext") 2187 defer func() { 2188 sc := -1 2189 if iter.Response().Response.Response != nil { 2190 sc = iter.Response().Response.Response.StatusCode 2191 } 2192 tracing.EndSpan(ctx, sc, err) 2193 }() 2194 } 2195 iter.i++ 2196 if iter.i < len(iter.page.Values()) { 2197 return nil 2198 } 2199 err = iter.page.NextWithContext(ctx) 2200 if err != nil { 2201 iter.i-- 2202 return err 2203 } 2204 iter.i = 0 2205 return nil 2206} 2207 2208// Next advances to the next value. If there was an error making 2209// the request the iterator does not advance and the error is returned. 2210// Deprecated: Use NextWithContext() instead. 2211func (iter *SnapshotListIterator) Next() error { 2212 return iter.NextWithContext(context.Background()) 2213} 2214 2215// NotDone returns true if the enumeration should be started or is not yet complete. 2216func (iter SnapshotListIterator) NotDone() bool { 2217 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2218} 2219 2220// Response returns the raw server response from the last page request. 2221func (iter SnapshotListIterator) Response() SnapshotList { 2222 return iter.page.Response() 2223} 2224 2225// Value returns the current value or a zero-initialized value if the 2226// iterator has advanced beyond the end of the collection. 2227func (iter SnapshotListIterator) Value() Snapshot { 2228 if !iter.page.NotDone() { 2229 return Snapshot{} 2230 } 2231 return iter.page.Values()[iter.i] 2232} 2233 2234// Creates a new instance of the SnapshotListIterator type. 2235func NewSnapshotListIterator(page SnapshotListPage) SnapshotListIterator { 2236 return SnapshotListIterator{page: page} 2237} 2238 2239// IsEmpty returns true if the ListResult contains no values. 2240func (sl SnapshotList) IsEmpty() bool { 2241 return sl.Value == nil || len(*sl.Value) == 0 2242} 2243 2244// hasNextLink returns true if the NextLink is not empty. 2245func (sl SnapshotList) hasNextLink() bool { 2246 return sl.NextLink != nil && len(*sl.NextLink) != 0 2247} 2248 2249// snapshotListPreparer prepares a request to retrieve the next set of results. 2250// It returns nil if no more results exist. 2251func (sl SnapshotList) snapshotListPreparer(ctx context.Context) (*http.Request, error) { 2252 if !sl.hasNextLink() { 2253 return nil, nil 2254 } 2255 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2256 autorest.AsJSON(), 2257 autorest.AsGet(), 2258 autorest.WithBaseURL(to.String(sl.NextLink))) 2259} 2260 2261// SnapshotListPage contains a page of Snapshot values. 2262type SnapshotListPage struct { 2263 fn func(context.Context, SnapshotList) (SnapshotList, error) 2264 sl SnapshotList 2265} 2266 2267// NextWithContext advances to the next page of values. If there was an error making 2268// the request the page does not advance and the error is returned. 2269func (page *SnapshotListPage) NextWithContext(ctx context.Context) (err error) { 2270 if tracing.IsEnabled() { 2271 ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListPage.NextWithContext") 2272 defer func() { 2273 sc := -1 2274 if page.Response().Response.Response != nil { 2275 sc = page.Response().Response.Response.StatusCode 2276 } 2277 tracing.EndSpan(ctx, sc, err) 2278 }() 2279 } 2280 for { 2281 next, err := page.fn(ctx, page.sl) 2282 if err != nil { 2283 return err 2284 } 2285 page.sl = next 2286 if !next.hasNextLink() || !next.IsEmpty() { 2287 break 2288 } 2289 } 2290 return nil 2291} 2292 2293// Next advances to the next page of values. If there was an error making 2294// the request the page does not advance and the error is returned. 2295// Deprecated: Use NextWithContext() instead. 2296func (page *SnapshotListPage) Next() error { 2297 return page.NextWithContext(context.Background()) 2298} 2299 2300// NotDone returns true if the page enumeration should be started or is not yet complete. 2301func (page SnapshotListPage) NotDone() bool { 2302 return !page.sl.IsEmpty() 2303} 2304 2305// Response returns the raw server response from the last page request. 2306func (page SnapshotListPage) Response() SnapshotList { 2307 return page.sl 2308} 2309 2310// Values returns the slice of values for the current page or nil if there are no values. 2311func (page SnapshotListPage) Values() []Snapshot { 2312 if page.sl.IsEmpty() { 2313 return nil 2314 } 2315 return *page.sl.Value 2316} 2317 2318// Creates a new instance of the SnapshotListPage type. 2319func NewSnapshotListPage(cur SnapshotList, getNextPage func(context.Context, SnapshotList) (SnapshotList, error)) SnapshotListPage { 2320 return SnapshotListPage{ 2321 fn: getNextPage, 2322 sl: cur, 2323 } 2324} 2325 2326// SnapshotsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2327// operation. 2328type SnapshotsCreateOrUpdateFuture struct { 2329 azure.FutureAPI 2330 // Result returns the result of the asynchronous operation. 2331 // If the operation has not completed it will return an error. 2332 Result func(SnapshotsClient) (Snapshot, error) 2333} 2334 2335// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2336func (future *SnapshotsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 2337 var azFuture azure.Future 2338 if err := json.Unmarshal(body, &azFuture); err != nil { 2339 return err 2340 } 2341 future.FutureAPI = &azFuture 2342 future.Result = future.result 2343 return nil 2344} 2345 2346// result is the default implementation for SnapshotsCreateOrUpdateFuture.Result. 2347func (future *SnapshotsCreateOrUpdateFuture) result(client SnapshotsClient) (s Snapshot, err error) { 2348 var done bool 2349 done, err = future.DoneWithContext(context.Background(), client) 2350 if err != nil { 2351 err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 2352 return 2353 } 2354 if !done { 2355 s.Response.Response = future.Response() 2356 err = azure.NewAsyncOpIncompleteError("compute.SnapshotsCreateOrUpdateFuture") 2357 return 2358 } 2359 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2360 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 2361 s, err = client.CreateOrUpdateResponder(s.Response.Response) 2362 if err != nil { 2363 err = autorest.NewErrorWithError(err, "compute.SnapshotsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") 2364 } 2365 } 2366 return 2367} 2368 2369// SnapshotsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 2370// operation. 2371type SnapshotsDeleteFuture struct { 2372 azure.FutureAPI 2373 // Result returns the result of the asynchronous operation. 2374 // If the operation has not completed it will return an error. 2375 Result func(SnapshotsClient) (OperationStatusResponse, error) 2376} 2377 2378// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2379func (future *SnapshotsDeleteFuture) UnmarshalJSON(body []byte) error { 2380 var azFuture azure.Future 2381 if err := json.Unmarshal(body, &azFuture); err != nil { 2382 return err 2383 } 2384 future.FutureAPI = &azFuture 2385 future.Result = future.result 2386 return nil 2387} 2388 2389// result is the default implementation for SnapshotsDeleteFuture.Result. 2390func (future *SnapshotsDeleteFuture) result(client SnapshotsClient) (osr OperationStatusResponse, err error) { 2391 var done bool 2392 done, err = future.DoneWithContext(context.Background(), client) 2393 if err != nil { 2394 err = autorest.NewErrorWithError(err, "compute.SnapshotsDeleteFuture", "Result", future.Response(), "Polling failure") 2395 return 2396 } 2397 if !done { 2398 osr.Response.Response = future.Response() 2399 err = azure.NewAsyncOpIncompleteError("compute.SnapshotsDeleteFuture") 2400 return 2401 } 2402 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2403 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 2404 osr, err = client.DeleteResponder(osr.Response.Response) 2405 if err != nil { 2406 err = autorest.NewErrorWithError(err, "compute.SnapshotsDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") 2407 } 2408 } 2409 return 2410} 2411 2412// SnapshotsGrantAccessFuture an abstraction for monitoring and retrieving the results of a long-running 2413// operation. 2414type SnapshotsGrantAccessFuture struct { 2415 azure.FutureAPI 2416 // Result returns the result of the asynchronous operation. 2417 // If the operation has not completed it will return an error. 2418 Result func(SnapshotsClient) (AccessURI, error) 2419} 2420 2421// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2422func (future *SnapshotsGrantAccessFuture) UnmarshalJSON(body []byte) error { 2423 var azFuture azure.Future 2424 if err := json.Unmarshal(body, &azFuture); err != nil { 2425 return err 2426 } 2427 future.FutureAPI = &azFuture 2428 future.Result = future.result 2429 return nil 2430} 2431 2432// result is the default implementation for SnapshotsGrantAccessFuture.Result. 2433func (future *SnapshotsGrantAccessFuture) result(client SnapshotsClient) (au AccessURI, err error) { 2434 var done bool 2435 done, err = future.DoneWithContext(context.Background(), client) 2436 if err != nil { 2437 err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", future.Response(), "Polling failure") 2438 return 2439 } 2440 if !done { 2441 au.Response.Response = future.Response() 2442 err = azure.NewAsyncOpIncompleteError("compute.SnapshotsGrantAccessFuture") 2443 return 2444 } 2445 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2446 if au.Response.Response, err = future.GetResult(sender); err == nil && au.Response.Response.StatusCode != http.StatusNoContent { 2447 au, err = client.GrantAccessResponder(au.Response.Response) 2448 if err != nil { 2449 err = autorest.NewErrorWithError(err, "compute.SnapshotsGrantAccessFuture", "Result", au.Response.Response, "Failure responding to request") 2450 } 2451 } 2452 return 2453} 2454 2455// SnapshotsRevokeAccessFuture an abstraction for monitoring and retrieving the results of a long-running 2456// operation. 2457type SnapshotsRevokeAccessFuture struct { 2458 azure.FutureAPI 2459 // Result returns the result of the asynchronous operation. 2460 // If the operation has not completed it will return an error. 2461 Result func(SnapshotsClient) (OperationStatusResponse, error) 2462} 2463 2464// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2465func (future *SnapshotsRevokeAccessFuture) UnmarshalJSON(body []byte) error { 2466 var azFuture azure.Future 2467 if err := json.Unmarshal(body, &azFuture); err != nil { 2468 return err 2469 } 2470 future.FutureAPI = &azFuture 2471 future.Result = future.result 2472 return nil 2473} 2474 2475// result is the default implementation for SnapshotsRevokeAccessFuture.Result. 2476func (future *SnapshotsRevokeAccessFuture) result(client SnapshotsClient) (osr OperationStatusResponse, err error) { 2477 var done bool 2478 done, err = future.DoneWithContext(context.Background(), client) 2479 if err != nil { 2480 err = autorest.NewErrorWithError(err, "compute.SnapshotsRevokeAccessFuture", "Result", future.Response(), "Polling failure") 2481 return 2482 } 2483 if !done { 2484 osr.Response.Response = future.Response() 2485 err = azure.NewAsyncOpIncompleteError("compute.SnapshotsRevokeAccessFuture") 2486 return 2487 } 2488 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2489 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 2490 osr, err = client.RevokeAccessResponder(osr.Response.Response) 2491 if err != nil { 2492 err = autorest.NewErrorWithError(err, "compute.SnapshotsRevokeAccessFuture", "Result", osr.Response.Response, "Failure responding to request") 2493 } 2494 } 2495 return 2496} 2497 2498// SnapshotsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2499// operation. 2500type SnapshotsUpdateFuture struct { 2501 azure.FutureAPI 2502 // Result returns the result of the asynchronous operation. 2503 // If the operation has not completed it will return an error. 2504 Result func(SnapshotsClient) (Snapshot, error) 2505} 2506 2507// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2508func (future *SnapshotsUpdateFuture) UnmarshalJSON(body []byte) error { 2509 var azFuture azure.Future 2510 if err := json.Unmarshal(body, &azFuture); err != nil { 2511 return err 2512 } 2513 future.FutureAPI = &azFuture 2514 future.Result = future.result 2515 return nil 2516} 2517 2518// result is the default implementation for SnapshotsUpdateFuture.Result. 2519func (future *SnapshotsUpdateFuture) result(client SnapshotsClient) (s Snapshot, err error) { 2520 var done bool 2521 done, err = future.DoneWithContext(context.Background(), client) 2522 if err != nil { 2523 err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", future.Response(), "Polling failure") 2524 return 2525 } 2526 if !done { 2527 s.Response.Response = future.Response() 2528 err = azure.NewAsyncOpIncompleteError("compute.SnapshotsUpdateFuture") 2529 return 2530 } 2531 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2532 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 2533 s, err = client.UpdateResponder(s.Response.Response) 2534 if err != nil { 2535 err = autorest.NewErrorWithError(err, "compute.SnapshotsUpdateFuture", "Result", s.Response.Response, "Failure responding to request") 2536 } 2537 } 2538 return 2539} 2540 2541// SnapshotUpdate snapshot update resource. 2542type SnapshotUpdate struct { 2543 *DiskUpdateProperties `json:"properties,omitempty"` 2544 // Tags - Resource tags 2545 Tags map[string]*string `json:"tags"` 2546} 2547 2548// MarshalJSON is the custom marshaler for SnapshotUpdate. 2549func (su SnapshotUpdate) MarshalJSON() ([]byte, error) { 2550 objectMap := make(map[string]interface{}) 2551 if su.DiskUpdateProperties != nil { 2552 objectMap["properties"] = su.DiskUpdateProperties 2553 } 2554 if su.Tags != nil { 2555 objectMap["tags"] = su.Tags 2556 } 2557 return json.Marshal(objectMap) 2558} 2559 2560// UnmarshalJSON is the custom unmarshaler for SnapshotUpdate struct. 2561func (su *SnapshotUpdate) UnmarshalJSON(body []byte) error { 2562 var m map[string]*json.RawMessage 2563 err := json.Unmarshal(body, &m) 2564 if err != nil { 2565 return err 2566 } 2567 for k, v := range m { 2568 switch k { 2569 case "properties": 2570 if v != nil { 2571 var diskUpdateProperties DiskUpdateProperties 2572 err = json.Unmarshal(*v, &diskUpdateProperties) 2573 if err != nil { 2574 return err 2575 } 2576 su.DiskUpdateProperties = &diskUpdateProperties 2577 } 2578 case "tags": 2579 if v != nil { 2580 var tags map[string]*string 2581 err = json.Unmarshal(*v, &tags) 2582 if err != nil { 2583 return err 2584 } 2585 su.Tags = tags 2586 } 2587 } 2588 } 2589 2590 return nil 2591} 2592 2593// SourceVault the vault id is an Azure Resource Manager Resource id in the form 2594// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} 2595type SourceVault struct { 2596 // ID - Resource Id 2597 ID *string `json:"id,omitempty"` 2598} 2599 2600// SSHConfiguration SSH configuration for Linux based VMs running on Azure 2601type SSHConfiguration struct { 2602 // PublicKeys - The list of SSH public keys used to authenticate with linux based VMs. 2603 PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` 2604} 2605 2606// SSHPublicKey contains information about SSH certificate public key and the path on the Linux VM where 2607// the public key is placed. 2608type SSHPublicKey struct { 2609 // 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 2610 Path *string `json:"path,omitempty"` 2611 // 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. <br><br> 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). 2612 KeyData *string `json:"keyData,omitempty"` 2613} 2614 2615// StorageProfile specifies the storage settings for the virtual machine disks. 2616type StorageProfile struct { 2617 // 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. 2618 ImageReference *ImageReference `json:"imageReference,omitempty"` 2619 // OsDisk - Specifies information about the operating system disk used by the virtual machine. <br><br> 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). 2620 OsDisk *OSDisk `json:"osDisk,omitempty"` 2621 // DataDisks - Specifies the parameters that are used to add a data disk to a virtual machine. <br><br> 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). 2622 DataDisks *[]DataDisk `json:"dataDisks,omitempty"` 2623} 2624 2625// SubResource ... 2626type SubResource struct { 2627 // ID - Resource Id 2628 ID *string `json:"id,omitempty"` 2629} 2630 2631// SubResourceReadOnly ... 2632type SubResourceReadOnly struct { 2633 // ID - READ-ONLY; Resource Id 2634 ID *string `json:"id,omitempty"` 2635} 2636 2637// MarshalJSON is the custom marshaler for SubResourceReadOnly. 2638func (srro SubResourceReadOnly) MarshalJSON() ([]byte, error) { 2639 objectMap := make(map[string]interface{}) 2640 return json.Marshal(objectMap) 2641} 2642 2643// UpdateResource the Update Resource model definition. 2644type UpdateResource struct { 2645 // Tags - Resource tags 2646 Tags map[string]*string `json:"tags"` 2647} 2648 2649// MarshalJSON is the custom marshaler for UpdateResource. 2650func (ur UpdateResource) MarshalJSON() ([]byte, error) { 2651 objectMap := make(map[string]interface{}) 2652 if ur.Tags != nil { 2653 objectMap["tags"] = ur.Tags 2654 } 2655 return json.Marshal(objectMap) 2656} 2657 2658// UpgradePolicy describes an upgrade policy - automatic or manual. 2659type UpgradePolicy struct { 2660 // Mode - Specifies the mode of an upgrade to virtual machines in the scale set.<br /><br /> Possible values are:<br /><br /> **Manual** - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade action.<br /><br /> **Automatic** - All virtual machines in the scale set are automatically updated at the same time. Possible values include: 'Automatic', 'Manual' 2661 Mode UpgradeMode `json:"mode,omitempty"` 2662} 2663 2664// Usage describes Compute Resource Usage. 2665type Usage struct { 2666 // Unit - An enum describing the unit of usage measurement. 2667 Unit *string `json:"unit,omitempty"` 2668 // CurrentValue - The current usage of the resource. 2669 CurrentValue *int32 `json:"currentValue,omitempty"` 2670 // Limit - The maximum permitted usage of the resource. 2671 Limit *int64 `json:"limit,omitempty"` 2672 // Name - The name of the type of usage. 2673 Name *UsageName `json:"name,omitempty"` 2674} 2675 2676// UsageName the Usage Names. 2677type UsageName struct { 2678 // Value - The name of the resource. 2679 Value *string `json:"value,omitempty"` 2680 // LocalizedValue - The localized name of the resource. 2681 LocalizedValue *string `json:"localizedValue,omitempty"` 2682} 2683 2684// VaultCertificate describes a single certificate reference in a Key Vault, and where the certificate 2685// should reside on the VM. 2686type VaultCertificate struct { 2687 // 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: <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>} 2688 CertificateURL *string `json:"certificateUrl,omitempty"` 2689 // 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. <br><br>For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name <UppercaseThumbprint>.crt for the X509 certificate file and <UppercaseThumbprint>.prv for private key. Both of these files are .pem formatted. 2690 CertificateStore *string `json:"certificateStore,omitempty"` 2691} 2692 2693// VaultSecretGroup describes a set of certificates which are all in the same Key Vault. 2694type VaultSecretGroup struct { 2695 // SourceVault - The relative URL of the Key Vault containing all of the certificates in VaultCertificates. 2696 SourceVault *SubResource `json:"sourceVault,omitempty"` 2697 // VaultCertificates - The list of key vault references in SourceVault which contain certificates. 2698 VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` 2699} 2700 2701// VirtualHardDisk describes the uri of a disk. 2702type VirtualHardDisk struct { 2703 // URI - Specifies the virtual hard disk's uri. 2704 URI *string `json:"uri,omitempty"` 2705} 2706 2707// VirtualMachine describes a Virtual Machine. 2708type VirtualMachine struct { 2709 autorest.Response `json:"-"` 2710 // 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**. 2711 Plan *Plan `json:"plan,omitempty"` 2712 *VirtualMachineProperties `json:"properties,omitempty"` 2713 // Resources - READ-ONLY; The virtual machine child extension resources. 2714 Resources *[]VirtualMachineExtension `json:"resources,omitempty"` 2715 // Identity - The identity of the virtual machine, if configured. 2716 Identity *VirtualMachineIdentity `json:"identity,omitempty"` 2717 // ID - READ-ONLY; Resource Id 2718 ID *string `json:"id,omitempty"` 2719 // Name - READ-ONLY; Resource name 2720 Name *string `json:"name,omitempty"` 2721 // Type - READ-ONLY; Resource type 2722 Type *string `json:"type,omitempty"` 2723 // Location - Resource location 2724 Location *string `json:"location,omitempty"` 2725 // Tags - Resource tags 2726 Tags map[string]*string `json:"tags"` 2727} 2728 2729// MarshalJSON is the custom marshaler for VirtualMachine. 2730func (VM VirtualMachine) MarshalJSON() ([]byte, error) { 2731 objectMap := make(map[string]interface{}) 2732 if VM.Plan != nil { 2733 objectMap["plan"] = VM.Plan 2734 } 2735 if VM.VirtualMachineProperties != nil { 2736 objectMap["properties"] = VM.VirtualMachineProperties 2737 } 2738 if VM.Identity != nil { 2739 objectMap["identity"] = VM.Identity 2740 } 2741 if VM.Location != nil { 2742 objectMap["location"] = VM.Location 2743 } 2744 if VM.Tags != nil { 2745 objectMap["tags"] = VM.Tags 2746 } 2747 return json.Marshal(objectMap) 2748} 2749 2750// UnmarshalJSON is the custom unmarshaler for VirtualMachine struct. 2751func (VM *VirtualMachine) UnmarshalJSON(body []byte) error { 2752 var m map[string]*json.RawMessage 2753 err := json.Unmarshal(body, &m) 2754 if err != nil { 2755 return err 2756 } 2757 for k, v := range m { 2758 switch k { 2759 case "plan": 2760 if v != nil { 2761 var plan Plan 2762 err = json.Unmarshal(*v, &plan) 2763 if err != nil { 2764 return err 2765 } 2766 VM.Plan = &plan 2767 } 2768 case "properties": 2769 if v != nil { 2770 var virtualMachineProperties VirtualMachineProperties 2771 err = json.Unmarshal(*v, &virtualMachineProperties) 2772 if err != nil { 2773 return err 2774 } 2775 VM.VirtualMachineProperties = &virtualMachineProperties 2776 } 2777 case "resources": 2778 if v != nil { 2779 var resources []VirtualMachineExtension 2780 err = json.Unmarshal(*v, &resources) 2781 if err != nil { 2782 return err 2783 } 2784 VM.Resources = &resources 2785 } 2786 case "identity": 2787 if v != nil { 2788 var identity VirtualMachineIdentity 2789 err = json.Unmarshal(*v, &identity) 2790 if err != nil { 2791 return err 2792 } 2793 VM.Identity = &identity 2794 } 2795 case "id": 2796 if v != nil { 2797 var ID string 2798 err = json.Unmarshal(*v, &ID) 2799 if err != nil { 2800 return err 2801 } 2802 VM.ID = &ID 2803 } 2804 case "name": 2805 if v != nil { 2806 var name string 2807 err = json.Unmarshal(*v, &name) 2808 if err != nil { 2809 return err 2810 } 2811 VM.Name = &name 2812 } 2813 case "type": 2814 if v != nil { 2815 var typeVar string 2816 err = json.Unmarshal(*v, &typeVar) 2817 if err != nil { 2818 return err 2819 } 2820 VM.Type = &typeVar 2821 } 2822 case "location": 2823 if v != nil { 2824 var location string 2825 err = json.Unmarshal(*v, &location) 2826 if err != nil { 2827 return err 2828 } 2829 VM.Location = &location 2830 } 2831 case "tags": 2832 if v != nil { 2833 var tags map[string]*string 2834 err = json.Unmarshal(*v, &tags) 2835 if err != nil { 2836 return err 2837 } 2838 VM.Tags = tags 2839 } 2840 } 2841 } 2842 2843 return nil 2844} 2845 2846// VirtualMachineAgentInstanceView the instance view of the VM Agent running on the virtual machine. 2847type VirtualMachineAgentInstanceView struct { 2848 // VMAgentVersion - The VM Agent full version. 2849 VMAgentVersion *string `json:"vmAgentVersion,omitempty"` 2850 // ExtensionHandlers - The virtual machine extension handler instance view. 2851 ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` 2852 // Statuses - The resource status information. 2853 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 2854} 2855 2856// VirtualMachineCaptureParameters capture Virtual Machine parameters. 2857type VirtualMachineCaptureParameters struct { 2858 // VhdPrefix - The captured virtual hard disk's name prefix. 2859 VhdPrefix *string `json:"vhdPrefix,omitempty"` 2860 // DestinationContainerName - The destination container name. 2861 DestinationContainerName *string `json:"destinationContainerName,omitempty"` 2862 // OverwriteVhds - Specifies whether to overwrite the destination virtual hard disk, in case of conflict. 2863 OverwriteVhds *bool `json:"overwriteVhds,omitempty"` 2864} 2865 2866// VirtualMachineCaptureResult resource Id. 2867type VirtualMachineCaptureResult struct { 2868 autorest.Response `json:"-"` 2869 *VirtualMachineCaptureResultProperties `json:"properties,omitempty"` 2870 // ID - Resource Id 2871 ID *string `json:"id,omitempty"` 2872} 2873 2874// MarshalJSON is the custom marshaler for VirtualMachineCaptureResult. 2875func (vmcr VirtualMachineCaptureResult) MarshalJSON() ([]byte, error) { 2876 objectMap := make(map[string]interface{}) 2877 if vmcr.VirtualMachineCaptureResultProperties != nil { 2878 objectMap["properties"] = vmcr.VirtualMachineCaptureResultProperties 2879 } 2880 if vmcr.ID != nil { 2881 objectMap["id"] = vmcr.ID 2882 } 2883 return json.Marshal(objectMap) 2884} 2885 2886// UnmarshalJSON is the custom unmarshaler for VirtualMachineCaptureResult struct. 2887func (vmcr *VirtualMachineCaptureResult) UnmarshalJSON(body []byte) error { 2888 var m map[string]*json.RawMessage 2889 err := json.Unmarshal(body, &m) 2890 if err != nil { 2891 return err 2892 } 2893 for k, v := range m { 2894 switch k { 2895 case "properties": 2896 if v != nil { 2897 var virtualMachineCaptureResultProperties VirtualMachineCaptureResultProperties 2898 err = json.Unmarshal(*v, &virtualMachineCaptureResultProperties) 2899 if err != nil { 2900 return err 2901 } 2902 vmcr.VirtualMachineCaptureResultProperties = &virtualMachineCaptureResultProperties 2903 } 2904 case "id": 2905 if v != nil { 2906 var ID string 2907 err = json.Unmarshal(*v, &ID) 2908 if err != nil { 2909 return err 2910 } 2911 vmcr.ID = &ID 2912 } 2913 } 2914 } 2915 2916 return nil 2917} 2918 2919// VirtualMachineCaptureResultProperties compute-specific operation properties, including output 2920type VirtualMachineCaptureResultProperties struct { 2921 // Output - Operation output data (raw JSON) 2922 Output interface{} `json:"output,omitempty"` 2923} 2924 2925// VirtualMachineExtension describes a Virtual Machine Extension. 2926type VirtualMachineExtension struct { 2927 autorest.Response `json:"-"` 2928 *VirtualMachineExtensionProperties `json:"properties,omitempty"` 2929 // ID - READ-ONLY; Resource Id 2930 ID *string `json:"id,omitempty"` 2931 // Name - READ-ONLY; Resource name 2932 Name *string `json:"name,omitempty"` 2933 // Type - READ-ONLY; Resource type 2934 Type *string `json:"type,omitempty"` 2935 // Location - Resource location 2936 Location *string `json:"location,omitempty"` 2937 // Tags - Resource tags 2938 Tags map[string]*string `json:"tags"` 2939} 2940 2941// MarshalJSON is the custom marshaler for VirtualMachineExtension. 2942func (vme VirtualMachineExtension) MarshalJSON() ([]byte, error) { 2943 objectMap := make(map[string]interface{}) 2944 if vme.VirtualMachineExtensionProperties != nil { 2945 objectMap["properties"] = vme.VirtualMachineExtensionProperties 2946 } 2947 if vme.Location != nil { 2948 objectMap["location"] = vme.Location 2949 } 2950 if vme.Tags != nil { 2951 objectMap["tags"] = vme.Tags 2952 } 2953 return json.Marshal(objectMap) 2954} 2955 2956// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtension struct. 2957func (vme *VirtualMachineExtension) UnmarshalJSON(body []byte) error { 2958 var m map[string]*json.RawMessage 2959 err := json.Unmarshal(body, &m) 2960 if err != nil { 2961 return err 2962 } 2963 for k, v := range m { 2964 switch k { 2965 case "properties": 2966 if v != nil { 2967 var virtualMachineExtensionProperties VirtualMachineExtensionProperties 2968 err = json.Unmarshal(*v, &virtualMachineExtensionProperties) 2969 if err != nil { 2970 return err 2971 } 2972 vme.VirtualMachineExtensionProperties = &virtualMachineExtensionProperties 2973 } 2974 case "id": 2975 if v != nil { 2976 var ID string 2977 err = json.Unmarshal(*v, &ID) 2978 if err != nil { 2979 return err 2980 } 2981 vme.ID = &ID 2982 } 2983 case "name": 2984 if v != nil { 2985 var name string 2986 err = json.Unmarshal(*v, &name) 2987 if err != nil { 2988 return err 2989 } 2990 vme.Name = &name 2991 } 2992 case "type": 2993 if v != nil { 2994 var typeVar string 2995 err = json.Unmarshal(*v, &typeVar) 2996 if err != nil { 2997 return err 2998 } 2999 vme.Type = &typeVar 3000 } 3001 case "location": 3002 if v != nil { 3003 var location string 3004 err = json.Unmarshal(*v, &location) 3005 if err != nil { 3006 return err 3007 } 3008 vme.Location = &location 3009 } 3010 case "tags": 3011 if v != nil { 3012 var tags map[string]*string 3013 err = json.Unmarshal(*v, &tags) 3014 if err != nil { 3015 return err 3016 } 3017 vme.Tags = tags 3018 } 3019 } 3020 } 3021 3022 return nil 3023} 3024 3025// VirtualMachineExtensionHandlerInstanceView the instance view of a virtual machine extension handler. 3026type VirtualMachineExtensionHandlerInstanceView struct { 3027 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 3028 Type *string `json:"type,omitempty"` 3029 // TypeHandlerVersion - Specifies the version of the script handler. 3030 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 3031 // Status - The extension handler status. 3032 Status *InstanceViewStatus `json:"status,omitempty"` 3033} 3034 3035// VirtualMachineExtensionImage describes a Virtual Machine Extension Image. 3036type VirtualMachineExtensionImage struct { 3037 autorest.Response `json:"-"` 3038 *VirtualMachineExtensionImageProperties `json:"properties,omitempty"` 3039 // ID - READ-ONLY; Resource Id 3040 ID *string `json:"id,omitempty"` 3041 // Name - READ-ONLY; Resource name 3042 Name *string `json:"name,omitempty"` 3043 // Type - READ-ONLY; Resource type 3044 Type *string `json:"type,omitempty"` 3045 // Location - Resource location 3046 Location *string `json:"location,omitempty"` 3047 // Tags - Resource tags 3048 Tags map[string]*string `json:"tags"` 3049} 3050 3051// MarshalJSON is the custom marshaler for VirtualMachineExtensionImage. 3052func (vmei VirtualMachineExtensionImage) MarshalJSON() ([]byte, error) { 3053 objectMap := make(map[string]interface{}) 3054 if vmei.VirtualMachineExtensionImageProperties != nil { 3055 objectMap["properties"] = vmei.VirtualMachineExtensionImageProperties 3056 } 3057 if vmei.Location != nil { 3058 objectMap["location"] = vmei.Location 3059 } 3060 if vmei.Tags != nil { 3061 objectMap["tags"] = vmei.Tags 3062 } 3063 return json.Marshal(objectMap) 3064} 3065 3066// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtensionImage struct. 3067func (vmei *VirtualMachineExtensionImage) UnmarshalJSON(body []byte) error { 3068 var m map[string]*json.RawMessage 3069 err := json.Unmarshal(body, &m) 3070 if err != nil { 3071 return err 3072 } 3073 for k, v := range m { 3074 switch k { 3075 case "properties": 3076 if v != nil { 3077 var virtualMachineExtensionImageProperties VirtualMachineExtensionImageProperties 3078 err = json.Unmarshal(*v, &virtualMachineExtensionImageProperties) 3079 if err != nil { 3080 return err 3081 } 3082 vmei.VirtualMachineExtensionImageProperties = &virtualMachineExtensionImageProperties 3083 } 3084 case "id": 3085 if v != nil { 3086 var ID string 3087 err = json.Unmarshal(*v, &ID) 3088 if err != nil { 3089 return err 3090 } 3091 vmei.ID = &ID 3092 } 3093 case "name": 3094 if v != nil { 3095 var name string 3096 err = json.Unmarshal(*v, &name) 3097 if err != nil { 3098 return err 3099 } 3100 vmei.Name = &name 3101 } 3102 case "type": 3103 if v != nil { 3104 var typeVar string 3105 err = json.Unmarshal(*v, &typeVar) 3106 if err != nil { 3107 return err 3108 } 3109 vmei.Type = &typeVar 3110 } 3111 case "location": 3112 if v != nil { 3113 var location string 3114 err = json.Unmarshal(*v, &location) 3115 if err != nil { 3116 return err 3117 } 3118 vmei.Location = &location 3119 } 3120 case "tags": 3121 if v != nil { 3122 var tags map[string]*string 3123 err = json.Unmarshal(*v, &tags) 3124 if err != nil { 3125 return err 3126 } 3127 vmei.Tags = tags 3128 } 3129 } 3130 } 3131 3132 return nil 3133} 3134 3135// VirtualMachineExtensionImageProperties describes the properties of a Virtual Machine Extension Image. 3136type VirtualMachineExtensionImageProperties struct { 3137 // OperatingSystem - The operating system this extension supports. 3138 OperatingSystem *string `json:"operatingSystem,omitempty"` 3139 // ComputeRole - The type of role (IaaS or PaaS) this extension supports. 3140 ComputeRole *string `json:"computeRole,omitempty"` 3141 // HandlerSchema - The schema defined by publisher, where extension consumers should provide settings in a matching schema. 3142 HandlerSchema *string `json:"handlerSchema,omitempty"` 3143 // 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. 3144 VMScaleSetEnabled *bool `json:"vmScaleSetEnabled,omitempty"` 3145 // SupportsMultipleExtensions - Whether the handler can support multiple extensions. 3146 SupportsMultipleExtensions *bool `json:"supportsMultipleExtensions,omitempty"` 3147} 3148 3149// VirtualMachineExtensionInstanceView the instance view of a virtual machine extension. 3150type VirtualMachineExtensionInstanceView struct { 3151 // Name - The virtual machine extension name. 3152 Name *string `json:"name,omitempty"` 3153 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 3154 Type *string `json:"type,omitempty"` 3155 // TypeHandlerVersion - Specifies the version of the script handler. 3156 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 3157 // Substatuses - The resource status information. 3158 Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` 3159 // Statuses - The resource status information. 3160 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 3161} 3162 3163// VirtualMachineExtensionProperties describes the properties of a Virtual Machine Extension. 3164type VirtualMachineExtensionProperties struct { 3165 // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. 3166 ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` 3167 // Publisher - The name of the extension handler publisher. 3168 Publisher *string `json:"publisher,omitempty"` 3169 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 3170 Type *string `json:"type,omitempty"` 3171 // TypeHandlerVersion - Specifies the version of the script handler. 3172 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 3173 // 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. 3174 AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` 3175 // Settings - Json formatted public settings for the extension. 3176 Settings interface{} `json:"settings,omitempty"` 3177 // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. 3178 ProtectedSettings interface{} `json:"protectedSettings,omitempty"` 3179 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 3180 ProvisioningState *string `json:"provisioningState,omitempty"` 3181 // InstanceView - The virtual machine extension instance view. 3182 InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` 3183} 3184 3185// MarshalJSON is the custom marshaler for VirtualMachineExtensionProperties. 3186func (vmep VirtualMachineExtensionProperties) MarshalJSON() ([]byte, error) { 3187 objectMap := make(map[string]interface{}) 3188 if vmep.ForceUpdateTag != nil { 3189 objectMap["forceUpdateTag"] = vmep.ForceUpdateTag 3190 } 3191 if vmep.Publisher != nil { 3192 objectMap["publisher"] = vmep.Publisher 3193 } 3194 if vmep.Type != nil { 3195 objectMap["type"] = vmep.Type 3196 } 3197 if vmep.TypeHandlerVersion != nil { 3198 objectMap["typeHandlerVersion"] = vmep.TypeHandlerVersion 3199 } 3200 if vmep.AutoUpgradeMinorVersion != nil { 3201 objectMap["autoUpgradeMinorVersion"] = vmep.AutoUpgradeMinorVersion 3202 } 3203 if vmep.Settings != nil { 3204 objectMap["settings"] = vmep.Settings 3205 } 3206 if vmep.ProtectedSettings != nil { 3207 objectMap["protectedSettings"] = vmep.ProtectedSettings 3208 } 3209 if vmep.InstanceView != nil { 3210 objectMap["instanceView"] = vmep.InstanceView 3211 } 3212 return json.Marshal(objectMap) 3213} 3214 3215// VirtualMachineExtensionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of 3216// a long-running operation. 3217type VirtualMachineExtensionsCreateOrUpdateFuture struct { 3218 azure.FutureAPI 3219 // Result returns the result of the asynchronous operation. 3220 // If the operation has not completed it will return an error. 3221 Result func(VirtualMachineExtensionsClient) (VirtualMachineExtension, error) 3222} 3223 3224// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3225func (future *VirtualMachineExtensionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 3226 var azFuture azure.Future 3227 if err := json.Unmarshal(body, &azFuture); err != nil { 3228 return err 3229 } 3230 future.FutureAPI = &azFuture 3231 future.Result = future.result 3232 return nil 3233} 3234 3235// result is the default implementation for VirtualMachineExtensionsCreateOrUpdateFuture.Result. 3236func (future *VirtualMachineExtensionsCreateOrUpdateFuture) result(client VirtualMachineExtensionsClient) (vme VirtualMachineExtension, err error) { 3237 var done bool 3238 done, err = future.DoneWithContext(context.Background(), client) 3239 if err != nil { 3240 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 3241 return 3242 } 3243 if !done { 3244 vme.Response.Response = future.Response() 3245 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsCreateOrUpdateFuture") 3246 return 3247 } 3248 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3249 if vme.Response.Response, err = future.GetResult(sender); err == nil && vme.Response.Response.StatusCode != http.StatusNoContent { 3250 vme, err = client.CreateOrUpdateResponder(vme.Response.Response) 3251 if err != nil { 3252 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", vme.Response.Response, "Failure responding to request") 3253 } 3254 } 3255 return 3256} 3257 3258// VirtualMachineExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a 3259// long-running operation. 3260type VirtualMachineExtensionsDeleteFuture struct { 3261 azure.FutureAPI 3262 // Result returns the result of the asynchronous operation. 3263 // If the operation has not completed it will return an error. 3264 Result func(VirtualMachineExtensionsClient) (OperationStatusResponse, error) 3265} 3266 3267// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3268func (future *VirtualMachineExtensionsDeleteFuture) UnmarshalJSON(body []byte) error { 3269 var azFuture azure.Future 3270 if err := json.Unmarshal(body, &azFuture); err != nil { 3271 return err 3272 } 3273 future.FutureAPI = &azFuture 3274 future.Result = future.result 3275 return nil 3276} 3277 3278// result is the default implementation for VirtualMachineExtensionsDeleteFuture.Result. 3279func (future *VirtualMachineExtensionsDeleteFuture) result(client VirtualMachineExtensionsClient) (osr OperationStatusResponse, err error) { 3280 var done bool 3281 done, err = future.DoneWithContext(context.Background(), client) 3282 if err != nil { 3283 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") 3284 return 3285 } 3286 if !done { 3287 osr.Response.Response = future.Response() 3288 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsDeleteFuture") 3289 return 3290 } 3291 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3292 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3293 osr, err = client.DeleteResponder(osr.Response.Response) 3294 if err != nil { 3295 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") 3296 } 3297 } 3298 return 3299} 3300 3301// VirtualMachineExtensionsListResult the List Extension operation response 3302type VirtualMachineExtensionsListResult struct { 3303 autorest.Response `json:"-"` 3304 // Value - The list of extensions 3305 Value *[]VirtualMachineExtension `json:"value,omitempty"` 3306} 3307 3308// VirtualMachineExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a 3309// long-running operation. 3310type VirtualMachineExtensionsUpdateFuture struct { 3311 azure.FutureAPI 3312 // Result returns the result of the asynchronous operation. 3313 // If the operation has not completed it will return an error. 3314 Result func(VirtualMachineExtensionsClient) (VirtualMachineExtension, error) 3315} 3316 3317// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3318func (future *VirtualMachineExtensionsUpdateFuture) UnmarshalJSON(body []byte) error { 3319 var azFuture azure.Future 3320 if err := json.Unmarshal(body, &azFuture); err != nil { 3321 return err 3322 } 3323 future.FutureAPI = &azFuture 3324 future.Result = future.result 3325 return nil 3326} 3327 3328// result is the default implementation for VirtualMachineExtensionsUpdateFuture.Result. 3329func (future *VirtualMachineExtensionsUpdateFuture) result(client VirtualMachineExtensionsClient) (vme VirtualMachineExtension, err error) { 3330 var done bool 3331 done, err = future.DoneWithContext(context.Background(), client) 3332 if err != nil { 3333 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") 3334 return 3335 } 3336 if !done { 3337 vme.Response.Response = future.Response() 3338 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsUpdateFuture") 3339 return 3340 } 3341 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3342 if vme.Response.Response, err = future.GetResult(sender); err == nil && vme.Response.Response.StatusCode != http.StatusNoContent { 3343 vme, err = client.UpdateResponder(vme.Response.Response) 3344 if err != nil { 3345 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", vme.Response.Response, "Failure responding to request") 3346 } 3347 } 3348 return 3349} 3350 3351// VirtualMachineExtensionUpdate describes a Virtual Machine Extension. 3352type VirtualMachineExtensionUpdate struct { 3353 *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` 3354 // Tags - Resource tags 3355 Tags map[string]*string `json:"tags"` 3356} 3357 3358// MarshalJSON is the custom marshaler for VirtualMachineExtensionUpdate. 3359func (vmeu VirtualMachineExtensionUpdate) MarshalJSON() ([]byte, error) { 3360 objectMap := make(map[string]interface{}) 3361 if vmeu.VirtualMachineExtensionUpdateProperties != nil { 3362 objectMap["properties"] = vmeu.VirtualMachineExtensionUpdateProperties 3363 } 3364 if vmeu.Tags != nil { 3365 objectMap["tags"] = vmeu.Tags 3366 } 3367 return json.Marshal(objectMap) 3368} 3369 3370// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtensionUpdate struct. 3371func (vmeu *VirtualMachineExtensionUpdate) UnmarshalJSON(body []byte) error { 3372 var m map[string]*json.RawMessage 3373 err := json.Unmarshal(body, &m) 3374 if err != nil { 3375 return err 3376 } 3377 for k, v := range m { 3378 switch k { 3379 case "properties": 3380 if v != nil { 3381 var virtualMachineExtensionUpdateProperties VirtualMachineExtensionUpdateProperties 3382 err = json.Unmarshal(*v, &virtualMachineExtensionUpdateProperties) 3383 if err != nil { 3384 return err 3385 } 3386 vmeu.VirtualMachineExtensionUpdateProperties = &virtualMachineExtensionUpdateProperties 3387 } 3388 case "tags": 3389 if v != nil { 3390 var tags map[string]*string 3391 err = json.Unmarshal(*v, &tags) 3392 if err != nil { 3393 return err 3394 } 3395 vmeu.Tags = tags 3396 } 3397 } 3398 } 3399 3400 return nil 3401} 3402 3403// VirtualMachineExtensionUpdateProperties describes the properties of a Virtual Machine Extension. 3404type VirtualMachineExtensionUpdateProperties struct { 3405 // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. 3406 ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` 3407 // Publisher - The name of the extension handler publisher. 3408 Publisher *string `json:"publisher,omitempty"` 3409 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 3410 Type *string `json:"type,omitempty"` 3411 // TypeHandlerVersion - Specifies the version of the script handler. 3412 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 3413 // 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. 3414 AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` 3415 // Settings - Json formatted public settings for the extension. 3416 Settings interface{} `json:"settings,omitempty"` 3417 // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. 3418 ProtectedSettings interface{} `json:"protectedSettings,omitempty"` 3419} 3420 3421// VirtualMachineIdentity identity for the virtual machine. 3422type VirtualMachineIdentity struct { 3423 // PrincipalID - READ-ONLY; The principal id of virtual machine identity. 3424 PrincipalID *string `json:"principalId,omitempty"` 3425 // TenantID - READ-ONLY; The tenant id associated with the virtual machine. 3426 TenantID *string `json:"tenantId,omitempty"` 3427 // 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' 3428 Type ResourceIdentityType `json:"type,omitempty"` 3429} 3430 3431// MarshalJSON is the custom marshaler for VirtualMachineIdentity. 3432func (vmi VirtualMachineIdentity) MarshalJSON() ([]byte, error) { 3433 objectMap := make(map[string]interface{}) 3434 if vmi.Type != "" { 3435 objectMap["type"] = vmi.Type 3436 } 3437 return json.Marshal(objectMap) 3438} 3439 3440// VirtualMachineImage describes a Virtual Machine Image. 3441type VirtualMachineImage struct { 3442 autorest.Response `json:"-"` 3443 *VirtualMachineImageProperties `json:"properties,omitempty"` 3444 // Name - The name of the resource. 3445 Name *string `json:"name,omitempty"` 3446 // Location - The supported Azure location of the resource. 3447 Location *string `json:"location,omitempty"` 3448 // 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). 3449 Tags map[string]*string `json:"tags"` 3450 // ID - Resource Id 3451 ID *string `json:"id,omitempty"` 3452} 3453 3454// MarshalJSON is the custom marshaler for VirtualMachineImage. 3455func (vmi VirtualMachineImage) MarshalJSON() ([]byte, error) { 3456 objectMap := make(map[string]interface{}) 3457 if vmi.VirtualMachineImageProperties != nil { 3458 objectMap["properties"] = vmi.VirtualMachineImageProperties 3459 } 3460 if vmi.Name != nil { 3461 objectMap["name"] = vmi.Name 3462 } 3463 if vmi.Location != nil { 3464 objectMap["location"] = vmi.Location 3465 } 3466 if vmi.Tags != nil { 3467 objectMap["tags"] = vmi.Tags 3468 } 3469 if vmi.ID != nil { 3470 objectMap["id"] = vmi.ID 3471 } 3472 return json.Marshal(objectMap) 3473} 3474 3475// UnmarshalJSON is the custom unmarshaler for VirtualMachineImage struct. 3476func (vmi *VirtualMachineImage) UnmarshalJSON(body []byte) error { 3477 var m map[string]*json.RawMessage 3478 err := json.Unmarshal(body, &m) 3479 if err != nil { 3480 return err 3481 } 3482 for k, v := range m { 3483 switch k { 3484 case "properties": 3485 if v != nil { 3486 var virtualMachineImageProperties VirtualMachineImageProperties 3487 err = json.Unmarshal(*v, &virtualMachineImageProperties) 3488 if err != nil { 3489 return err 3490 } 3491 vmi.VirtualMachineImageProperties = &virtualMachineImageProperties 3492 } 3493 case "name": 3494 if v != nil { 3495 var name string 3496 err = json.Unmarshal(*v, &name) 3497 if err != nil { 3498 return err 3499 } 3500 vmi.Name = &name 3501 } 3502 case "location": 3503 if v != nil { 3504 var location string 3505 err = json.Unmarshal(*v, &location) 3506 if err != nil { 3507 return err 3508 } 3509 vmi.Location = &location 3510 } 3511 case "tags": 3512 if v != nil { 3513 var tags map[string]*string 3514 err = json.Unmarshal(*v, &tags) 3515 if err != nil { 3516 return err 3517 } 3518 vmi.Tags = tags 3519 } 3520 case "id": 3521 if v != nil { 3522 var ID string 3523 err = json.Unmarshal(*v, &ID) 3524 if err != nil { 3525 return err 3526 } 3527 vmi.ID = &ID 3528 } 3529 } 3530 } 3531 3532 return nil 3533} 3534 3535// VirtualMachineImageProperties describes the properties of a Virtual Machine Image. 3536type VirtualMachineImageProperties struct { 3537 Plan *PurchasePlan `json:"plan,omitempty"` 3538 OsDiskImage *OSDiskImage `json:"osDiskImage,omitempty"` 3539 DataDiskImages *[]DataDiskImage `json:"dataDiskImages,omitempty"` 3540} 3541 3542// VirtualMachineImageResource virtual machine image resource information. 3543type VirtualMachineImageResource struct { 3544 // Name - The name of the resource. 3545 Name *string `json:"name,omitempty"` 3546 // Location - The supported Azure location of the resource. 3547 Location *string `json:"location,omitempty"` 3548 // 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). 3549 Tags map[string]*string `json:"tags"` 3550 // ID - Resource Id 3551 ID *string `json:"id,omitempty"` 3552} 3553 3554// MarshalJSON is the custom marshaler for VirtualMachineImageResource. 3555func (vmir VirtualMachineImageResource) MarshalJSON() ([]byte, error) { 3556 objectMap := make(map[string]interface{}) 3557 if vmir.Name != nil { 3558 objectMap["name"] = vmir.Name 3559 } 3560 if vmir.Location != nil { 3561 objectMap["location"] = vmir.Location 3562 } 3563 if vmir.Tags != nil { 3564 objectMap["tags"] = vmir.Tags 3565 } 3566 if vmir.ID != nil { 3567 objectMap["id"] = vmir.ID 3568 } 3569 return json.Marshal(objectMap) 3570} 3571 3572// VirtualMachineInstanceView the instance view of a virtual machine. 3573type VirtualMachineInstanceView struct { 3574 // PlatformUpdateDomain - Specifies the update domain of the virtual machine. 3575 PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` 3576 // PlatformFaultDomain - Specifies the fault domain of the virtual machine. 3577 PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` 3578 // RdpThumbPrint - The Remote desktop certificate thumbprint. 3579 RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` 3580 // VMAgent - The VM Agent running on the virtual machine. 3581 VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` 3582 // Disks - The virtual machine disk information. 3583 Disks *[]DiskInstanceView `json:"disks,omitempty"` 3584 // Extensions - The extensions information. 3585 Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` 3586 // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. 3587 BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` 3588 // Statuses - The resource status information. 3589 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 3590} 3591 3592// VirtualMachineListResult the List Virtual Machine operation response. 3593type VirtualMachineListResult struct { 3594 autorest.Response `json:"-"` 3595 // Value - The list of virtual machines. 3596 Value *[]VirtualMachine `json:"value,omitempty"` 3597 // NextLink - The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch the next page of Virtual Machines. 3598 NextLink *string `json:"nextLink,omitempty"` 3599} 3600 3601// VirtualMachineListResultIterator provides access to a complete listing of VirtualMachine values. 3602type VirtualMachineListResultIterator struct { 3603 i int 3604 page VirtualMachineListResultPage 3605} 3606 3607// NextWithContext advances to the next value. If there was an error making 3608// the request the iterator does not advance and the error is returned. 3609func (iter *VirtualMachineListResultIterator) NextWithContext(ctx context.Context) (err error) { 3610 if tracing.IsEnabled() { 3611 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineListResultIterator.NextWithContext") 3612 defer func() { 3613 sc := -1 3614 if iter.Response().Response.Response != nil { 3615 sc = iter.Response().Response.Response.StatusCode 3616 } 3617 tracing.EndSpan(ctx, sc, err) 3618 }() 3619 } 3620 iter.i++ 3621 if iter.i < len(iter.page.Values()) { 3622 return nil 3623 } 3624 err = iter.page.NextWithContext(ctx) 3625 if err != nil { 3626 iter.i-- 3627 return err 3628 } 3629 iter.i = 0 3630 return nil 3631} 3632 3633// Next advances to the next value. If there was an error making 3634// the request the iterator does not advance and the error is returned. 3635// Deprecated: Use NextWithContext() instead. 3636func (iter *VirtualMachineListResultIterator) Next() error { 3637 return iter.NextWithContext(context.Background()) 3638} 3639 3640// NotDone returns true if the enumeration should be started or is not yet complete. 3641func (iter VirtualMachineListResultIterator) NotDone() bool { 3642 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3643} 3644 3645// Response returns the raw server response from the last page request. 3646func (iter VirtualMachineListResultIterator) Response() VirtualMachineListResult { 3647 return iter.page.Response() 3648} 3649 3650// Value returns the current value or a zero-initialized value if the 3651// iterator has advanced beyond the end of the collection. 3652func (iter VirtualMachineListResultIterator) Value() VirtualMachine { 3653 if !iter.page.NotDone() { 3654 return VirtualMachine{} 3655 } 3656 return iter.page.Values()[iter.i] 3657} 3658 3659// Creates a new instance of the VirtualMachineListResultIterator type. 3660func NewVirtualMachineListResultIterator(page VirtualMachineListResultPage) VirtualMachineListResultIterator { 3661 return VirtualMachineListResultIterator{page: page} 3662} 3663 3664// IsEmpty returns true if the ListResult contains no values. 3665func (vmlr VirtualMachineListResult) IsEmpty() bool { 3666 return vmlr.Value == nil || len(*vmlr.Value) == 0 3667} 3668 3669// hasNextLink returns true if the NextLink is not empty. 3670func (vmlr VirtualMachineListResult) hasNextLink() bool { 3671 return vmlr.NextLink != nil && len(*vmlr.NextLink) != 0 3672} 3673 3674// virtualMachineListResultPreparer prepares a request to retrieve the next set of results. 3675// It returns nil if no more results exist. 3676func (vmlr VirtualMachineListResult) virtualMachineListResultPreparer(ctx context.Context) (*http.Request, error) { 3677 if !vmlr.hasNextLink() { 3678 return nil, nil 3679 } 3680 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3681 autorest.AsJSON(), 3682 autorest.AsGet(), 3683 autorest.WithBaseURL(to.String(vmlr.NextLink))) 3684} 3685 3686// VirtualMachineListResultPage contains a page of VirtualMachine values. 3687type VirtualMachineListResultPage struct { 3688 fn func(context.Context, VirtualMachineListResult) (VirtualMachineListResult, error) 3689 vmlr VirtualMachineListResult 3690} 3691 3692// NextWithContext advances to the next page of values. If there was an error making 3693// the request the page does not advance and the error is returned. 3694func (page *VirtualMachineListResultPage) NextWithContext(ctx context.Context) (err error) { 3695 if tracing.IsEnabled() { 3696 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineListResultPage.NextWithContext") 3697 defer func() { 3698 sc := -1 3699 if page.Response().Response.Response != nil { 3700 sc = page.Response().Response.Response.StatusCode 3701 } 3702 tracing.EndSpan(ctx, sc, err) 3703 }() 3704 } 3705 for { 3706 next, err := page.fn(ctx, page.vmlr) 3707 if err != nil { 3708 return err 3709 } 3710 page.vmlr = next 3711 if !next.hasNextLink() || !next.IsEmpty() { 3712 break 3713 } 3714 } 3715 return nil 3716} 3717 3718// Next advances to the next page of values. If there was an error making 3719// the request the page does not advance and the error is returned. 3720// Deprecated: Use NextWithContext() instead. 3721func (page *VirtualMachineListResultPage) Next() error { 3722 return page.NextWithContext(context.Background()) 3723} 3724 3725// NotDone returns true if the page enumeration should be started or is not yet complete. 3726func (page VirtualMachineListResultPage) NotDone() bool { 3727 return !page.vmlr.IsEmpty() 3728} 3729 3730// Response returns the raw server response from the last page request. 3731func (page VirtualMachineListResultPage) Response() VirtualMachineListResult { 3732 return page.vmlr 3733} 3734 3735// Values returns the slice of values for the current page or nil if there are no values. 3736func (page VirtualMachineListResultPage) Values() []VirtualMachine { 3737 if page.vmlr.IsEmpty() { 3738 return nil 3739 } 3740 return *page.vmlr.Value 3741} 3742 3743// Creates a new instance of the VirtualMachineListResultPage type. 3744func NewVirtualMachineListResultPage(cur VirtualMachineListResult, getNextPage func(context.Context, VirtualMachineListResult) (VirtualMachineListResult, error)) VirtualMachineListResultPage { 3745 return VirtualMachineListResultPage{ 3746 fn: getNextPage, 3747 vmlr: cur, 3748 } 3749} 3750 3751// VirtualMachineProperties describes the properties of a Virtual Machine. 3752type VirtualMachineProperties struct { 3753 // HardwareProfile - Specifies the hardware settings for the virtual machine. 3754 HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` 3755 // StorageProfile - Specifies the storage settings for the virtual machine disks. 3756 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 3757 // OsProfile - Specifies the operating system settings for the virtual machine. 3758 OsProfile *OSProfile `json:"osProfile,omitempty"` 3759 // NetworkProfile - Specifies the network interfaces of the virtual machine. 3760 NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` 3761 // DiagnosticsProfile - Specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. 3762 DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` 3763 // 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). <br><br> For more information on Azure planned maintenance, 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) <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. 3764 AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` 3765 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 3766 ProvisioningState *string `json:"provisioningState,omitempty"` 3767 // InstanceView - READ-ONLY; The virtual machine instance view. 3768 InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"` 3769 // 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. <br><br> Possible values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this element is included in a request for an update, the value must match the initial value. This value cannot be updated. <br><br> 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) <br><br> Minimum api-version: 2015-06-15 3770 LicenseType *string `json:"licenseType,omitempty"` 3771 // VMID - READ-ONLY; 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. 3772 VMID *string `json:"vmId,omitempty"` 3773} 3774 3775// MarshalJSON is the custom marshaler for VirtualMachineProperties. 3776func (vmp VirtualMachineProperties) MarshalJSON() ([]byte, error) { 3777 objectMap := make(map[string]interface{}) 3778 if vmp.HardwareProfile != nil { 3779 objectMap["hardwareProfile"] = vmp.HardwareProfile 3780 } 3781 if vmp.StorageProfile != nil { 3782 objectMap["storageProfile"] = vmp.StorageProfile 3783 } 3784 if vmp.OsProfile != nil { 3785 objectMap["osProfile"] = vmp.OsProfile 3786 } 3787 if vmp.NetworkProfile != nil { 3788 objectMap["networkProfile"] = vmp.NetworkProfile 3789 } 3790 if vmp.DiagnosticsProfile != nil { 3791 objectMap["diagnosticsProfile"] = vmp.DiagnosticsProfile 3792 } 3793 if vmp.AvailabilitySet != nil { 3794 objectMap["availabilitySet"] = vmp.AvailabilitySet 3795 } 3796 if vmp.LicenseType != nil { 3797 objectMap["licenseType"] = vmp.LicenseType 3798 } 3799 return json.Marshal(objectMap) 3800} 3801 3802// VirtualMachineScaleSet describes a Virtual Machine Scale Set. 3803type VirtualMachineScaleSet struct { 3804 autorest.Response `json:"-"` 3805 // Sku - The virtual machine scale set sku. 3806 Sku *Sku `json:"sku,omitempty"` 3807 // 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**. 3808 Plan *Plan `json:"plan,omitempty"` 3809 *VirtualMachineScaleSetProperties `json:"properties,omitempty"` 3810 // Identity - The identity of the virtual machine scale set, if configured. 3811 Identity *VirtualMachineScaleSetIdentity `json:"identity,omitempty"` 3812 // ID - READ-ONLY; Resource Id 3813 ID *string `json:"id,omitempty"` 3814 // Name - READ-ONLY; Resource name 3815 Name *string `json:"name,omitempty"` 3816 // Type - READ-ONLY; Resource type 3817 Type *string `json:"type,omitempty"` 3818 // Location - Resource location 3819 Location *string `json:"location,omitempty"` 3820 // Tags - Resource tags 3821 Tags map[string]*string `json:"tags"` 3822} 3823 3824// MarshalJSON is the custom marshaler for VirtualMachineScaleSet. 3825func (vmss VirtualMachineScaleSet) MarshalJSON() ([]byte, error) { 3826 objectMap := make(map[string]interface{}) 3827 if vmss.Sku != nil { 3828 objectMap["sku"] = vmss.Sku 3829 } 3830 if vmss.Plan != nil { 3831 objectMap["plan"] = vmss.Plan 3832 } 3833 if vmss.VirtualMachineScaleSetProperties != nil { 3834 objectMap["properties"] = vmss.VirtualMachineScaleSetProperties 3835 } 3836 if vmss.Identity != nil { 3837 objectMap["identity"] = vmss.Identity 3838 } 3839 if vmss.Location != nil { 3840 objectMap["location"] = vmss.Location 3841 } 3842 if vmss.Tags != nil { 3843 objectMap["tags"] = vmss.Tags 3844 } 3845 return json.Marshal(objectMap) 3846} 3847 3848// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSet struct. 3849func (vmss *VirtualMachineScaleSet) UnmarshalJSON(body []byte) error { 3850 var m map[string]*json.RawMessage 3851 err := json.Unmarshal(body, &m) 3852 if err != nil { 3853 return err 3854 } 3855 for k, v := range m { 3856 switch k { 3857 case "sku": 3858 if v != nil { 3859 var sku Sku 3860 err = json.Unmarshal(*v, &sku) 3861 if err != nil { 3862 return err 3863 } 3864 vmss.Sku = &sku 3865 } 3866 case "plan": 3867 if v != nil { 3868 var plan Plan 3869 err = json.Unmarshal(*v, &plan) 3870 if err != nil { 3871 return err 3872 } 3873 vmss.Plan = &plan 3874 } 3875 case "properties": 3876 if v != nil { 3877 var virtualMachineScaleSetProperties VirtualMachineScaleSetProperties 3878 err = json.Unmarshal(*v, &virtualMachineScaleSetProperties) 3879 if err != nil { 3880 return err 3881 } 3882 vmss.VirtualMachineScaleSetProperties = &virtualMachineScaleSetProperties 3883 } 3884 case "identity": 3885 if v != nil { 3886 var identity VirtualMachineScaleSetIdentity 3887 err = json.Unmarshal(*v, &identity) 3888 if err != nil { 3889 return err 3890 } 3891 vmss.Identity = &identity 3892 } 3893 case "id": 3894 if v != nil { 3895 var ID string 3896 err = json.Unmarshal(*v, &ID) 3897 if err != nil { 3898 return err 3899 } 3900 vmss.ID = &ID 3901 } 3902 case "name": 3903 if v != nil { 3904 var name string 3905 err = json.Unmarshal(*v, &name) 3906 if err != nil { 3907 return err 3908 } 3909 vmss.Name = &name 3910 } 3911 case "type": 3912 if v != nil { 3913 var typeVar string 3914 err = json.Unmarshal(*v, &typeVar) 3915 if err != nil { 3916 return err 3917 } 3918 vmss.Type = &typeVar 3919 } 3920 case "location": 3921 if v != nil { 3922 var location string 3923 err = json.Unmarshal(*v, &location) 3924 if err != nil { 3925 return err 3926 } 3927 vmss.Location = &location 3928 } 3929 case "tags": 3930 if v != nil { 3931 var tags map[string]*string 3932 err = json.Unmarshal(*v, &tags) 3933 if err != nil { 3934 return err 3935 } 3936 vmss.Tags = tags 3937 } 3938 } 3939 } 3940 3941 return nil 3942} 3943 3944// VirtualMachineScaleSetDataDisk describes a virtual machine scale set data disk. 3945type VirtualMachineScaleSetDataDisk struct { 3946 // Name - The disk name. 3947 Name *string `json:"name,omitempty"` 3948 // 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. 3949 Lun *int32 `json:"lun,omitempty"` 3950 // Caching - Specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' 3951 Caching CachingTypes `json:"caching,omitempty"` 3952 // CreateOption - The create option. Possible values include: 'DiskCreateOptionTypesFromImage', 'DiskCreateOptionTypesEmpty', 'DiskCreateOptionTypesAttach' 3953 CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` 3954 // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB 3955 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 3956 // ManagedDisk - The managed disk parameters. 3957 ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` 3958} 3959 3960// VirtualMachineScaleSetExtension describes a Virtual Machine Scale Set Extension. 3961type VirtualMachineScaleSetExtension struct { 3962 // Name - The name of the extension. 3963 Name *string `json:"name,omitempty"` 3964 *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` 3965 // ID - READ-ONLY; Resource Id 3966 ID *string `json:"id,omitempty"` 3967} 3968 3969// MarshalJSON is the custom marshaler for VirtualMachineScaleSetExtension. 3970func (vmsse VirtualMachineScaleSetExtension) MarshalJSON() ([]byte, error) { 3971 objectMap := make(map[string]interface{}) 3972 if vmsse.Name != nil { 3973 objectMap["name"] = vmsse.Name 3974 } 3975 if vmsse.VirtualMachineScaleSetExtensionProperties != nil { 3976 objectMap["properties"] = vmsse.VirtualMachineScaleSetExtensionProperties 3977 } 3978 return json.Marshal(objectMap) 3979} 3980 3981// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetExtension struct. 3982func (vmsse *VirtualMachineScaleSetExtension) UnmarshalJSON(body []byte) error { 3983 var m map[string]*json.RawMessage 3984 err := json.Unmarshal(body, &m) 3985 if err != nil { 3986 return err 3987 } 3988 for k, v := range m { 3989 switch k { 3990 case "name": 3991 if v != nil { 3992 var name string 3993 err = json.Unmarshal(*v, &name) 3994 if err != nil { 3995 return err 3996 } 3997 vmsse.Name = &name 3998 } 3999 case "properties": 4000 if v != nil { 4001 var virtualMachineScaleSetExtensionProperties VirtualMachineScaleSetExtensionProperties 4002 err = json.Unmarshal(*v, &virtualMachineScaleSetExtensionProperties) 4003 if err != nil { 4004 return err 4005 } 4006 vmsse.VirtualMachineScaleSetExtensionProperties = &virtualMachineScaleSetExtensionProperties 4007 } 4008 case "id": 4009 if v != nil { 4010 var ID string 4011 err = json.Unmarshal(*v, &ID) 4012 if err != nil { 4013 return err 4014 } 4015 vmsse.ID = &ID 4016 } 4017 } 4018 } 4019 4020 return nil 4021} 4022 4023// VirtualMachineScaleSetExtensionProfile describes a virtual machine scale set extension profile. 4024type VirtualMachineScaleSetExtensionProfile struct { 4025 // Extensions - The virtual machine scale set child extension resources. 4026 Extensions *[]VirtualMachineScaleSetExtension `json:"extensions,omitempty"` 4027} 4028 4029// VirtualMachineScaleSetExtensionProperties describes the properties of a Virtual Machine Scale Set 4030// Extension. 4031type VirtualMachineScaleSetExtensionProperties struct { 4032 // Publisher - The name of the extension handler publisher. 4033 Publisher *string `json:"publisher,omitempty"` 4034 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 4035 Type *string `json:"type,omitempty"` 4036 // TypeHandlerVersion - Specifies the version of the script handler. 4037 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 4038 // 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. 4039 AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` 4040 // Settings - Json formatted public settings for the extension. 4041 Settings interface{} `json:"settings,omitempty"` 4042 // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. 4043 ProtectedSettings interface{} `json:"protectedSettings,omitempty"` 4044 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 4045 ProvisioningState *string `json:"provisioningState,omitempty"` 4046} 4047 4048// MarshalJSON is the custom marshaler for VirtualMachineScaleSetExtensionProperties. 4049func (vmssep VirtualMachineScaleSetExtensionProperties) MarshalJSON() ([]byte, error) { 4050 objectMap := make(map[string]interface{}) 4051 if vmssep.Publisher != nil { 4052 objectMap["publisher"] = vmssep.Publisher 4053 } 4054 if vmssep.Type != nil { 4055 objectMap["type"] = vmssep.Type 4056 } 4057 if vmssep.TypeHandlerVersion != nil { 4058 objectMap["typeHandlerVersion"] = vmssep.TypeHandlerVersion 4059 } 4060 if vmssep.AutoUpgradeMinorVersion != nil { 4061 objectMap["autoUpgradeMinorVersion"] = vmssep.AutoUpgradeMinorVersion 4062 } 4063 if vmssep.Settings != nil { 4064 objectMap["settings"] = vmssep.Settings 4065 } 4066 if vmssep.ProtectedSettings != nil { 4067 objectMap["protectedSettings"] = vmssep.ProtectedSettings 4068 } 4069 return json.Marshal(objectMap) 4070} 4071 4072// VirtualMachineScaleSetIdentity identity for the virtual machine scale set. 4073type VirtualMachineScaleSetIdentity struct { 4074 // PrincipalID - READ-ONLY; The principal id of virtual machine scale set identity. 4075 PrincipalID *string `json:"principalId,omitempty"` 4076 // TenantID - READ-ONLY; The tenant id associated with the virtual machine scale set. 4077 TenantID *string `json:"tenantId,omitempty"` 4078 // 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' 4079 Type ResourceIdentityType `json:"type,omitempty"` 4080} 4081 4082// MarshalJSON is the custom marshaler for VirtualMachineScaleSetIdentity. 4083func (vmssi VirtualMachineScaleSetIdentity) MarshalJSON() ([]byte, error) { 4084 objectMap := make(map[string]interface{}) 4085 if vmssi.Type != "" { 4086 objectMap["type"] = vmssi.Type 4087 } 4088 return json.Marshal(objectMap) 4089} 4090 4091// VirtualMachineScaleSetInstanceView the instance view of a virtual machine scale set. 4092type VirtualMachineScaleSetInstanceView struct { 4093 autorest.Response `json:"-"` 4094 // VirtualMachine - READ-ONLY; The instance view status summary for the virtual machine scale set. 4095 VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary `json:"virtualMachine,omitempty"` 4096 // Extensions - READ-ONLY; The extensions information. 4097 Extensions *[]VirtualMachineScaleSetVMExtensionsSummary `json:"extensions,omitempty"` 4098 // Statuses - The resource status information. 4099 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 4100} 4101 4102// MarshalJSON is the custom marshaler for VirtualMachineScaleSetInstanceView. 4103func (vmssiv VirtualMachineScaleSetInstanceView) MarshalJSON() ([]byte, error) { 4104 objectMap := make(map[string]interface{}) 4105 if vmssiv.Statuses != nil { 4106 objectMap["statuses"] = vmssiv.Statuses 4107 } 4108 return json.Marshal(objectMap) 4109} 4110 4111// VirtualMachineScaleSetInstanceViewStatusesSummary instance view statuses summary for virtual machines of 4112// a virtual machine scale set. 4113type VirtualMachineScaleSetInstanceViewStatusesSummary struct { 4114 // StatusesSummary - READ-ONLY; The extensions information. 4115 StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` 4116} 4117 4118// MarshalJSON is the custom marshaler for VirtualMachineScaleSetInstanceViewStatusesSummary. 4119func (vmssivss VirtualMachineScaleSetInstanceViewStatusesSummary) MarshalJSON() ([]byte, error) { 4120 objectMap := make(map[string]interface{}) 4121 return json.Marshal(objectMap) 4122} 4123 4124// VirtualMachineScaleSetIPConfiguration describes a virtual machine scale set network profile's IP 4125// configuration. 4126type VirtualMachineScaleSetIPConfiguration struct { 4127 // Name - The IP configuration name. 4128 Name *string `json:"name,omitempty"` 4129 *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` 4130 // ID - Resource Id 4131 ID *string `json:"id,omitempty"` 4132} 4133 4134// MarshalJSON is the custom marshaler for VirtualMachineScaleSetIPConfiguration. 4135func (vmssic VirtualMachineScaleSetIPConfiguration) MarshalJSON() ([]byte, error) { 4136 objectMap := make(map[string]interface{}) 4137 if vmssic.Name != nil { 4138 objectMap["name"] = vmssic.Name 4139 } 4140 if vmssic.VirtualMachineScaleSetIPConfigurationProperties != nil { 4141 objectMap["properties"] = vmssic.VirtualMachineScaleSetIPConfigurationProperties 4142 } 4143 if vmssic.ID != nil { 4144 objectMap["id"] = vmssic.ID 4145 } 4146 return json.Marshal(objectMap) 4147} 4148 4149// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetIPConfiguration struct. 4150func (vmssic *VirtualMachineScaleSetIPConfiguration) UnmarshalJSON(body []byte) error { 4151 var m map[string]*json.RawMessage 4152 err := json.Unmarshal(body, &m) 4153 if err != nil { 4154 return err 4155 } 4156 for k, v := range m { 4157 switch k { 4158 case "name": 4159 if v != nil { 4160 var name string 4161 err = json.Unmarshal(*v, &name) 4162 if err != nil { 4163 return err 4164 } 4165 vmssic.Name = &name 4166 } 4167 case "properties": 4168 if v != nil { 4169 var virtualMachineScaleSetIPConfigurationProperties VirtualMachineScaleSetIPConfigurationProperties 4170 err = json.Unmarshal(*v, &virtualMachineScaleSetIPConfigurationProperties) 4171 if err != nil { 4172 return err 4173 } 4174 vmssic.VirtualMachineScaleSetIPConfigurationProperties = &virtualMachineScaleSetIPConfigurationProperties 4175 } 4176 case "id": 4177 if v != nil { 4178 var ID string 4179 err = json.Unmarshal(*v, &ID) 4180 if err != nil { 4181 return err 4182 } 4183 vmssic.ID = &ID 4184 } 4185 } 4186 } 4187 4188 return nil 4189} 4190 4191// VirtualMachineScaleSetIPConfigurationProperties describes a virtual machine scale set network profile's 4192// IP configuration properties. 4193type VirtualMachineScaleSetIPConfigurationProperties struct { 4194 // Subnet - The subnet. 4195 Subnet *APIEntityReference `json:"subnet,omitempty"` 4196 // ApplicationGatewayBackendAddressPools - The application gateway backend address pools. 4197 ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` 4198 // LoadBalancerBackendAddressPools - The load balancer backend address pools. 4199 LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` 4200 // LoadBalancerInboundNatPools - The load balancer inbound nat pools. 4201 LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` 4202} 4203 4204// VirtualMachineScaleSetListResult the List Virtual Machine operation response. 4205type VirtualMachineScaleSetListResult struct { 4206 autorest.Response `json:"-"` 4207 // Value - The list of virtual machine scale sets. 4208 Value *[]VirtualMachineScaleSet `json:"value,omitempty"` 4209 // NextLink - The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() with this to fetch the next page of VMSS. 4210 NextLink *string `json:"nextLink,omitempty"` 4211} 4212 4213// VirtualMachineScaleSetListResultIterator provides access to a complete listing of VirtualMachineScaleSet 4214// values. 4215type VirtualMachineScaleSetListResultIterator struct { 4216 i int 4217 page VirtualMachineScaleSetListResultPage 4218} 4219 4220// NextWithContext advances to the next value. If there was an error making 4221// the request the iterator does not advance and the error is returned. 4222func (iter *VirtualMachineScaleSetListResultIterator) NextWithContext(ctx context.Context) (err error) { 4223 if tracing.IsEnabled() { 4224 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListResultIterator.NextWithContext") 4225 defer func() { 4226 sc := -1 4227 if iter.Response().Response.Response != nil { 4228 sc = iter.Response().Response.Response.StatusCode 4229 } 4230 tracing.EndSpan(ctx, sc, err) 4231 }() 4232 } 4233 iter.i++ 4234 if iter.i < len(iter.page.Values()) { 4235 return nil 4236 } 4237 err = iter.page.NextWithContext(ctx) 4238 if err != nil { 4239 iter.i-- 4240 return err 4241 } 4242 iter.i = 0 4243 return nil 4244} 4245 4246// Next advances to the next value. If there was an error making 4247// the request the iterator does not advance and the error is returned. 4248// Deprecated: Use NextWithContext() instead. 4249func (iter *VirtualMachineScaleSetListResultIterator) Next() error { 4250 return iter.NextWithContext(context.Background()) 4251} 4252 4253// NotDone returns true if the enumeration should be started or is not yet complete. 4254func (iter VirtualMachineScaleSetListResultIterator) NotDone() bool { 4255 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4256} 4257 4258// Response returns the raw server response from the last page request. 4259func (iter VirtualMachineScaleSetListResultIterator) Response() VirtualMachineScaleSetListResult { 4260 return iter.page.Response() 4261} 4262 4263// Value returns the current value or a zero-initialized value if the 4264// iterator has advanced beyond the end of the collection. 4265func (iter VirtualMachineScaleSetListResultIterator) Value() VirtualMachineScaleSet { 4266 if !iter.page.NotDone() { 4267 return VirtualMachineScaleSet{} 4268 } 4269 return iter.page.Values()[iter.i] 4270} 4271 4272// Creates a new instance of the VirtualMachineScaleSetListResultIterator type. 4273func NewVirtualMachineScaleSetListResultIterator(page VirtualMachineScaleSetListResultPage) VirtualMachineScaleSetListResultIterator { 4274 return VirtualMachineScaleSetListResultIterator{page: page} 4275} 4276 4277// IsEmpty returns true if the ListResult contains no values. 4278func (vmsslr VirtualMachineScaleSetListResult) IsEmpty() bool { 4279 return vmsslr.Value == nil || len(*vmsslr.Value) == 0 4280} 4281 4282// hasNextLink returns true if the NextLink is not empty. 4283func (vmsslr VirtualMachineScaleSetListResult) hasNextLink() bool { 4284 return vmsslr.NextLink != nil && len(*vmsslr.NextLink) != 0 4285} 4286 4287// virtualMachineScaleSetListResultPreparer prepares a request to retrieve the next set of results. 4288// It returns nil if no more results exist. 4289func (vmsslr VirtualMachineScaleSetListResult) virtualMachineScaleSetListResultPreparer(ctx context.Context) (*http.Request, error) { 4290 if !vmsslr.hasNextLink() { 4291 return nil, nil 4292 } 4293 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4294 autorest.AsJSON(), 4295 autorest.AsGet(), 4296 autorest.WithBaseURL(to.String(vmsslr.NextLink))) 4297} 4298 4299// VirtualMachineScaleSetListResultPage contains a page of VirtualMachineScaleSet values. 4300type VirtualMachineScaleSetListResultPage struct { 4301 fn func(context.Context, VirtualMachineScaleSetListResult) (VirtualMachineScaleSetListResult, error) 4302 vmsslr VirtualMachineScaleSetListResult 4303} 4304 4305// NextWithContext advances to the next page of values. If there was an error making 4306// the request the page does not advance and the error is returned. 4307func (page *VirtualMachineScaleSetListResultPage) NextWithContext(ctx context.Context) (err error) { 4308 if tracing.IsEnabled() { 4309 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListResultPage.NextWithContext") 4310 defer func() { 4311 sc := -1 4312 if page.Response().Response.Response != nil { 4313 sc = page.Response().Response.Response.StatusCode 4314 } 4315 tracing.EndSpan(ctx, sc, err) 4316 }() 4317 } 4318 for { 4319 next, err := page.fn(ctx, page.vmsslr) 4320 if err != nil { 4321 return err 4322 } 4323 page.vmsslr = next 4324 if !next.hasNextLink() || !next.IsEmpty() { 4325 break 4326 } 4327 } 4328 return nil 4329} 4330 4331// Next advances to the next page of values. If there was an error making 4332// the request the page does not advance and the error is returned. 4333// Deprecated: Use NextWithContext() instead. 4334func (page *VirtualMachineScaleSetListResultPage) Next() error { 4335 return page.NextWithContext(context.Background()) 4336} 4337 4338// NotDone returns true if the page enumeration should be started or is not yet complete. 4339func (page VirtualMachineScaleSetListResultPage) NotDone() bool { 4340 return !page.vmsslr.IsEmpty() 4341} 4342 4343// Response returns the raw server response from the last page request. 4344func (page VirtualMachineScaleSetListResultPage) Response() VirtualMachineScaleSetListResult { 4345 return page.vmsslr 4346} 4347 4348// Values returns the slice of values for the current page or nil if there are no values. 4349func (page VirtualMachineScaleSetListResultPage) Values() []VirtualMachineScaleSet { 4350 if page.vmsslr.IsEmpty() { 4351 return nil 4352 } 4353 return *page.vmsslr.Value 4354} 4355 4356// Creates a new instance of the VirtualMachineScaleSetListResultPage type. 4357func NewVirtualMachineScaleSetListResultPage(cur VirtualMachineScaleSetListResult, getNextPage func(context.Context, VirtualMachineScaleSetListResult) (VirtualMachineScaleSetListResult, error)) VirtualMachineScaleSetListResultPage { 4358 return VirtualMachineScaleSetListResultPage{ 4359 fn: getNextPage, 4360 vmsslr: cur, 4361 } 4362} 4363 4364// VirtualMachineScaleSetListSkusResult the Virtual Machine Scale Set List Skus operation response. 4365type VirtualMachineScaleSetListSkusResult struct { 4366 autorest.Response `json:"-"` 4367 // Value - The list of skus available for the virtual machine scale set. 4368 Value *[]VirtualMachineScaleSetSku `json:"value,omitempty"` 4369 // 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. 4370 NextLink *string `json:"nextLink,omitempty"` 4371} 4372 4373// VirtualMachineScaleSetListSkusResultIterator provides access to a complete listing of 4374// VirtualMachineScaleSetSku values. 4375type VirtualMachineScaleSetListSkusResultIterator struct { 4376 i int 4377 page VirtualMachineScaleSetListSkusResultPage 4378} 4379 4380// NextWithContext advances to the next value. If there was an error making 4381// the request the iterator does not advance and the error is returned. 4382func (iter *VirtualMachineScaleSetListSkusResultIterator) NextWithContext(ctx context.Context) (err error) { 4383 if tracing.IsEnabled() { 4384 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListSkusResultIterator.NextWithContext") 4385 defer func() { 4386 sc := -1 4387 if iter.Response().Response.Response != nil { 4388 sc = iter.Response().Response.Response.StatusCode 4389 } 4390 tracing.EndSpan(ctx, sc, err) 4391 }() 4392 } 4393 iter.i++ 4394 if iter.i < len(iter.page.Values()) { 4395 return nil 4396 } 4397 err = iter.page.NextWithContext(ctx) 4398 if err != nil { 4399 iter.i-- 4400 return err 4401 } 4402 iter.i = 0 4403 return nil 4404} 4405 4406// Next advances to the next value. If there was an error making 4407// the request the iterator does not advance and the error is returned. 4408// Deprecated: Use NextWithContext() instead. 4409func (iter *VirtualMachineScaleSetListSkusResultIterator) Next() error { 4410 return iter.NextWithContext(context.Background()) 4411} 4412 4413// NotDone returns true if the enumeration should be started or is not yet complete. 4414func (iter VirtualMachineScaleSetListSkusResultIterator) NotDone() bool { 4415 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4416} 4417 4418// Response returns the raw server response from the last page request. 4419func (iter VirtualMachineScaleSetListSkusResultIterator) Response() VirtualMachineScaleSetListSkusResult { 4420 return iter.page.Response() 4421} 4422 4423// Value returns the current value or a zero-initialized value if the 4424// iterator has advanced beyond the end of the collection. 4425func (iter VirtualMachineScaleSetListSkusResultIterator) Value() VirtualMachineScaleSetSku { 4426 if !iter.page.NotDone() { 4427 return VirtualMachineScaleSetSku{} 4428 } 4429 return iter.page.Values()[iter.i] 4430} 4431 4432// Creates a new instance of the VirtualMachineScaleSetListSkusResultIterator type. 4433func NewVirtualMachineScaleSetListSkusResultIterator(page VirtualMachineScaleSetListSkusResultPage) VirtualMachineScaleSetListSkusResultIterator { 4434 return VirtualMachineScaleSetListSkusResultIterator{page: page} 4435} 4436 4437// IsEmpty returns true if the ListResult contains no values. 4438func (vmsslsr VirtualMachineScaleSetListSkusResult) IsEmpty() bool { 4439 return vmsslsr.Value == nil || len(*vmsslsr.Value) == 0 4440} 4441 4442// hasNextLink returns true if the NextLink is not empty. 4443func (vmsslsr VirtualMachineScaleSetListSkusResult) hasNextLink() bool { 4444 return vmsslsr.NextLink != nil && len(*vmsslsr.NextLink) != 0 4445} 4446 4447// virtualMachineScaleSetListSkusResultPreparer prepares a request to retrieve the next set of results. 4448// It returns nil if no more results exist. 4449func (vmsslsr VirtualMachineScaleSetListSkusResult) virtualMachineScaleSetListSkusResultPreparer(ctx context.Context) (*http.Request, error) { 4450 if !vmsslsr.hasNextLink() { 4451 return nil, nil 4452 } 4453 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4454 autorest.AsJSON(), 4455 autorest.AsGet(), 4456 autorest.WithBaseURL(to.String(vmsslsr.NextLink))) 4457} 4458 4459// VirtualMachineScaleSetListSkusResultPage contains a page of VirtualMachineScaleSetSku values. 4460type VirtualMachineScaleSetListSkusResultPage struct { 4461 fn func(context.Context, VirtualMachineScaleSetListSkusResult) (VirtualMachineScaleSetListSkusResult, error) 4462 vmsslsr VirtualMachineScaleSetListSkusResult 4463} 4464 4465// NextWithContext advances to the next page of values. If there was an error making 4466// the request the page does not advance and the error is returned. 4467func (page *VirtualMachineScaleSetListSkusResultPage) NextWithContext(ctx context.Context) (err error) { 4468 if tracing.IsEnabled() { 4469 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListSkusResultPage.NextWithContext") 4470 defer func() { 4471 sc := -1 4472 if page.Response().Response.Response != nil { 4473 sc = page.Response().Response.Response.StatusCode 4474 } 4475 tracing.EndSpan(ctx, sc, err) 4476 }() 4477 } 4478 for { 4479 next, err := page.fn(ctx, page.vmsslsr) 4480 if err != nil { 4481 return err 4482 } 4483 page.vmsslsr = next 4484 if !next.hasNextLink() || !next.IsEmpty() { 4485 break 4486 } 4487 } 4488 return nil 4489} 4490 4491// Next advances to the next page of values. If there was an error making 4492// the request the page does not advance and the error is returned. 4493// Deprecated: Use NextWithContext() instead. 4494func (page *VirtualMachineScaleSetListSkusResultPage) Next() error { 4495 return page.NextWithContext(context.Background()) 4496} 4497 4498// NotDone returns true if the page enumeration should be started or is not yet complete. 4499func (page VirtualMachineScaleSetListSkusResultPage) NotDone() bool { 4500 return !page.vmsslsr.IsEmpty() 4501} 4502 4503// Response returns the raw server response from the last page request. 4504func (page VirtualMachineScaleSetListSkusResultPage) Response() VirtualMachineScaleSetListSkusResult { 4505 return page.vmsslsr 4506} 4507 4508// Values returns the slice of values for the current page or nil if there are no values. 4509func (page VirtualMachineScaleSetListSkusResultPage) Values() []VirtualMachineScaleSetSku { 4510 if page.vmsslsr.IsEmpty() { 4511 return nil 4512 } 4513 return *page.vmsslsr.Value 4514} 4515 4516// Creates a new instance of the VirtualMachineScaleSetListSkusResultPage type. 4517func NewVirtualMachineScaleSetListSkusResultPage(cur VirtualMachineScaleSetListSkusResult, getNextPage func(context.Context, VirtualMachineScaleSetListSkusResult) (VirtualMachineScaleSetListSkusResult, error)) VirtualMachineScaleSetListSkusResultPage { 4518 return VirtualMachineScaleSetListSkusResultPage{ 4519 fn: getNextPage, 4520 vmsslsr: cur, 4521 } 4522} 4523 4524// VirtualMachineScaleSetListWithLinkResult the List Virtual Machine operation response. 4525type VirtualMachineScaleSetListWithLinkResult struct { 4526 autorest.Response `json:"-"` 4527 // Value - The list of virtual machine scale sets. 4528 Value *[]VirtualMachineScaleSet `json:"value,omitempty"` 4529 // 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. 4530 NextLink *string `json:"nextLink,omitempty"` 4531} 4532 4533// VirtualMachineScaleSetListWithLinkResultIterator provides access to a complete listing of 4534// VirtualMachineScaleSet values. 4535type VirtualMachineScaleSetListWithLinkResultIterator struct { 4536 i int 4537 page VirtualMachineScaleSetListWithLinkResultPage 4538} 4539 4540// NextWithContext advances to the next value. If there was an error making 4541// the request the iterator does not advance and the error is returned. 4542func (iter *VirtualMachineScaleSetListWithLinkResultIterator) NextWithContext(ctx context.Context) (err error) { 4543 if tracing.IsEnabled() { 4544 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListWithLinkResultIterator.NextWithContext") 4545 defer func() { 4546 sc := -1 4547 if iter.Response().Response.Response != nil { 4548 sc = iter.Response().Response.Response.StatusCode 4549 } 4550 tracing.EndSpan(ctx, sc, err) 4551 }() 4552 } 4553 iter.i++ 4554 if iter.i < len(iter.page.Values()) { 4555 return nil 4556 } 4557 err = iter.page.NextWithContext(ctx) 4558 if err != nil { 4559 iter.i-- 4560 return err 4561 } 4562 iter.i = 0 4563 return nil 4564} 4565 4566// Next advances to the next value. If there was an error making 4567// the request the iterator does not advance and the error is returned. 4568// Deprecated: Use NextWithContext() instead. 4569func (iter *VirtualMachineScaleSetListWithLinkResultIterator) Next() error { 4570 return iter.NextWithContext(context.Background()) 4571} 4572 4573// NotDone returns true if the enumeration should be started or is not yet complete. 4574func (iter VirtualMachineScaleSetListWithLinkResultIterator) NotDone() bool { 4575 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4576} 4577 4578// Response returns the raw server response from the last page request. 4579func (iter VirtualMachineScaleSetListWithLinkResultIterator) Response() VirtualMachineScaleSetListWithLinkResult { 4580 return iter.page.Response() 4581} 4582 4583// Value returns the current value or a zero-initialized value if the 4584// iterator has advanced beyond the end of the collection. 4585func (iter VirtualMachineScaleSetListWithLinkResultIterator) Value() VirtualMachineScaleSet { 4586 if !iter.page.NotDone() { 4587 return VirtualMachineScaleSet{} 4588 } 4589 return iter.page.Values()[iter.i] 4590} 4591 4592// Creates a new instance of the VirtualMachineScaleSetListWithLinkResultIterator type. 4593func NewVirtualMachineScaleSetListWithLinkResultIterator(page VirtualMachineScaleSetListWithLinkResultPage) VirtualMachineScaleSetListWithLinkResultIterator { 4594 return VirtualMachineScaleSetListWithLinkResultIterator{page: page} 4595} 4596 4597// IsEmpty returns true if the ListResult contains no values. 4598func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) IsEmpty() bool { 4599 return vmsslwlr.Value == nil || len(*vmsslwlr.Value) == 0 4600} 4601 4602// hasNextLink returns true if the NextLink is not empty. 4603func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) hasNextLink() bool { 4604 return vmsslwlr.NextLink != nil && len(*vmsslwlr.NextLink) != 0 4605} 4606 4607// virtualMachineScaleSetListWithLinkResultPreparer prepares a request to retrieve the next set of results. 4608// It returns nil if no more results exist. 4609func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) virtualMachineScaleSetListWithLinkResultPreparer(ctx context.Context) (*http.Request, error) { 4610 if !vmsslwlr.hasNextLink() { 4611 return nil, nil 4612 } 4613 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4614 autorest.AsJSON(), 4615 autorest.AsGet(), 4616 autorest.WithBaseURL(to.String(vmsslwlr.NextLink))) 4617} 4618 4619// VirtualMachineScaleSetListWithLinkResultPage contains a page of VirtualMachineScaleSet values. 4620type VirtualMachineScaleSetListWithLinkResultPage struct { 4621 fn func(context.Context, VirtualMachineScaleSetListWithLinkResult) (VirtualMachineScaleSetListWithLinkResult, error) 4622 vmsslwlr VirtualMachineScaleSetListWithLinkResult 4623} 4624 4625// NextWithContext advances to the next page of values. If there was an error making 4626// the request the page does not advance and the error is returned. 4627func (page *VirtualMachineScaleSetListWithLinkResultPage) NextWithContext(ctx context.Context) (err error) { 4628 if tracing.IsEnabled() { 4629 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListWithLinkResultPage.NextWithContext") 4630 defer func() { 4631 sc := -1 4632 if page.Response().Response.Response != nil { 4633 sc = page.Response().Response.Response.StatusCode 4634 } 4635 tracing.EndSpan(ctx, sc, err) 4636 }() 4637 } 4638 for { 4639 next, err := page.fn(ctx, page.vmsslwlr) 4640 if err != nil { 4641 return err 4642 } 4643 page.vmsslwlr = next 4644 if !next.hasNextLink() || !next.IsEmpty() { 4645 break 4646 } 4647 } 4648 return nil 4649} 4650 4651// Next advances to the next page of values. If there was an error making 4652// the request the page does not advance and the error is returned. 4653// Deprecated: Use NextWithContext() instead. 4654func (page *VirtualMachineScaleSetListWithLinkResultPage) Next() error { 4655 return page.NextWithContext(context.Background()) 4656} 4657 4658// NotDone returns true if the page enumeration should be started or is not yet complete. 4659func (page VirtualMachineScaleSetListWithLinkResultPage) NotDone() bool { 4660 return !page.vmsslwlr.IsEmpty() 4661} 4662 4663// Response returns the raw server response from the last page request. 4664func (page VirtualMachineScaleSetListWithLinkResultPage) Response() VirtualMachineScaleSetListWithLinkResult { 4665 return page.vmsslwlr 4666} 4667 4668// Values returns the slice of values for the current page or nil if there are no values. 4669func (page VirtualMachineScaleSetListWithLinkResultPage) Values() []VirtualMachineScaleSet { 4670 if page.vmsslwlr.IsEmpty() { 4671 return nil 4672 } 4673 return *page.vmsslwlr.Value 4674} 4675 4676// Creates a new instance of the VirtualMachineScaleSetListWithLinkResultPage type. 4677func NewVirtualMachineScaleSetListWithLinkResultPage(cur VirtualMachineScaleSetListWithLinkResult, getNextPage func(context.Context, VirtualMachineScaleSetListWithLinkResult) (VirtualMachineScaleSetListWithLinkResult, error)) VirtualMachineScaleSetListWithLinkResultPage { 4678 return VirtualMachineScaleSetListWithLinkResultPage{ 4679 fn: getNextPage, 4680 vmsslwlr: cur, 4681 } 4682} 4683 4684// VirtualMachineScaleSetManagedDiskParameters describes the parameters of a ScaleSet managed disk. 4685type VirtualMachineScaleSetManagedDiskParameters struct { 4686 // StorageAccountType - Specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'StandardLRS', 'PremiumLRS' 4687 StorageAccountType StorageAccountTypes `json:"storageAccountType,omitempty"` 4688} 4689 4690// VirtualMachineScaleSetNetworkConfiguration describes a virtual machine scale set network profile's 4691// network configurations. 4692type VirtualMachineScaleSetNetworkConfiguration struct { 4693 // Name - The network configuration name. 4694 Name *string `json:"name,omitempty"` 4695 *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` 4696 // ID - Resource Id 4697 ID *string `json:"id,omitempty"` 4698} 4699 4700// MarshalJSON is the custom marshaler for VirtualMachineScaleSetNetworkConfiguration. 4701func (vmssnc VirtualMachineScaleSetNetworkConfiguration) MarshalJSON() ([]byte, error) { 4702 objectMap := make(map[string]interface{}) 4703 if vmssnc.Name != nil { 4704 objectMap["name"] = vmssnc.Name 4705 } 4706 if vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties != nil { 4707 objectMap["properties"] = vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties 4708 } 4709 if vmssnc.ID != nil { 4710 objectMap["id"] = vmssnc.ID 4711 } 4712 return json.Marshal(objectMap) 4713} 4714 4715// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetNetworkConfiguration struct. 4716func (vmssnc *VirtualMachineScaleSetNetworkConfiguration) UnmarshalJSON(body []byte) error { 4717 var m map[string]*json.RawMessage 4718 err := json.Unmarshal(body, &m) 4719 if err != nil { 4720 return err 4721 } 4722 for k, v := range m { 4723 switch k { 4724 case "name": 4725 if v != nil { 4726 var name string 4727 err = json.Unmarshal(*v, &name) 4728 if err != nil { 4729 return err 4730 } 4731 vmssnc.Name = &name 4732 } 4733 case "properties": 4734 if v != nil { 4735 var virtualMachineScaleSetNetworkConfigurationProperties VirtualMachineScaleSetNetworkConfigurationProperties 4736 err = json.Unmarshal(*v, &virtualMachineScaleSetNetworkConfigurationProperties) 4737 if err != nil { 4738 return err 4739 } 4740 vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties = &virtualMachineScaleSetNetworkConfigurationProperties 4741 } 4742 case "id": 4743 if v != nil { 4744 var ID string 4745 err = json.Unmarshal(*v, &ID) 4746 if err != nil { 4747 return err 4748 } 4749 vmssnc.ID = &ID 4750 } 4751 } 4752 } 4753 4754 return nil 4755} 4756 4757// VirtualMachineScaleSetNetworkConfigurationProperties describes a virtual machine scale set network 4758// profile's IP configuration. 4759type VirtualMachineScaleSetNetworkConfigurationProperties struct { 4760 // Primary - Whether this is a primary NIC on a virtual machine. 4761 Primary *bool `json:"primary,omitempty"` 4762 // IPConfigurations - The virtual machine scale set IP Configuration. 4763 IPConfigurations *[]VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations,omitempty"` 4764} 4765 4766// VirtualMachineScaleSetNetworkProfile describes a virtual machine scale set network profile. 4767type VirtualMachineScaleSetNetworkProfile struct { 4768 // NetworkInterfaceConfigurations - The list of network configurations. 4769 NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` 4770} 4771 4772// VirtualMachineScaleSetOSDisk describes a virtual machine scale set operating system disk. 4773type VirtualMachineScaleSetOSDisk struct { 4774 // Name - The disk name. 4775 Name *string `json:"name,omitempty"` 4776 // Caching - Specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'CachingTypesNone', 'CachingTypesReadOnly', 'CachingTypesReadWrite' 4777 Caching CachingTypes `json:"caching,omitempty"` 4778 // CreateOption - Specifies how the virtual machines in the scale set should be created.<br><br> 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' 4779 CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` 4780 // 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. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. Possible values include: 'Windows', 'Linux' 4781 OsType OperatingSystemTypes `json:"osType,omitempty"` 4782 // 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. 4783 Image *VirtualHardDisk `json:"image,omitempty"` 4784 // VhdContainers - The list of virtual hard disk container uris. 4785 VhdContainers *[]string `json:"vhdContainers,omitempty"` 4786 // ManagedDisk - The managed disk parameters. 4787 ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` 4788} 4789 4790// VirtualMachineScaleSetOSProfile describes a virtual machine scale set OS profile. 4791type VirtualMachineScaleSetOSProfile struct { 4792 // 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. 4793 ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"` 4794 // AdminUsername - Specifies the name of the administrator account. <br><br> **Windows-only restriction:** Cannot end in "." <br><br> **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". <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters <br><br><li> 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)<br><li> 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) 4795 AdminUsername *string `json:"adminUsername,omitempty"` 4796 // AdminPassword - Specifies the password of the administrator account. <br><br> **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> 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) <br><br> 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) 4797 AdminPassword *string `json:"adminPassword,omitempty"` 4798 // CustomData - A base-64 encoded string of custom data. 4799 CustomData *string `json:"customData,omitempty"` 4800 // WindowsConfiguration - The Windows Configuration of the OS profile. 4801 WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` 4802 // LinuxConfiguration - The Linux Configuration of the OS profile. 4803 LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` 4804 // Secrets - The List of certificates for addition to the VM. 4805 Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` 4806} 4807 4808// VirtualMachineScaleSetProperties describes the properties of a Virtual Machine Scale Set. 4809type VirtualMachineScaleSetProperties struct { 4810 // UpgradePolicy - The upgrade policy. 4811 UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` 4812 // VirtualMachineProfile - The virtual machine profile. 4813 VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` 4814 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 4815 ProvisioningState *string `json:"provisioningState,omitempty"` 4816 // OverProvision - Specifies whether the Virtual Machine Scale Set should be overprovisioned. 4817 OverProvision *bool `json:"overProvision,omitempty"` 4818 // SinglePlacementGroup - When true this limits the scale set to a single placement group, of max size 100 virtual machines. 4819 SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` 4820} 4821 4822// MarshalJSON is the custom marshaler for VirtualMachineScaleSetProperties. 4823func (vmssp VirtualMachineScaleSetProperties) MarshalJSON() ([]byte, error) { 4824 objectMap := make(map[string]interface{}) 4825 if vmssp.UpgradePolicy != nil { 4826 objectMap["upgradePolicy"] = vmssp.UpgradePolicy 4827 } 4828 if vmssp.VirtualMachineProfile != nil { 4829 objectMap["virtualMachineProfile"] = vmssp.VirtualMachineProfile 4830 } 4831 if vmssp.OverProvision != nil { 4832 objectMap["overProvision"] = vmssp.OverProvision 4833 } 4834 if vmssp.SinglePlacementGroup != nil { 4835 objectMap["singlePlacementGroup"] = vmssp.SinglePlacementGroup 4836 } 4837 return json.Marshal(objectMap) 4838} 4839 4840// VirtualMachineScaleSetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of 4841// a long-running operation. 4842type VirtualMachineScaleSetsCreateOrUpdateFuture struct { 4843 azure.FutureAPI 4844 // Result returns the result of the asynchronous operation. 4845 // If the operation has not completed it will return an error. 4846 Result func(VirtualMachineScaleSetsClient) (VirtualMachineScaleSet, error) 4847} 4848 4849// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4850func (future *VirtualMachineScaleSetsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 4851 var azFuture azure.Future 4852 if err := json.Unmarshal(body, &azFuture); err != nil { 4853 return err 4854 } 4855 future.FutureAPI = &azFuture 4856 future.Result = future.result 4857 return nil 4858} 4859 4860// result is the default implementation for VirtualMachineScaleSetsCreateOrUpdateFuture.Result. 4861func (future *VirtualMachineScaleSetsCreateOrUpdateFuture) result(client VirtualMachineScaleSetsClient) (vmss VirtualMachineScaleSet, err error) { 4862 var done bool 4863 done, err = future.DoneWithContext(context.Background(), client) 4864 if err != nil { 4865 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 4866 return 4867 } 4868 if !done { 4869 vmss.Response.Response = future.Response() 4870 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsCreateOrUpdateFuture") 4871 return 4872 } 4873 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4874 if vmss.Response.Response, err = future.GetResult(sender); err == nil && vmss.Response.Response.StatusCode != http.StatusNoContent { 4875 vmss, err = client.CreateOrUpdateResponder(vmss.Response.Response) 4876 if err != nil { 4877 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", vmss.Response.Response, "Failure responding to request") 4878 } 4879 } 4880 return 4881} 4882 4883// VirtualMachineScaleSetsDeallocateFuture an abstraction for monitoring and retrieving the results of a 4884// long-running operation. 4885type VirtualMachineScaleSetsDeallocateFuture struct { 4886 azure.FutureAPI 4887 // Result returns the result of the asynchronous operation. 4888 // If the operation has not completed it will return an error. 4889 Result func(VirtualMachineScaleSetsClient) (OperationStatusResponse, error) 4890} 4891 4892// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4893func (future *VirtualMachineScaleSetsDeallocateFuture) UnmarshalJSON(body []byte) error { 4894 var azFuture azure.Future 4895 if err := json.Unmarshal(body, &azFuture); err != nil { 4896 return err 4897 } 4898 future.FutureAPI = &azFuture 4899 future.Result = future.result 4900 return nil 4901} 4902 4903// result is the default implementation for VirtualMachineScaleSetsDeallocateFuture.Result. 4904func (future *VirtualMachineScaleSetsDeallocateFuture) result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 4905 var done bool 4906 done, err = future.DoneWithContext(context.Background(), client) 4907 if err != nil { 4908 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", future.Response(), "Polling failure") 4909 return 4910 } 4911 if !done { 4912 osr.Response.Response = future.Response() 4913 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeallocateFuture") 4914 return 4915 } 4916 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4917 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 4918 osr, err = client.DeallocateResponder(osr.Response.Response) 4919 if err != nil { 4920 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", osr.Response.Response, "Failure responding to request") 4921 } 4922 } 4923 return 4924} 4925 4926// VirtualMachineScaleSetsDeleteFuture an abstraction for monitoring and retrieving the results of a 4927// long-running operation. 4928type VirtualMachineScaleSetsDeleteFuture struct { 4929 azure.FutureAPI 4930 // Result returns the result of the asynchronous operation. 4931 // If the operation has not completed it will return an error. 4932 Result func(VirtualMachineScaleSetsClient) (OperationStatusResponse, error) 4933} 4934 4935// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4936func (future *VirtualMachineScaleSetsDeleteFuture) UnmarshalJSON(body []byte) error { 4937 var azFuture azure.Future 4938 if err := json.Unmarshal(body, &azFuture); err != nil { 4939 return err 4940 } 4941 future.FutureAPI = &azFuture 4942 future.Result = future.result 4943 return nil 4944} 4945 4946// result is the default implementation for VirtualMachineScaleSetsDeleteFuture.Result. 4947func (future *VirtualMachineScaleSetsDeleteFuture) result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 4948 var done bool 4949 done, err = future.DoneWithContext(context.Background(), client) 4950 if err != nil { 4951 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", future.Response(), "Polling failure") 4952 return 4953 } 4954 if !done { 4955 osr.Response.Response = future.Response() 4956 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteFuture") 4957 return 4958 } 4959 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4960 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 4961 osr, err = client.DeleteResponder(osr.Response.Response) 4962 if err != nil { 4963 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") 4964 } 4965 } 4966 return 4967} 4968 4969// VirtualMachineScaleSetsDeleteInstancesFuture an abstraction for monitoring and retrieving the results of 4970// a long-running operation. 4971type VirtualMachineScaleSetsDeleteInstancesFuture struct { 4972 azure.FutureAPI 4973 // Result returns the result of the asynchronous operation. 4974 // If the operation has not completed it will return an error. 4975 Result func(VirtualMachineScaleSetsClient) (OperationStatusResponse, error) 4976} 4977 4978// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4979func (future *VirtualMachineScaleSetsDeleteInstancesFuture) UnmarshalJSON(body []byte) error { 4980 var azFuture azure.Future 4981 if err := json.Unmarshal(body, &azFuture); err != nil { 4982 return err 4983 } 4984 future.FutureAPI = &azFuture 4985 future.Result = future.result 4986 return nil 4987} 4988 4989// result is the default implementation for VirtualMachineScaleSetsDeleteInstancesFuture.Result. 4990func (future *VirtualMachineScaleSetsDeleteInstancesFuture) result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 4991 var done bool 4992 done, err = future.DoneWithContext(context.Background(), client) 4993 if err != nil { 4994 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", future.Response(), "Polling failure") 4995 return 4996 } 4997 if !done { 4998 osr.Response.Response = future.Response() 4999 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteInstancesFuture") 5000 return 5001 } 5002 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5003 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5004 osr, err = client.DeleteInstancesResponder(osr.Response.Response) 5005 if err != nil { 5006 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", osr.Response.Response, "Failure responding to request") 5007 } 5008 } 5009 return 5010} 5011 5012// VirtualMachineScaleSetSku describes an available virtual machine scale set sku. 5013type VirtualMachineScaleSetSku struct { 5014 // ResourceType - READ-ONLY; The type of resource the sku applies to. 5015 ResourceType *string `json:"resourceType,omitempty"` 5016 // Sku - READ-ONLY; The Sku. 5017 Sku *Sku `json:"sku,omitempty"` 5018 // Capacity - READ-ONLY; Specifies the number of virtual machines in the scale set. 5019 Capacity *VirtualMachineScaleSetSkuCapacity `json:"capacity,omitempty"` 5020} 5021 5022// MarshalJSON is the custom marshaler for VirtualMachineScaleSetSku. 5023func (vmsss VirtualMachineScaleSetSku) MarshalJSON() ([]byte, error) { 5024 objectMap := make(map[string]interface{}) 5025 return json.Marshal(objectMap) 5026} 5027 5028// VirtualMachineScaleSetSkuCapacity describes scaling information of a sku. 5029type VirtualMachineScaleSetSkuCapacity struct { 5030 // Minimum - READ-ONLY; The minimum capacity. 5031 Minimum *int64 `json:"minimum,omitempty"` 5032 // Maximum - READ-ONLY; The maximum capacity that can be set. 5033 Maximum *int64 `json:"maximum,omitempty"` 5034 // DefaultCapacity - READ-ONLY; The default capacity. 5035 DefaultCapacity *int64 `json:"defaultCapacity,omitempty"` 5036 // ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'VirtualMachineScaleSetSkuScaleTypeAutomatic', 'VirtualMachineScaleSetSkuScaleTypeNone' 5037 ScaleType VirtualMachineScaleSetSkuScaleType `json:"scaleType,omitempty"` 5038} 5039 5040// MarshalJSON is the custom marshaler for VirtualMachineScaleSetSkuCapacity. 5041func (vmsssc VirtualMachineScaleSetSkuCapacity) MarshalJSON() ([]byte, error) { 5042 objectMap := make(map[string]interface{}) 5043 return json.Marshal(objectMap) 5044} 5045 5046// VirtualMachineScaleSetsPowerOffFuture an abstraction for monitoring and retrieving the results of a 5047// long-running operation. 5048type VirtualMachineScaleSetsPowerOffFuture struct { 5049 azure.FutureAPI 5050 // Result returns the result of the asynchronous operation. 5051 // If the operation has not completed it will return an error. 5052 Result func(VirtualMachineScaleSetsClient) (OperationStatusResponse, error) 5053} 5054 5055// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5056func (future *VirtualMachineScaleSetsPowerOffFuture) UnmarshalJSON(body []byte) error { 5057 var azFuture azure.Future 5058 if err := json.Unmarshal(body, &azFuture); err != nil { 5059 return err 5060 } 5061 future.FutureAPI = &azFuture 5062 future.Result = future.result 5063 return nil 5064} 5065 5066// result is the default implementation for VirtualMachineScaleSetsPowerOffFuture.Result. 5067func (future *VirtualMachineScaleSetsPowerOffFuture) result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 5068 var done bool 5069 done, err = future.DoneWithContext(context.Background(), client) 5070 if err != nil { 5071 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", future.Response(), "Polling failure") 5072 return 5073 } 5074 if !done { 5075 osr.Response.Response = future.Response() 5076 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsPowerOffFuture") 5077 return 5078 } 5079 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5080 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5081 osr, err = client.PowerOffResponder(osr.Response.Response) 5082 if err != nil { 5083 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", osr.Response.Response, "Failure responding to request") 5084 } 5085 } 5086 return 5087} 5088 5089// VirtualMachineScaleSetsReimageAllFuture an abstraction for monitoring and retrieving the results of a 5090// long-running operation. 5091type VirtualMachineScaleSetsReimageAllFuture struct { 5092 azure.FutureAPI 5093 // Result returns the result of the asynchronous operation. 5094 // If the operation has not completed it will return an error. 5095 Result func(VirtualMachineScaleSetsClient) (OperationStatusResponse, error) 5096} 5097 5098// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5099func (future *VirtualMachineScaleSetsReimageAllFuture) UnmarshalJSON(body []byte) error { 5100 var azFuture azure.Future 5101 if err := json.Unmarshal(body, &azFuture); err != nil { 5102 return err 5103 } 5104 future.FutureAPI = &azFuture 5105 future.Result = future.result 5106 return nil 5107} 5108 5109// result is the default implementation for VirtualMachineScaleSetsReimageAllFuture.Result. 5110func (future *VirtualMachineScaleSetsReimageAllFuture) result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 5111 var done bool 5112 done, err = future.DoneWithContext(context.Background(), client) 5113 if err != nil { 5114 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", future.Response(), "Polling failure") 5115 return 5116 } 5117 if !done { 5118 osr.Response.Response = future.Response() 5119 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageAllFuture") 5120 return 5121 } 5122 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5123 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5124 osr, err = client.ReimageAllResponder(osr.Response.Response) 5125 if err != nil { 5126 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageAllFuture", "Result", osr.Response.Response, "Failure responding to request") 5127 } 5128 } 5129 return 5130} 5131 5132// VirtualMachineScaleSetsReimageFuture an abstraction for monitoring and retrieving the results of a 5133// long-running operation. 5134type VirtualMachineScaleSetsReimageFuture struct { 5135 azure.FutureAPI 5136 // Result returns the result of the asynchronous operation. 5137 // If the operation has not completed it will return an error. 5138 Result func(VirtualMachineScaleSetsClient) (OperationStatusResponse, error) 5139} 5140 5141// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5142func (future *VirtualMachineScaleSetsReimageFuture) UnmarshalJSON(body []byte) error { 5143 var azFuture azure.Future 5144 if err := json.Unmarshal(body, &azFuture); err != nil { 5145 return err 5146 } 5147 future.FutureAPI = &azFuture 5148 future.Result = future.result 5149 return nil 5150} 5151 5152// result is the default implementation for VirtualMachineScaleSetsReimageFuture.Result. 5153func (future *VirtualMachineScaleSetsReimageFuture) result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 5154 var done bool 5155 done, err = future.DoneWithContext(context.Background(), client) 5156 if err != nil { 5157 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", future.Response(), "Polling failure") 5158 return 5159 } 5160 if !done { 5161 osr.Response.Response = future.Response() 5162 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageFuture") 5163 return 5164 } 5165 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5166 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5167 osr, err = client.ReimageResponder(osr.Response.Response) 5168 if err != nil { 5169 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", osr.Response.Response, "Failure responding to request") 5170 } 5171 } 5172 return 5173} 5174 5175// VirtualMachineScaleSetsRestartFuture an abstraction for monitoring and retrieving the results of a 5176// long-running operation. 5177type VirtualMachineScaleSetsRestartFuture struct { 5178 azure.FutureAPI 5179 // Result returns the result of the asynchronous operation. 5180 // If the operation has not completed it will return an error. 5181 Result func(VirtualMachineScaleSetsClient) (OperationStatusResponse, error) 5182} 5183 5184// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5185func (future *VirtualMachineScaleSetsRestartFuture) UnmarshalJSON(body []byte) error { 5186 var azFuture azure.Future 5187 if err := json.Unmarshal(body, &azFuture); err != nil { 5188 return err 5189 } 5190 future.FutureAPI = &azFuture 5191 future.Result = future.result 5192 return nil 5193} 5194 5195// result is the default implementation for VirtualMachineScaleSetsRestartFuture.Result. 5196func (future *VirtualMachineScaleSetsRestartFuture) result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 5197 var done bool 5198 done, err = future.DoneWithContext(context.Background(), client) 5199 if err != nil { 5200 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", future.Response(), "Polling failure") 5201 return 5202 } 5203 if !done { 5204 osr.Response.Response = future.Response() 5205 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsRestartFuture") 5206 return 5207 } 5208 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5209 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5210 osr, err = client.RestartResponder(osr.Response.Response) 5211 if err != nil { 5212 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", osr.Response.Response, "Failure responding to request") 5213 } 5214 } 5215 return 5216} 5217 5218// VirtualMachineScaleSetsStartFuture an abstraction for monitoring and retrieving the results of a 5219// long-running operation. 5220type VirtualMachineScaleSetsStartFuture struct { 5221 azure.FutureAPI 5222 // Result returns the result of the asynchronous operation. 5223 // If the operation has not completed it will return an error. 5224 Result func(VirtualMachineScaleSetsClient) (OperationStatusResponse, error) 5225} 5226 5227// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5228func (future *VirtualMachineScaleSetsStartFuture) UnmarshalJSON(body []byte) error { 5229 var azFuture azure.Future 5230 if err := json.Unmarshal(body, &azFuture); err != nil { 5231 return err 5232 } 5233 future.FutureAPI = &azFuture 5234 future.Result = future.result 5235 return nil 5236} 5237 5238// result is the default implementation for VirtualMachineScaleSetsStartFuture.Result. 5239func (future *VirtualMachineScaleSetsStartFuture) result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 5240 var done bool 5241 done, err = future.DoneWithContext(context.Background(), client) 5242 if err != nil { 5243 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", future.Response(), "Polling failure") 5244 return 5245 } 5246 if !done { 5247 osr.Response.Response = future.Response() 5248 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsStartFuture") 5249 return 5250 } 5251 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5252 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5253 osr, err = client.StartResponder(osr.Response.Response) 5254 if err != nil { 5255 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", osr.Response.Response, "Failure responding to request") 5256 } 5257 } 5258 return 5259} 5260 5261// VirtualMachineScaleSetStorageProfile describes a virtual machine scale set storage profile. 5262type VirtualMachineScaleSetStorageProfile struct { 5263 // ImageReference - The image reference. 5264 ImageReference *ImageReference `json:"imageReference,omitempty"` 5265 // OsDisk - The OS disk. 5266 OsDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"` 5267 // DataDisks - The data disks. 5268 DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` 5269} 5270 5271// VirtualMachineScaleSetsUpdateInstancesFuture an abstraction for monitoring and retrieving the results of 5272// a long-running operation. 5273type VirtualMachineScaleSetsUpdateInstancesFuture struct { 5274 azure.FutureAPI 5275 // Result returns the result of the asynchronous operation. 5276 // If the operation has not completed it will return an error. 5277 Result func(VirtualMachineScaleSetsClient) (OperationStatusResponse, error) 5278} 5279 5280// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5281func (future *VirtualMachineScaleSetsUpdateInstancesFuture) UnmarshalJSON(body []byte) error { 5282 var azFuture azure.Future 5283 if err := json.Unmarshal(body, &azFuture); err != nil { 5284 return err 5285 } 5286 future.FutureAPI = &azFuture 5287 future.Result = future.result 5288 return nil 5289} 5290 5291// result is the default implementation for VirtualMachineScaleSetsUpdateInstancesFuture.Result. 5292func (future *VirtualMachineScaleSetsUpdateInstancesFuture) result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 5293 var done bool 5294 done, err = future.DoneWithContext(context.Background(), client) 5295 if err != nil { 5296 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", future.Response(), "Polling failure") 5297 return 5298 } 5299 if !done { 5300 osr.Response.Response = future.Response() 5301 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsUpdateInstancesFuture") 5302 return 5303 } 5304 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5305 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5306 osr, err = client.UpdateInstancesResponder(osr.Response.Response) 5307 if err != nil { 5308 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", osr.Response.Response, "Failure responding to request") 5309 } 5310 } 5311 return 5312} 5313 5314// VirtualMachineScaleSetVM describes a virtual machine scale set virtual machine. 5315type VirtualMachineScaleSetVM struct { 5316 autorest.Response `json:"-"` 5317 // InstanceID - READ-ONLY; The virtual machine instance ID. 5318 InstanceID *string `json:"instanceId,omitempty"` 5319 // Sku - READ-ONLY; The virtual machine SKU. 5320 Sku *Sku `json:"sku,omitempty"` 5321 *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"` 5322 // 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**. 5323 Plan *Plan `json:"plan,omitempty"` 5324 // Resources - READ-ONLY; The virtual machine child extension resources. 5325 Resources *[]VirtualMachineExtension `json:"resources,omitempty"` 5326 // ID - READ-ONLY; Resource Id 5327 ID *string `json:"id,omitempty"` 5328 // Name - READ-ONLY; Resource name 5329 Name *string `json:"name,omitempty"` 5330 // Type - READ-ONLY; Resource type 5331 Type *string `json:"type,omitempty"` 5332 // Location - Resource location 5333 Location *string `json:"location,omitempty"` 5334 // Tags - Resource tags 5335 Tags map[string]*string `json:"tags"` 5336} 5337 5338// MarshalJSON is the custom marshaler for VirtualMachineScaleSetVM. 5339func (vmssv VirtualMachineScaleSetVM) MarshalJSON() ([]byte, error) { 5340 objectMap := make(map[string]interface{}) 5341 if vmssv.VirtualMachineScaleSetVMProperties != nil { 5342 objectMap["properties"] = vmssv.VirtualMachineScaleSetVMProperties 5343 } 5344 if vmssv.Plan != nil { 5345 objectMap["plan"] = vmssv.Plan 5346 } 5347 if vmssv.Location != nil { 5348 objectMap["location"] = vmssv.Location 5349 } 5350 if vmssv.Tags != nil { 5351 objectMap["tags"] = vmssv.Tags 5352 } 5353 return json.Marshal(objectMap) 5354} 5355 5356// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetVM struct. 5357func (vmssv *VirtualMachineScaleSetVM) UnmarshalJSON(body []byte) error { 5358 var m map[string]*json.RawMessage 5359 err := json.Unmarshal(body, &m) 5360 if err != nil { 5361 return err 5362 } 5363 for k, v := range m { 5364 switch k { 5365 case "instanceId": 5366 if v != nil { 5367 var instanceID string 5368 err = json.Unmarshal(*v, &instanceID) 5369 if err != nil { 5370 return err 5371 } 5372 vmssv.InstanceID = &instanceID 5373 } 5374 case "sku": 5375 if v != nil { 5376 var sku Sku 5377 err = json.Unmarshal(*v, &sku) 5378 if err != nil { 5379 return err 5380 } 5381 vmssv.Sku = &sku 5382 } 5383 case "properties": 5384 if v != nil { 5385 var virtualMachineScaleSetVMProperties VirtualMachineScaleSetVMProperties 5386 err = json.Unmarshal(*v, &virtualMachineScaleSetVMProperties) 5387 if err != nil { 5388 return err 5389 } 5390 vmssv.VirtualMachineScaleSetVMProperties = &virtualMachineScaleSetVMProperties 5391 } 5392 case "plan": 5393 if v != nil { 5394 var plan Plan 5395 err = json.Unmarshal(*v, &plan) 5396 if err != nil { 5397 return err 5398 } 5399 vmssv.Plan = &plan 5400 } 5401 case "resources": 5402 if v != nil { 5403 var resources []VirtualMachineExtension 5404 err = json.Unmarshal(*v, &resources) 5405 if err != nil { 5406 return err 5407 } 5408 vmssv.Resources = &resources 5409 } 5410 case "id": 5411 if v != nil { 5412 var ID string 5413 err = json.Unmarshal(*v, &ID) 5414 if err != nil { 5415 return err 5416 } 5417 vmssv.ID = &ID 5418 } 5419 case "name": 5420 if v != nil { 5421 var name string 5422 err = json.Unmarshal(*v, &name) 5423 if err != nil { 5424 return err 5425 } 5426 vmssv.Name = &name 5427 } 5428 case "type": 5429 if v != nil { 5430 var typeVar string 5431 err = json.Unmarshal(*v, &typeVar) 5432 if err != nil { 5433 return err 5434 } 5435 vmssv.Type = &typeVar 5436 } 5437 case "location": 5438 if v != nil { 5439 var location string 5440 err = json.Unmarshal(*v, &location) 5441 if err != nil { 5442 return err 5443 } 5444 vmssv.Location = &location 5445 } 5446 case "tags": 5447 if v != nil { 5448 var tags map[string]*string 5449 err = json.Unmarshal(*v, &tags) 5450 if err != nil { 5451 return err 5452 } 5453 vmssv.Tags = tags 5454 } 5455 } 5456 } 5457 5458 return nil 5459} 5460 5461// VirtualMachineScaleSetVMExtensionsSummary extensions summary for virtual machines of a virtual machine 5462// scale set. 5463type VirtualMachineScaleSetVMExtensionsSummary struct { 5464 // Name - READ-ONLY; The extension name. 5465 Name *string `json:"name,omitempty"` 5466 // StatusesSummary - READ-ONLY; The extensions information. 5467 StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` 5468} 5469 5470// MarshalJSON is the custom marshaler for VirtualMachineScaleSetVMExtensionsSummary. 5471func (vmssves VirtualMachineScaleSetVMExtensionsSummary) MarshalJSON() ([]byte, error) { 5472 objectMap := make(map[string]interface{}) 5473 return json.Marshal(objectMap) 5474} 5475 5476// VirtualMachineScaleSetVMInstanceIDs specifies a list of virtual machine instance IDs from the VM scale 5477// set. 5478type VirtualMachineScaleSetVMInstanceIDs struct { 5479 // 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. 5480 InstanceIds *[]string `json:"instanceIds,omitempty"` 5481} 5482 5483// VirtualMachineScaleSetVMInstanceRequiredIDs specifies a list of virtual machine instance IDs from the VM 5484// scale set. 5485type VirtualMachineScaleSetVMInstanceRequiredIDs struct { 5486 // InstanceIds - The virtual machine scale set instance ids. 5487 InstanceIds *[]string `json:"instanceIds,omitempty"` 5488} 5489 5490// VirtualMachineScaleSetVMInstanceView the instance view of a virtual machine scale set VM. 5491type VirtualMachineScaleSetVMInstanceView struct { 5492 autorest.Response `json:"-"` 5493 // PlatformUpdateDomain - The Update Domain count. 5494 PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` 5495 // PlatformFaultDomain - The Fault Domain count. 5496 PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` 5497 // RdpThumbPrint - The Remote desktop certificate thumbprint. 5498 RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` 5499 // VMAgent - The VM Agent running on the virtual machine. 5500 VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` 5501 // Disks - The disks information. 5502 Disks *[]DiskInstanceView `json:"disks,omitempty"` 5503 // Extensions - The extensions information. 5504 Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` 5505 // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. 5506 BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` 5507 // Statuses - The resource status information. 5508 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 5509 // PlacementGroupID - The placement group in which the VM is running. If the VM is deallocated it will not have a placementGroupId. 5510 PlacementGroupID *string `json:"placementGroupId,omitempty"` 5511} 5512 5513// VirtualMachineScaleSetVMListResult the List Virtual Machine Scale Set VMs operation response. 5514type VirtualMachineScaleSetVMListResult struct { 5515 autorest.Response `json:"-"` 5516 // Value - The list of virtual machine scale sets VMs. 5517 Value *[]VirtualMachineScaleSetVM `json:"value,omitempty"` 5518 // 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 5519 NextLink *string `json:"nextLink,omitempty"` 5520} 5521 5522// VirtualMachineScaleSetVMListResultIterator provides access to a complete listing of 5523// VirtualMachineScaleSetVM values. 5524type VirtualMachineScaleSetVMListResultIterator struct { 5525 i int 5526 page VirtualMachineScaleSetVMListResultPage 5527} 5528 5529// NextWithContext advances to the next value. If there was an error making 5530// the request the iterator does not advance and the error is returned. 5531func (iter *VirtualMachineScaleSetVMListResultIterator) NextWithContext(ctx context.Context) (err error) { 5532 if tracing.IsEnabled() { 5533 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMListResultIterator.NextWithContext") 5534 defer func() { 5535 sc := -1 5536 if iter.Response().Response.Response != nil { 5537 sc = iter.Response().Response.Response.StatusCode 5538 } 5539 tracing.EndSpan(ctx, sc, err) 5540 }() 5541 } 5542 iter.i++ 5543 if iter.i < len(iter.page.Values()) { 5544 return nil 5545 } 5546 err = iter.page.NextWithContext(ctx) 5547 if err != nil { 5548 iter.i-- 5549 return err 5550 } 5551 iter.i = 0 5552 return nil 5553} 5554 5555// Next advances to the next value. If there was an error making 5556// the request the iterator does not advance and the error is returned. 5557// Deprecated: Use NextWithContext() instead. 5558func (iter *VirtualMachineScaleSetVMListResultIterator) Next() error { 5559 return iter.NextWithContext(context.Background()) 5560} 5561 5562// NotDone returns true if the enumeration should be started or is not yet complete. 5563func (iter VirtualMachineScaleSetVMListResultIterator) NotDone() bool { 5564 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5565} 5566 5567// Response returns the raw server response from the last page request. 5568func (iter VirtualMachineScaleSetVMListResultIterator) Response() VirtualMachineScaleSetVMListResult { 5569 return iter.page.Response() 5570} 5571 5572// Value returns the current value or a zero-initialized value if the 5573// iterator has advanced beyond the end of the collection. 5574func (iter VirtualMachineScaleSetVMListResultIterator) Value() VirtualMachineScaleSetVM { 5575 if !iter.page.NotDone() { 5576 return VirtualMachineScaleSetVM{} 5577 } 5578 return iter.page.Values()[iter.i] 5579} 5580 5581// Creates a new instance of the VirtualMachineScaleSetVMListResultIterator type. 5582func NewVirtualMachineScaleSetVMListResultIterator(page VirtualMachineScaleSetVMListResultPage) VirtualMachineScaleSetVMListResultIterator { 5583 return VirtualMachineScaleSetVMListResultIterator{page: page} 5584} 5585 5586// IsEmpty returns true if the ListResult contains no values. 5587func (vmssvlr VirtualMachineScaleSetVMListResult) IsEmpty() bool { 5588 return vmssvlr.Value == nil || len(*vmssvlr.Value) == 0 5589} 5590 5591// hasNextLink returns true if the NextLink is not empty. 5592func (vmssvlr VirtualMachineScaleSetVMListResult) hasNextLink() bool { 5593 return vmssvlr.NextLink != nil && len(*vmssvlr.NextLink) != 0 5594} 5595 5596// virtualMachineScaleSetVMListResultPreparer prepares a request to retrieve the next set of results. 5597// It returns nil if no more results exist. 5598func (vmssvlr VirtualMachineScaleSetVMListResult) virtualMachineScaleSetVMListResultPreparer(ctx context.Context) (*http.Request, error) { 5599 if !vmssvlr.hasNextLink() { 5600 return nil, nil 5601 } 5602 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5603 autorest.AsJSON(), 5604 autorest.AsGet(), 5605 autorest.WithBaseURL(to.String(vmssvlr.NextLink))) 5606} 5607 5608// VirtualMachineScaleSetVMListResultPage contains a page of VirtualMachineScaleSetVM values. 5609type VirtualMachineScaleSetVMListResultPage struct { 5610 fn func(context.Context, VirtualMachineScaleSetVMListResult) (VirtualMachineScaleSetVMListResult, error) 5611 vmssvlr VirtualMachineScaleSetVMListResult 5612} 5613 5614// NextWithContext advances to the next page of values. If there was an error making 5615// the request the page does not advance and the error is returned. 5616func (page *VirtualMachineScaleSetVMListResultPage) NextWithContext(ctx context.Context) (err error) { 5617 if tracing.IsEnabled() { 5618 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMListResultPage.NextWithContext") 5619 defer func() { 5620 sc := -1 5621 if page.Response().Response.Response != nil { 5622 sc = page.Response().Response.Response.StatusCode 5623 } 5624 tracing.EndSpan(ctx, sc, err) 5625 }() 5626 } 5627 for { 5628 next, err := page.fn(ctx, page.vmssvlr) 5629 if err != nil { 5630 return err 5631 } 5632 page.vmssvlr = next 5633 if !next.hasNextLink() || !next.IsEmpty() { 5634 break 5635 } 5636 } 5637 return nil 5638} 5639 5640// Next advances to the next page of values. If there was an error making 5641// the request the page does not advance and the error is returned. 5642// Deprecated: Use NextWithContext() instead. 5643func (page *VirtualMachineScaleSetVMListResultPage) Next() error { 5644 return page.NextWithContext(context.Background()) 5645} 5646 5647// NotDone returns true if the page enumeration should be started or is not yet complete. 5648func (page VirtualMachineScaleSetVMListResultPage) NotDone() bool { 5649 return !page.vmssvlr.IsEmpty() 5650} 5651 5652// Response returns the raw server response from the last page request. 5653func (page VirtualMachineScaleSetVMListResultPage) Response() VirtualMachineScaleSetVMListResult { 5654 return page.vmssvlr 5655} 5656 5657// Values returns the slice of values for the current page or nil if there are no values. 5658func (page VirtualMachineScaleSetVMListResultPage) Values() []VirtualMachineScaleSetVM { 5659 if page.vmssvlr.IsEmpty() { 5660 return nil 5661 } 5662 return *page.vmssvlr.Value 5663} 5664 5665// Creates a new instance of the VirtualMachineScaleSetVMListResultPage type. 5666func NewVirtualMachineScaleSetVMListResultPage(cur VirtualMachineScaleSetVMListResult, getNextPage func(context.Context, VirtualMachineScaleSetVMListResult) (VirtualMachineScaleSetVMListResult, error)) VirtualMachineScaleSetVMListResultPage { 5667 return VirtualMachineScaleSetVMListResultPage{ 5668 fn: getNextPage, 5669 vmssvlr: cur, 5670 } 5671} 5672 5673// VirtualMachineScaleSetVMProfile describes a virtual machine scale set virtual machine profile. 5674type VirtualMachineScaleSetVMProfile struct { 5675 // OsProfile - The virtual machine scale set OS profile. 5676 OsProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"` 5677 // StorageProfile - The virtual machine scale set storage profile. 5678 StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"` 5679 // NetworkProfile - The virtual machine scale set network profile. 5680 NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"` 5681 // ExtensionProfile - The virtual machine scale set extension profile. 5682 ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` 5683} 5684 5685// VirtualMachineScaleSetVMProperties describes the properties of a virtual machine scale set virtual 5686// machine. 5687type VirtualMachineScaleSetVMProperties struct { 5688 // LatestModelApplied - READ-ONLY; Specifies whether the latest model has been applied to the virtual machine. 5689 LatestModelApplied *bool `json:"latestModelApplied,omitempty"` 5690 // VMID - READ-ONLY; Azure VM unique ID. 5691 VMID *string `json:"vmId,omitempty"` 5692 // InstanceView - READ-ONLY; The virtual machine instance view. 5693 InstanceView *VirtualMachineScaleSetVMInstanceView `json:"instanceView,omitempty"` 5694 // HardwareProfile - Specifies the hardware settings for the virtual machine. 5695 HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` 5696 // StorageProfile - Specifies the storage settings for the virtual machine disks. 5697 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 5698 // OsProfile - Specifies the operating system settings for the virtual machine. 5699 OsProfile *OSProfile `json:"osProfile,omitempty"` 5700 // NetworkProfile - Specifies the network interfaces of the virtual machine. 5701 NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` 5702 // DiagnosticsProfile - Specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. 5703 DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` 5704 // 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). <br><br> For more information on Azure planned maintenance, 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) <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. 5705 AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` 5706 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 5707 ProvisioningState *string `json:"provisioningState,omitempty"` 5708 // 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. <br><br> Possible values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this element is included in a request for an update, the value must match the initial value. This value cannot be updated. <br><br> 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) <br><br> Minimum api-version: 2015-06-15 5709 LicenseType *string `json:"licenseType,omitempty"` 5710} 5711 5712// MarshalJSON is the custom marshaler for VirtualMachineScaleSetVMProperties. 5713func (vmssvp VirtualMachineScaleSetVMProperties) MarshalJSON() ([]byte, error) { 5714 objectMap := make(map[string]interface{}) 5715 if vmssvp.HardwareProfile != nil { 5716 objectMap["hardwareProfile"] = vmssvp.HardwareProfile 5717 } 5718 if vmssvp.StorageProfile != nil { 5719 objectMap["storageProfile"] = vmssvp.StorageProfile 5720 } 5721 if vmssvp.OsProfile != nil { 5722 objectMap["osProfile"] = vmssvp.OsProfile 5723 } 5724 if vmssvp.NetworkProfile != nil { 5725 objectMap["networkProfile"] = vmssvp.NetworkProfile 5726 } 5727 if vmssvp.DiagnosticsProfile != nil { 5728 objectMap["diagnosticsProfile"] = vmssvp.DiagnosticsProfile 5729 } 5730 if vmssvp.AvailabilitySet != nil { 5731 objectMap["availabilitySet"] = vmssvp.AvailabilitySet 5732 } 5733 if vmssvp.LicenseType != nil { 5734 objectMap["licenseType"] = vmssvp.LicenseType 5735 } 5736 return json.Marshal(objectMap) 5737} 5738 5739// VirtualMachineScaleSetVMsDeallocateFuture an abstraction for monitoring and retrieving the results of a 5740// long-running operation. 5741type VirtualMachineScaleSetVMsDeallocateFuture struct { 5742 azure.FutureAPI 5743 // Result returns the result of the asynchronous operation. 5744 // If the operation has not completed it will return an error. 5745 Result func(VirtualMachineScaleSetVMsClient) (OperationStatusResponse, error) 5746} 5747 5748// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5749func (future *VirtualMachineScaleSetVMsDeallocateFuture) UnmarshalJSON(body []byte) error { 5750 var azFuture azure.Future 5751 if err := json.Unmarshal(body, &azFuture); err != nil { 5752 return err 5753 } 5754 future.FutureAPI = &azFuture 5755 future.Result = future.result 5756 return nil 5757} 5758 5759// result is the default implementation for VirtualMachineScaleSetVMsDeallocateFuture.Result. 5760func (future *VirtualMachineScaleSetVMsDeallocateFuture) result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 5761 var done bool 5762 done, err = future.DoneWithContext(context.Background(), client) 5763 if err != nil { 5764 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", future.Response(), "Polling failure") 5765 return 5766 } 5767 if !done { 5768 osr.Response.Response = future.Response() 5769 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeallocateFuture") 5770 return 5771 } 5772 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5773 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5774 osr, err = client.DeallocateResponder(osr.Response.Response) 5775 if err != nil { 5776 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", osr.Response.Response, "Failure responding to request") 5777 } 5778 } 5779 return 5780} 5781 5782// VirtualMachineScaleSetVMsDeleteFuture an abstraction for monitoring and retrieving the results of a 5783// long-running operation. 5784type VirtualMachineScaleSetVMsDeleteFuture struct { 5785 azure.FutureAPI 5786 // Result returns the result of the asynchronous operation. 5787 // If the operation has not completed it will return an error. 5788 Result func(VirtualMachineScaleSetVMsClient) (OperationStatusResponse, error) 5789} 5790 5791// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5792func (future *VirtualMachineScaleSetVMsDeleteFuture) UnmarshalJSON(body []byte) error { 5793 var azFuture azure.Future 5794 if err := json.Unmarshal(body, &azFuture); err != nil { 5795 return err 5796 } 5797 future.FutureAPI = &azFuture 5798 future.Result = future.result 5799 return nil 5800} 5801 5802// result is the default implementation for VirtualMachineScaleSetVMsDeleteFuture.Result. 5803func (future *VirtualMachineScaleSetVMsDeleteFuture) result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 5804 var done bool 5805 done, err = future.DoneWithContext(context.Background(), client) 5806 if err != nil { 5807 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", future.Response(), "Polling failure") 5808 return 5809 } 5810 if !done { 5811 osr.Response.Response = future.Response() 5812 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeleteFuture") 5813 return 5814 } 5815 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5816 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5817 osr, err = client.DeleteResponder(osr.Response.Response) 5818 if err != nil { 5819 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") 5820 } 5821 } 5822 return 5823} 5824 5825// VirtualMachineScaleSetVMsPowerOffFuture an abstraction for monitoring and retrieving the results of a 5826// long-running operation. 5827type VirtualMachineScaleSetVMsPowerOffFuture struct { 5828 azure.FutureAPI 5829 // Result returns the result of the asynchronous operation. 5830 // If the operation has not completed it will return an error. 5831 Result func(VirtualMachineScaleSetVMsClient) (OperationStatusResponse, error) 5832} 5833 5834// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5835func (future *VirtualMachineScaleSetVMsPowerOffFuture) UnmarshalJSON(body []byte) error { 5836 var azFuture azure.Future 5837 if err := json.Unmarshal(body, &azFuture); err != nil { 5838 return err 5839 } 5840 future.FutureAPI = &azFuture 5841 future.Result = future.result 5842 return nil 5843} 5844 5845// result is the default implementation for VirtualMachineScaleSetVMsPowerOffFuture.Result. 5846func (future *VirtualMachineScaleSetVMsPowerOffFuture) result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 5847 var done bool 5848 done, err = future.DoneWithContext(context.Background(), client) 5849 if err != nil { 5850 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", future.Response(), "Polling failure") 5851 return 5852 } 5853 if !done { 5854 osr.Response.Response = future.Response() 5855 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsPowerOffFuture") 5856 return 5857 } 5858 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5859 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5860 osr, err = client.PowerOffResponder(osr.Response.Response) 5861 if err != nil { 5862 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", osr.Response.Response, "Failure responding to request") 5863 } 5864 } 5865 return 5866} 5867 5868// VirtualMachineScaleSetVMsReimageAllFuture an abstraction for monitoring and retrieving the results of a 5869// long-running operation. 5870type VirtualMachineScaleSetVMsReimageAllFuture struct { 5871 azure.FutureAPI 5872 // Result returns the result of the asynchronous operation. 5873 // If the operation has not completed it will return an error. 5874 Result func(VirtualMachineScaleSetVMsClient) (OperationStatusResponse, error) 5875} 5876 5877// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5878func (future *VirtualMachineScaleSetVMsReimageAllFuture) UnmarshalJSON(body []byte) error { 5879 var azFuture azure.Future 5880 if err := json.Unmarshal(body, &azFuture); err != nil { 5881 return err 5882 } 5883 future.FutureAPI = &azFuture 5884 future.Result = future.result 5885 return nil 5886} 5887 5888// result is the default implementation for VirtualMachineScaleSetVMsReimageAllFuture.Result. 5889func (future *VirtualMachineScaleSetVMsReimageAllFuture) result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 5890 var done bool 5891 done, err = future.DoneWithContext(context.Background(), client) 5892 if err != nil { 5893 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", future.Response(), "Polling failure") 5894 return 5895 } 5896 if !done { 5897 osr.Response.Response = future.Response() 5898 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageAllFuture") 5899 return 5900 } 5901 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5902 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5903 osr, err = client.ReimageAllResponder(osr.Response.Response) 5904 if err != nil { 5905 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageAllFuture", "Result", osr.Response.Response, "Failure responding to request") 5906 } 5907 } 5908 return 5909} 5910 5911// VirtualMachineScaleSetVMsReimageFuture an abstraction for monitoring and retrieving the results of a 5912// long-running operation. 5913type VirtualMachineScaleSetVMsReimageFuture struct { 5914 azure.FutureAPI 5915 // Result returns the result of the asynchronous operation. 5916 // If the operation has not completed it will return an error. 5917 Result func(VirtualMachineScaleSetVMsClient) (OperationStatusResponse, error) 5918} 5919 5920// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5921func (future *VirtualMachineScaleSetVMsReimageFuture) UnmarshalJSON(body []byte) error { 5922 var azFuture azure.Future 5923 if err := json.Unmarshal(body, &azFuture); err != nil { 5924 return err 5925 } 5926 future.FutureAPI = &azFuture 5927 future.Result = future.result 5928 return nil 5929} 5930 5931// result is the default implementation for VirtualMachineScaleSetVMsReimageFuture.Result. 5932func (future *VirtualMachineScaleSetVMsReimageFuture) result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 5933 var done bool 5934 done, err = future.DoneWithContext(context.Background(), client) 5935 if err != nil { 5936 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", future.Response(), "Polling failure") 5937 return 5938 } 5939 if !done { 5940 osr.Response.Response = future.Response() 5941 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageFuture") 5942 return 5943 } 5944 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5945 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5946 osr, err = client.ReimageResponder(osr.Response.Response) 5947 if err != nil { 5948 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", osr.Response.Response, "Failure responding to request") 5949 } 5950 } 5951 return 5952} 5953 5954// VirtualMachineScaleSetVMsRestartFuture an abstraction for monitoring and retrieving the results of a 5955// long-running operation. 5956type VirtualMachineScaleSetVMsRestartFuture struct { 5957 azure.FutureAPI 5958 // Result returns the result of the asynchronous operation. 5959 // If the operation has not completed it will return an error. 5960 Result func(VirtualMachineScaleSetVMsClient) (OperationStatusResponse, error) 5961} 5962 5963// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5964func (future *VirtualMachineScaleSetVMsRestartFuture) UnmarshalJSON(body []byte) error { 5965 var azFuture azure.Future 5966 if err := json.Unmarshal(body, &azFuture); err != nil { 5967 return err 5968 } 5969 future.FutureAPI = &azFuture 5970 future.Result = future.result 5971 return nil 5972} 5973 5974// result is the default implementation for VirtualMachineScaleSetVMsRestartFuture.Result. 5975func (future *VirtualMachineScaleSetVMsRestartFuture) result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 5976 var done bool 5977 done, err = future.DoneWithContext(context.Background(), client) 5978 if err != nil { 5979 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", future.Response(), "Polling failure") 5980 return 5981 } 5982 if !done { 5983 osr.Response.Response = future.Response() 5984 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRestartFuture") 5985 return 5986 } 5987 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5988 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 5989 osr, err = client.RestartResponder(osr.Response.Response) 5990 if err != nil { 5991 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", osr.Response.Response, "Failure responding to request") 5992 } 5993 } 5994 return 5995} 5996 5997// VirtualMachineScaleSetVMsStartFuture an abstraction for monitoring and retrieving the results of a 5998// long-running operation. 5999type VirtualMachineScaleSetVMsStartFuture struct { 6000 azure.FutureAPI 6001 // Result returns the result of the asynchronous operation. 6002 // If the operation has not completed it will return an error. 6003 Result func(VirtualMachineScaleSetVMsClient) (OperationStatusResponse, error) 6004} 6005 6006// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6007func (future *VirtualMachineScaleSetVMsStartFuture) UnmarshalJSON(body []byte) error { 6008 var azFuture azure.Future 6009 if err := json.Unmarshal(body, &azFuture); err != nil { 6010 return err 6011 } 6012 future.FutureAPI = &azFuture 6013 future.Result = future.result 6014 return nil 6015} 6016 6017// result is the default implementation for VirtualMachineScaleSetVMsStartFuture.Result. 6018func (future *VirtualMachineScaleSetVMsStartFuture) result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 6019 var done bool 6020 done, err = future.DoneWithContext(context.Background(), client) 6021 if err != nil { 6022 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", future.Response(), "Polling failure") 6023 return 6024 } 6025 if !done { 6026 osr.Response.Response = future.Response() 6027 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsStartFuture") 6028 return 6029 } 6030 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6031 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 6032 osr, err = client.StartResponder(osr.Response.Response) 6033 if err != nil { 6034 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", osr.Response.Response, "Failure responding to request") 6035 } 6036 } 6037 return 6038} 6039 6040// VirtualMachinesCaptureFuture an abstraction for monitoring and retrieving the results of a long-running 6041// operation. 6042type VirtualMachinesCaptureFuture struct { 6043 azure.FutureAPI 6044 // Result returns the result of the asynchronous operation. 6045 // If the operation has not completed it will return an error. 6046 Result func(VirtualMachinesClient) (VirtualMachineCaptureResult, error) 6047} 6048 6049// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6050func (future *VirtualMachinesCaptureFuture) UnmarshalJSON(body []byte) error { 6051 var azFuture azure.Future 6052 if err := json.Unmarshal(body, &azFuture); err != nil { 6053 return err 6054 } 6055 future.FutureAPI = &azFuture 6056 future.Result = future.result 6057 return nil 6058} 6059 6060// result is the default implementation for VirtualMachinesCaptureFuture.Result. 6061func (future *VirtualMachinesCaptureFuture) result(client VirtualMachinesClient) (vmcr VirtualMachineCaptureResult, err error) { 6062 var done bool 6063 done, err = future.DoneWithContext(context.Background(), client) 6064 if err != nil { 6065 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", future.Response(), "Polling failure") 6066 return 6067 } 6068 if !done { 6069 vmcr.Response.Response = future.Response() 6070 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCaptureFuture") 6071 return 6072 } 6073 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6074 if vmcr.Response.Response, err = future.GetResult(sender); err == nil && vmcr.Response.Response.StatusCode != http.StatusNoContent { 6075 vmcr, err = client.CaptureResponder(vmcr.Response.Response) 6076 if err != nil { 6077 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", vmcr.Response.Response, "Failure responding to request") 6078 } 6079 } 6080 return 6081} 6082 6083// VirtualMachinesConvertToManagedDisksFuture an abstraction for monitoring and retrieving the results of a 6084// long-running operation. 6085type VirtualMachinesConvertToManagedDisksFuture struct { 6086 azure.FutureAPI 6087 // Result returns the result of the asynchronous operation. 6088 // If the operation has not completed it will return an error. 6089 Result func(VirtualMachinesClient) (OperationStatusResponse, error) 6090} 6091 6092// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6093func (future *VirtualMachinesConvertToManagedDisksFuture) UnmarshalJSON(body []byte) error { 6094 var azFuture azure.Future 6095 if err := json.Unmarshal(body, &azFuture); err != nil { 6096 return err 6097 } 6098 future.FutureAPI = &azFuture 6099 future.Result = future.result 6100 return nil 6101} 6102 6103// result is the default implementation for VirtualMachinesConvertToManagedDisksFuture.Result. 6104func (future *VirtualMachinesConvertToManagedDisksFuture) result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 6105 var done bool 6106 done, err = future.DoneWithContext(context.Background(), client) 6107 if err != nil { 6108 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", future.Response(), "Polling failure") 6109 return 6110 } 6111 if !done { 6112 osr.Response.Response = future.Response() 6113 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesConvertToManagedDisksFuture") 6114 return 6115 } 6116 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6117 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 6118 osr, err = client.ConvertToManagedDisksResponder(osr.Response.Response) 6119 if err != nil { 6120 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesConvertToManagedDisksFuture", "Result", osr.Response.Response, "Failure responding to request") 6121 } 6122 } 6123 return 6124} 6125 6126// VirtualMachinesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 6127// long-running operation. 6128type VirtualMachinesCreateOrUpdateFuture struct { 6129 azure.FutureAPI 6130 // Result returns the result of the asynchronous operation. 6131 // If the operation has not completed it will return an error. 6132 Result func(VirtualMachinesClient) (VirtualMachine, error) 6133} 6134 6135// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6136func (future *VirtualMachinesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 6137 var azFuture azure.Future 6138 if err := json.Unmarshal(body, &azFuture); err != nil { 6139 return err 6140 } 6141 future.FutureAPI = &azFuture 6142 future.Result = future.result 6143 return nil 6144} 6145 6146// result is the default implementation for VirtualMachinesCreateOrUpdateFuture.Result. 6147func (future *VirtualMachinesCreateOrUpdateFuture) result(client VirtualMachinesClient) (VM VirtualMachine, err error) { 6148 var done bool 6149 done, err = future.DoneWithContext(context.Background(), client) 6150 if err != nil { 6151 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 6152 return 6153 } 6154 if !done { 6155 VM.Response.Response = future.Response() 6156 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCreateOrUpdateFuture") 6157 return 6158 } 6159 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6160 if VM.Response.Response, err = future.GetResult(sender); err == nil && VM.Response.Response.StatusCode != http.StatusNoContent { 6161 VM, err = client.CreateOrUpdateResponder(VM.Response.Response) 6162 if err != nil { 6163 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") 6164 } 6165 } 6166 return 6167} 6168 6169// VirtualMachinesDeallocateFuture an abstraction for monitoring and retrieving the results of a 6170// long-running operation. 6171type VirtualMachinesDeallocateFuture struct { 6172 azure.FutureAPI 6173 // Result returns the result of the asynchronous operation. 6174 // If the operation has not completed it will return an error. 6175 Result func(VirtualMachinesClient) (OperationStatusResponse, error) 6176} 6177 6178// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6179func (future *VirtualMachinesDeallocateFuture) UnmarshalJSON(body []byte) error { 6180 var azFuture azure.Future 6181 if err := json.Unmarshal(body, &azFuture); err != nil { 6182 return err 6183 } 6184 future.FutureAPI = &azFuture 6185 future.Result = future.result 6186 return nil 6187} 6188 6189// result is the default implementation for VirtualMachinesDeallocateFuture.Result. 6190func (future *VirtualMachinesDeallocateFuture) result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 6191 var done bool 6192 done, err = future.DoneWithContext(context.Background(), client) 6193 if err != nil { 6194 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", future.Response(), "Polling failure") 6195 return 6196 } 6197 if !done { 6198 osr.Response.Response = future.Response() 6199 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeallocateFuture") 6200 return 6201 } 6202 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6203 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 6204 osr, err = client.DeallocateResponder(osr.Response.Response) 6205 if err != nil { 6206 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", osr.Response.Response, "Failure responding to request") 6207 } 6208 } 6209 return 6210} 6211 6212// VirtualMachinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 6213// operation. 6214type VirtualMachinesDeleteFuture struct { 6215 azure.FutureAPI 6216 // Result returns the result of the asynchronous operation. 6217 // If the operation has not completed it will return an error. 6218 Result func(VirtualMachinesClient) (OperationStatusResponse, error) 6219} 6220 6221// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6222func (future *VirtualMachinesDeleteFuture) UnmarshalJSON(body []byte) error { 6223 var azFuture azure.Future 6224 if err := json.Unmarshal(body, &azFuture); err != nil { 6225 return err 6226 } 6227 future.FutureAPI = &azFuture 6228 future.Result = future.result 6229 return nil 6230} 6231 6232// result is the default implementation for VirtualMachinesDeleteFuture.Result. 6233func (future *VirtualMachinesDeleteFuture) result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 6234 var done bool 6235 done, err = future.DoneWithContext(context.Background(), client) 6236 if err != nil { 6237 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", future.Response(), "Polling failure") 6238 return 6239 } 6240 if !done { 6241 osr.Response.Response = future.Response() 6242 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeleteFuture") 6243 return 6244 } 6245 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6246 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 6247 osr, err = client.DeleteResponder(osr.Response.Response) 6248 if err != nil { 6249 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") 6250 } 6251 } 6252 return 6253} 6254 6255// VirtualMachineSize describes the properties of a VM size. 6256type VirtualMachineSize struct { 6257 // Name - The name of the virtual machine size. 6258 Name *string `json:"name,omitempty"` 6259 // NumberOfCores - The number of cores supported by the virtual machine size. 6260 NumberOfCores *int32 `json:"numberOfCores,omitempty"` 6261 // OsDiskSizeInMB - The OS disk size, in MB, allowed by the virtual machine size. 6262 OsDiskSizeInMB *int32 `json:"osDiskSizeInMB,omitempty"` 6263 // ResourceDiskSizeInMB - The resource disk size, in MB, allowed by the virtual machine size. 6264 ResourceDiskSizeInMB *int32 `json:"resourceDiskSizeInMB,omitempty"` 6265 // MemoryInMB - The amount of memory, in MB, supported by the virtual machine size. 6266 MemoryInMB *int32 `json:"memoryInMB,omitempty"` 6267 // MaxDataDiskCount - The maximum number of data disks that can be attached to the virtual machine size. 6268 MaxDataDiskCount *int32 `json:"maxDataDiskCount,omitempty"` 6269} 6270 6271// VirtualMachineSizeListResult the List Virtual Machine operation response. 6272type VirtualMachineSizeListResult struct { 6273 autorest.Response `json:"-"` 6274 // Value - The list of virtual machine sizes. 6275 Value *[]VirtualMachineSize `json:"value,omitempty"` 6276} 6277 6278// VirtualMachinesPowerOffFuture an abstraction for monitoring and retrieving the results of a long-running 6279// operation. 6280type VirtualMachinesPowerOffFuture struct { 6281 azure.FutureAPI 6282 // Result returns the result of the asynchronous operation. 6283 // If the operation has not completed it will return an error. 6284 Result func(VirtualMachinesClient) (OperationStatusResponse, error) 6285} 6286 6287// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6288func (future *VirtualMachinesPowerOffFuture) UnmarshalJSON(body []byte) error { 6289 var azFuture azure.Future 6290 if err := json.Unmarshal(body, &azFuture); err != nil { 6291 return err 6292 } 6293 future.FutureAPI = &azFuture 6294 future.Result = future.result 6295 return nil 6296} 6297 6298// result is the default implementation for VirtualMachinesPowerOffFuture.Result. 6299func (future *VirtualMachinesPowerOffFuture) result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 6300 var done bool 6301 done, err = future.DoneWithContext(context.Background(), client) 6302 if err != nil { 6303 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", future.Response(), "Polling failure") 6304 return 6305 } 6306 if !done { 6307 osr.Response.Response = future.Response() 6308 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesPowerOffFuture") 6309 return 6310 } 6311 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6312 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 6313 osr, err = client.PowerOffResponder(osr.Response.Response) 6314 if err != nil { 6315 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", osr.Response.Response, "Failure responding to request") 6316 } 6317 } 6318 return 6319} 6320 6321// VirtualMachinesRedeployFuture an abstraction for monitoring and retrieving the results of a long-running 6322// operation. 6323type VirtualMachinesRedeployFuture struct { 6324 azure.FutureAPI 6325 // Result returns the result of the asynchronous operation. 6326 // If the operation has not completed it will return an error. 6327 Result func(VirtualMachinesClient) (OperationStatusResponse, error) 6328} 6329 6330// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6331func (future *VirtualMachinesRedeployFuture) UnmarshalJSON(body []byte) error { 6332 var azFuture azure.Future 6333 if err := json.Unmarshal(body, &azFuture); err != nil { 6334 return err 6335 } 6336 future.FutureAPI = &azFuture 6337 future.Result = future.result 6338 return nil 6339} 6340 6341// result is the default implementation for VirtualMachinesRedeployFuture.Result. 6342func (future *VirtualMachinesRedeployFuture) result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 6343 var done bool 6344 done, err = future.DoneWithContext(context.Background(), client) 6345 if err != nil { 6346 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", future.Response(), "Polling failure") 6347 return 6348 } 6349 if !done { 6350 osr.Response.Response = future.Response() 6351 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRedeployFuture") 6352 return 6353 } 6354 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6355 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 6356 osr, err = client.RedeployResponder(osr.Response.Response) 6357 if err != nil { 6358 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", osr.Response.Response, "Failure responding to request") 6359 } 6360 } 6361 return 6362} 6363 6364// VirtualMachinesRestartFuture an abstraction for monitoring and retrieving the results of a long-running 6365// operation. 6366type VirtualMachinesRestartFuture struct { 6367 azure.FutureAPI 6368 // Result returns the result of the asynchronous operation. 6369 // If the operation has not completed it will return an error. 6370 Result func(VirtualMachinesClient) (OperationStatusResponse, error) 6371} 6372 6373// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6374func (future *VirtualMachinesRestartFuture) UnmarshalJSON(body []byte) error { 6375 var azFuture azure.Future 6376 if err := json.Unmarshal(body, &azFuture); err != nil { 6377 return err 6378 } 6379 future.FutureAPI = &azFuture 6380 future.Result = future.result 6381 return nil 6382} 6383 6384// result is the default implementation for VirtualMachinesRestartFuture.Result. 6385func (future *VirtualMachinesRestartFuture) result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 6386 var done bool 6387 done, err = future.DoneWithContext(context.Background(), client) 6388 if err != nil { 6389 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", future.Response(), "Polling failure") 6390 return 6391 } 6392 if !done { 6393 osr.Response.Response = future.Response() 6394 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRestartFuture") 6395 return 6396 } 6397 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6398 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 6399 osr, err = client.RestartResponder(osr.Response.Response) 6400 if err != nil { 6401 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", osr.Response.Response, "Failure responding to request") 6402 } 6403 } 6404 return 6405} 6406 6407// VirtualMachinesStartFuture an abstraction for monitoring and retrieving the results of a long-running 6408// operation. 6409type VirtualMachinesStartFuture struct { 6410 azure.FutureAPI 6411 // Result returns the result of the asynchronous operation. 6412 // If the operation has not completed it will return an error. 6413 Result func(VirtualMachinesClient) (OperationStatusResponse, error) 6414} 6415 6416// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6417func (future *VirtualMachinesStartFuture) UnmarshalJSON(body []byte) error { 6418 var azFuture azure.Future 6419 if err := json.Unmarshal(body, &azFuture); err != nil { 6420 return err 6421 } 6422 future.FutureAPI = &azFuture 6423 future.Result = future.result 6424 return nil 6425} 6426 6427// result is the default implementation for VirtualMachinesStartFuture.Result. 6428func (future *VirtualMachinesStartFuture) result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 6429 var done bool 6430 done, err = future.DoneWithContext(context.Background(), client) 6431 if err != nil { 6432 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", future.Response(), "Polling failure") 6433 return 6434 } 6435 if !done { 6436 osr.Response.Response = future.Response() 6437 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesStartFuture") 6438 return 6439 } 6440 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6441 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 6442 osr, err = client.StartResponder(osr.Response.Response) 6443 if err != nil { 6444 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", osr.Response.Response, "Failure responding to request") 6445 } 6446 } 6447 return 6448} 6449 6450// VirtualMachineStatusCodeCount the status code and count of the virtual machine scale set instance view 6451// status summary. 6452type VirtualMachineStatusCodeCount struct { 6453 // Code - READ-ONLY; The instance view status code. 6454 Code *string `json:"code,omitempty"` 6455 // Count - READ-ONLY; The number of instances having a particular status code. 6456 Count *int32 `json:"count,omitempty"` 6457} 6458 6459// MarshalJSON is the custom marshaler for VirtualMachineStatusCodeCount. 6460func (vmscc VirtualMachineStatusCodeCount) MarshalJSON() ([]byte, error) { 6461 objectMap := make(map[string]interface{}) 6462 return json.Marshal(objectMap) 6463} 6464 6465// WindowsConfiguration specifies Windows operating system settings on the virtual machine. 6466type WindowsConfiguration struct { 6467 // ProvisionVMAgent - Indicates whether virtual machine agent should be provisioned on the virtual machine. <br><br> 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. 6468 ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` 6469 // EnableAutomaticUpdates - Indicates whether virtual machine is enabled for automatic updates. 6470 EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` 6471 // TimeZone - Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time" 6472 TimeZone *string `json:"timeZone,omitempty"` 6473 // AdditionalUnattendContent - Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. 6474 AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` 6475 // WinRM - Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. 6476 WinRM *WinRMConfiguration `json:"winRM,omitempty"` 6477} 6478 6479// WinRMConfiguration describes Windows Remote Management configuration of the VM 6480type WinRMConfiguration struct { 6481 // Listeners - The list of Windows Remote Management listeners 6482 Listeners *[]WinRMListener `json:"listeners,omitempty"` 6483} 6484 6485// WinRMListener describes Protocol and thumbprint of Windows Remote Management listener 6486type WinRMListener struct { 6487 // Protocol - Specifies the protocol of listener. <br><br> Possible values are: <br>**http** <br><br> **https**. Possible values include: 'HTTP', 'HTTPS' 6488 Protocol ProtocolTypes `json:"protocol,omitempty"` 6489 // 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: <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>} 6490 CertificateURL *string `json:"certificateUrl,omitempty"` 6491} 6492