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