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 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/azure" 25 "github.com/Azure/go-autorest/autorest/date" 26 "github.com/Azure/go-autorest/autorest/to" 27 "github.com/Azure/go-autorest/tracing" 28 "net/http" 29) 30 31// The package's fully qualified name. 32const fqdn = "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2015-06-15/compute" 33 34// CachingTypes enumerates the values for caching types. 35type CachingTypes string 36 37const ( 38 // None ... 39 None CachingTypes = "None" 40 // ReadOnly ... 41 ReadOnly CachingTypes = "ReadOnly" 42 // ReadWrite ... 43 ReadWrite CachingTypes = "ReadWrite" 44) 45 46// PossibleCachingTypesValues returns an array of possible values for the CachingTypes const type. 47func PossibleCachingTypesValues() []CachingTypes { 48 return []CachingTypes{None, ReadOnly, ReadWrite} 49} 50 51// ComponentNames enumerates the values for component names. 52type ComponentNames string 53 54const ( 55 // MicrosoftWindowsShellSetup ... 56 MicrosoftWindowsShellSetup ComponentNames = "Microsoft-Windows-Shell-Setup" 57) 58 59// PossibleComponentNamesValues returns an array of possible values for the ComponentNames const type. 60func PossibleComponentNamesValues() []ComponentNames { 61 return []ComponentNames{MicrosoftWindowsShellSetup} 62} 63 64// DiskCreateOptionTypes enumerates the values for disk create option types. 65type DiskCreateOptionTypes string 66 67const ( 68 // Attach ... 69 Attach DiskCreateOptionTypes = "Attach" 70 // Empty ... 71 Empty DiskCreateOptionTypes = "Empty" 72 // FromImage ... 73 FromImage DiskCreateOptionTypes = "FromImage" 74) 75 76// PossibleDiskCreateOptionTypesValues returns an array of possible values for the DiskCreateOptionTypes const type. 77func PossibleDiskCreateOptionTypesValues() []DiskCreateOptionTypes { 78 return []DiskCreateOptionTypes{Attach, Empty, FromImage} 79} 80 81// InstanceViewTypes enumerates the values for instance view types. 82type InstanceViewTypes string 83 84const ( 85 // InstanceView ... 86 InstanceView InstanceViewTypes = "instanceView" 87) 88 89// PossibleInstanceViewTypesValues returns an array of possible values for the InstanceViewTypes const type. 90func PossibleInstanceViewTypesValues() []InstanceViewTypes { 91 return []InstanceViewTypes{InstanceView} 92} 93 94// OperatingSystemTypes enumerates the values for operating system types. 95type OperatingSystemTypes string 96 97const ( 98 // Linux ... 99 Linux OperatingSystemTypes = "Linux" 100 // Windows ... 101 Windows OperatingSystemTypes = "Windows" 102) 103 104// PossibleOperatingSystemTypesValues returns an array of possible values for the OperatingSystemTypes const type. 105func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { 106 return []OperatingSystemTypes{Linux, Windows} 107} 108 109// PassNames enumerates the values for pass names. 110type PassNames string 111 112const ( 113 // OobeSystem ... 114 OobeSystem PassNames = "OobeSystem" 115) 116 117// PossiblePassNamesValues returns an array of possible values for the PassNames const type. 118func PossiblePassNamesValues() []PassNames { 119 return []PassNames{OobeSystem} 120} 121 122// ProtocolTypes enumerates the values for protocol types. 123type ProtocolTypes string 124 125const ( 126 // HTTP ... 127 HTTP ProtocolTypes = "Http" 128 // HTTPS ... 129 HTTPS ProtocolTypes = "Https" 130) 131 132// PossibleProtocolTypesValues returns an array of possible values for the ProtocolTypes const type. 133func PossibleProtocolTypesValues() []ProtocolTypes { 134 return []ProtocolTypes{HTTP, HTTPS} 135} 136 137// SettingNames enumerates the values for setting names. 138type SettingNames string 139 140const ( 141 // AutoLogon ... 142 AutoLogon SettingNames = "AutoLogon" 143 // FirstLogonCommands ... 144 FirstLogonCommands SettingNames = "FirstLogonCommands" 145) 146 147// PossibleSettingNamesValues returns an array of possible values for the SettingNames const type. 148func PossibleSettingNamesValues() []SettingNames { 149 return []SettingNames{AutoLogon, FirstLogonCommands} 150} 151 152// StatusLevelTypes enumerates the values for status level types. 153type StatusLevelTypes string 154 155const ( 156 // Error ... 157 Error StatusLevelTypes = "Error" 158 // Info ... 159 Info StatusLevelTypes = "Info" 160 // Warning ... 161 Warning StatusLevelTypes = "Warning" 162) 163 164// PossibleStatusLevelTypesValues returns an array of possible values for the StatusLevelTypes const type. 165func PossibleStatusLevelTypesValues() []StatusLevelTypes { 166 return []StatusLevelTypes{Error, Info, Warning} 167} 168 169// UpgradeMode enumerates the values for upgrade mode. 170type UpgradeMode string 171 172const ( 173 // Automatic ... 174 Automatic UpgradeMode = "Automatic" 175 // Manual ... 176 Manual UpgradeMode = "Manual" 177) 178 179// PossibleUpgradeModeValues returns an array of possible values for the UpgradeMode const type. 180func PossibleUpgradeModeValues() []UpgradeMode { 181 return []UpgradeMode{Automatic, Manual} 182} 183 184// VirtualMachineScaleSetSkuScaleType enumerates the values for virtual machine scale set sku scale type. 185type VirtualMachineScaleSetSkuScaleType string 186 187const ( 188 // VirtualMachineScaleSetSkuScaleTypeAutomatic ... 189 VirtualMachineScaleSetSkuScaleTypeAutomatic VirtualMachineScaleSetSkuScaleType = "Automatic" 190 // VirtualMachineScaleSetSkuScaleTypeNone ... 191 VirtualMachineScaleSetSkuScaleTypeNone VirtualMachineScaleSetSkuScaleType = "None" 192) 193 194// PossibleVirtualMachineScaleSetSkuScaleTypeValues returns an array of possible values for the VirtualMachineScaleSetSkuScaleType const type. 195func PossibleVirtualMachineScaleSetSkuScaleTypeValues() []VirtualMachineScaleSetSkuScaleType { 196 return []VirtualMachineScaleSetSkuScaleType{VirtualMachineScaleSetSkuScaleTypeAutomatic, VirtualMachineScaleSetSkuScaleTypeNone} 197} 198 199// VirtualMachineSizeTypes enumerates the values for virtual machine size types. 200type VirtualMachineSizeTypes string 201 202const ( 203 // BasicA0 ... 204 BasicA0 VirtualMachineSizeTypes = "Basic_A0" 205 // BasicA1 ... 206 BasicA1 VirtualMachineSizeTypes = "Basic_A1" 207 // BasicA2 ... 208 BasicA2 VirtualMachineSizeTypes = "Basic_A2" 209 // BasicA3 ... 210 BasicA3 VirtualMachineSizeTypes = "Basic_A3" 211 // BasicA4 ... 212 BasicA4 VirtualMachineSizeTypes = "Basic_A4" 213 // StandardA0 ... 214 StandardA0 VirtualMachineSizeTypes = "Standard_A0" 215 // StandardA1 ... 216 StandardA1 VirtualMachineSizeTypes = "Standard_A1" 217 // StandardA10 ... 218 StandardA10 VirtualMachineSizeTypes = "Standard_A10" 219 // StandardA11 ... 220 StandardA11 VirtualMachineSizeTypes = "Standard_A11" 221 // StandardA2 ... 222 StandardA2 VirtualMachineSizeTypes = "Standard_A2" 223 // StandardA3 ... 224 StandardA3 VirtualMachineSizeTypes = "Standard_A3" 225 // StandardA4 ... 226 StandardA4 VirtualMachineSizeTypes = "Standard_A4" 227 // StandardA5 ... 228 StandardA5 VirtualMachineSizeTypes = "Standard_A5" 229 // StandardA6 ... 230 StandardA6 VirtualMachineSizeTypes = "Standard_A6" 231 // StandardA7 ... 232 StandardA7 VirtualMachineSizeTypes = "Standard_A7" 233 // StandardA8 ... 234 StandardA8 VirtualMachineSizeTypes = "Standard_A8" 235 // StandardA9 ... 236 StandardA9 VirtualMachineSizeTypes = "Standard_A9" 237 // StandardD1 ... 238 StandardD1 VirtualMachineSizeTypes = "Standard_D1" 239 // StandardD11 ... 240 StandardD11 VirtualMachineSizeTypes = "Standard_D11" 241 // StandardD11V2 ... 242 StandardD11V2 VirtualMachineSizeTypes = "Standard_D11_v2" 243 // StandardD12 ... 244 StandardD12 VirtualMachineSizeTypes = "Standard_D12" 245 // StandardD12V2 ... 246 StandardD12V2 VirtualMachineSizeTypes = "Standard_D12_v2" 247 // StandardD13 ... 248 StandardD13 VirtualMachineSizeTypes = "Standard_D13" 249 // StandardD13V2 ... 250 StandardD13V2 VirtualMachineSizeTypes = "Standard_D13_v2" 251 // StandardD14 ... 252 StandardD14 VirtualMachineSizeTypes = "Standard_D14" 253 // StandardD14V2 ... 254 StandardD14V2 VirtualMachineSizeTypes = "Standard_D14_v2" 255 // StandardD1V2 ... 256 StandardD1V2 VirtualMachineSizeTypes = "Standard_D1_v2" 257 // StandardD2 ... 258 StandardD2 VirtualMachineSizeTypes = "Standard_D2" 259 // StandardD2V2 ... 260 StandardD2V2 VirtualMachineSizeTypes = "Standard_D2_v2" 261 // StandardD3 ... 262 StandardD3 VirtualMachineSizeTypes = "Standard_D3" 263 // StandardD3V2 ... 264 StandardD3V2 VirtualMachineSizeTypes = "Standard_D3_v2" 265 // StandardD4 ... 266 StandardD4 VirtualMachineSizeTypes = "Standard_D4" 267 // StandardD4V2 ... 268 StandardD4V2 VirtualMachineSizeTypes = "Standard_D4_v2" 269 // StandardD5V2 ... 270 StandardD5V2 VirtualMachineSizeTypes = "Standard_D5_v2" 271 // StandardDS1 ... 272 StandardDS1 VirtualMachineSizeTypes = "Standard_DS1" 273 // StandardDS11 ... 274 StandardDS11 VirtualMachineSizeTypes = "Standard_DS11" 275 // StandardDS12 ... 276 StandardDS12 VirtualMachineSizeTypes = "Standard_DS12" 277 // StandardDS13 ... 278 StandardDS13 VirtualMachineSizeTypes = "Standard_DS13" 279 // StandardDS14 ... 280 StandardDS14 VirtualMachineSizeTypes = "Standard_DS14" 281 // StandardDS2 ... 282 StandardDS2 VirtualMachineSizeTypes = "Standard_DS2" 283 // StandardDS3 ... 284 StandardDS3 VirtualMachineSizeTypes = "Standard_DS3" 285 // StandardDS4 ... 286 StandardDS4 VirtualMachineSizeTypes = "Standard_DS4" 287 // StandardG1 ... 288 StandardG1 VirtualMachineSizeTypes = "Standard_G1" 289 // StandardG2 ... 290 StandardG2 VirtualMachineSizeTypes = "Standard_G2" 291 // StandardG3 ... 292 StandardG3 VirtualMachineSizeTypes = "Standard_G3" 293 // StandardG4 ... 294 StandardG4 VirtualMachineSizeTypes = "Standard_G4" 295 // StandardG5 ... 296 StandardG5 VirtualMachineSizeTypes = "Standard_G5" 297 // StandardGS1 ... 298 StandardGS1 VirtualMachineSizeTypes = "Standard_GS1" 299 // StandardGS2 ... 300 StandardGS2 VirtualMachineSizeTypes = "Standard_GS2" 301 // StandardGS3 ... 302 StandardGS3 VirtualMachineSizeTypes = "Standard_GS3" 303 // StandardGS4 ... 304 StandardGS4 VirtualMachineSizeTypes = "Standard_GS4" 305 // StandardGS5 ... 306 StandardGS5 VirtualMachineSizeTypes = "Standard_GS5" 307) 308 309// PossibleVirtualMachineSizeTypesValues returns an array of possible values for the VirtualMachineSizeTypes const type. 310func PossibleVirtualMachineSizeTypesValues() []VirtualMachineSizeTypes { 311 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, StandardD1V2, StandardD2, StandardD2V2, StandardD3, StandardD3V2, StandardD4, StandardD4V2, StandardD5V2, StandardDS1, StandardDS11, StandardDS12, StandardDS13, StandardDS14, StandardDS2, StandardDS3, StandardDS4, StandardG1, StandardG2, StandardG3, StandardG4, StandardG5, StandardGS1, StandardGS2, StandardGS3, StandardGS4, StandardGS5} 312} 313 314// AdditionalUnattendContent specifies additional XML formatted information that can be included in the 315// Unattend.xml file, which is used by Windows Setup. Contents are defined by setting name, component name, 316// and the pass in which the content is applied. 317type AdditionalUnattendContent struct { 318 // PassName - The pass name. Currently, the only allowable value is OobeSystem. Possible values include: 'OobeSystem' 319 PassName PassNames `json:"passName,omitempty"` 320 // ComponentName - The component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. Possible values include: 'MicrosoftWindowsShellSetup' 321 ComponentName ComponentNames `json:"componentName,omitempty"` 322 // SettingName - Specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. Possible values include: 'AutoLogon', 'FirstLogonCommands' 323 SettingName SettingNames `json:"settingName,omitempty"` 324 // 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. 325 Content *string `json:"content,omitempty"` 326} 327 328// APIEntityReference the API entity reference. 329type APIEntityReference struct { 330 // ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... 331 ID *string `json:"id,omitempty"` 332} 333 334// APIError api error. 335type APIError struct { 336 // Details - The Api error details 337 Details *[]APIErrorBase `json:"details,omitempty"` 338 // Innererror - The Api inner error 339 Innererror *InnerError `json:"innererror,omitempty"` 340 // Code - The error code. 341 Code *string `json:"code,omitempty"` 342 // Target - The target of the particular error. 343 Target *string `json:"target,omitempty"` 344 // Message - The error message. 345 Message *string `json:"message,omitempty"` 346} 347 348// APIErrorBase api error base. 349type APIErrorBase struct { 350 // Code - The error code. 351 Code *string `json:"code,omitempty"` 352 // Target - The target of the particular error. 353 Target *string `json:"target,omitempty"` 354 // Message - The error message. 355 Message *string `json:"message,omitempty"` 356} 357 358// AvailabilitySet specifies information about the availability set that the virtual machine should be 359// assigned to. Virtual machines specified in the same availability set are allocated to different nodes to 360// maximize availability. For more information about availability sets, see [Manage the availability of 361// virtual 362// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). 363// <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual 364// machines in 365// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) 366// <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot 367// be added to an availability set. 368type AvailabilitySet struct { 369 autorest.Response `json:"-"` 370 *AvailabilitySetProperties `json:"properties,omitempty"` 371 // ID - READ-ONLY; Resource Id 372 ID *string `json:"id,omitempty"` 373 // Name - READ-ONLY; Resource name 374 Name *string `json:"name,omitempty"` 375 // Type - READ-ONLY; Resource type 376 Type *string `json:"type,omitempty"` 377 // Location - Resource location 378 Location *string `json:"location,omitempty"` 379 // Tags - Resource tags 380 Tags map[string]*string `json:"tags"` 381} 382 383// MarshalJSON is the custom marshaler for AvailabilitySet. 384func (as AvailabilitySet) MarshalJSON() ([]byte, error) { 385 objectMap := make(map[string]interface{}) 386 if as.AvailabilitySetProperties != nil { 387 objectMap["properties"] = as.AvailabilitySetProperties 388 } 389 if as.Location != nil { 390 objectMap["location"] = as.Location 391 } 392 if as.Tags != nil { 393 objectMap["tags"] = as.Tags 394 } 395 return json.Marshal(objectMap) 396} 397 398// UnmarshalJSON is the custom unmarshaler for AvailabilitySet struct. 399func (as *AvailabilitySet) UnmarshalJSON(body []byte) error { 400 var m map[string]*json.RawMessage 401 err := json.Unmarshal(body, &m) 402 if err != nil { 403 return err 404 } 405 for k, v := range m { 406 switch k { 407 case "properties": 408 if v != nil { 409 var availabilitySetProperties AvailabilitySetProperties 410 err = json.Unmarshal(*v, &availabilitySetProperties) 411 if err != nil { 412 return err 413 } 414 as.AvailabilitySetProperties = &availabilitySetProperties 415 } 416 case "id": 417 if v != nil { 418 var ID string 419 err = json.Unmarshal(*v, &ID) 420 if err != nil { 421 return err 422 } 423 as.ID = &ID 424 } 425 case "name": 426 if v != nil { 427 var name string 428 err = json.Unmarshal(*v, &name) 429 if err != nil { 430 return err 431 } 432 as.Name = &name 433 } 434 case "type": 435 if v != nil { 436 var typeVar string 437 err = json.Unmarshal(*v, &typeVar) 438 if err != nil { 439 return err 440 } 441 as.Type = &typeVar 442 } 443 case "location": 444 if v != nil { 445 var location string 446 err = json.Unmarshal(*v, &location) 447 if err != nil { 448 return err 449 } 450 as.Location = &location 451 } 452 case "tags": 453 if v != nil { 454 var tags map[string]*string 455 err = json.Unmarshal(*v, &tags) 456 if err != nil { 457 return err 458 } 459 as.Tags = tags 460 } 461 } 462 } 463 464 return nil 465} 466 467// AvailabilitySetListResult the List Availability Set operation response. 468type AvailabilitySetListResult struct { 469 autorest.Response `json:"-"` 470 // Value - The list of availability sets 471 Value *[]AvailabilitySet `json:"value,omitempty"` 472 // NextLink - The URI to fetch the next page of AvailabilitySets. Call ListNext() with this URI to fetch the next page of AvailabilitySets. 473 NextLink *string `json:"nextLink,omitempty"` 474} 475 476// AvailabilitySetListResultIterator provides access to a complete listing of AvailabilitySet values. 477type AvailabilitySetListResultIterator struct { 478 i int 479 page AvailabilitySetListResultPage 480} 481 482// NextWithContext advances to the next value. If there was an error making 483// the request the iterator does not advance and the error is returned. 484func (iter *AvailabilitySetListResultIterator) NextWithContext(ctx context.Context) (err error) { 485 if tracing.IsEnabled() { 486 ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetListResultIterator.NextWithContext") 487 defer func() { 488 sc := -1 489 if iter.Response().Response.Response != nil { 490 sc = iter.Response().Response.Response.StatusCode 491 } 492 tracing.EndSpan(ctx, sc, err) 493 }() 494 } 495 iter.i++ 496 if iter.i < len(iter.page.Values()) { 497 return nil 498 } 499 err = iter.page.NextWithContext(ctx) 500 if err != nil { 501 iter.i-- 502 return err 503 } 504 iter.i = 0 505 return nil 506} 507 508// Next advances to the next value. If there was an error making 509// the request the iterator does not advance and the error is returned. 510// Deprecated: Use NextWithContext() instead. 511func (iter *AvailabilitySetListResultIterator) Next() error { 512 return iter.NextWithContext(context.Background()) 513} 514 515// NotDone returns true if the enumeration should be started or is not yet complete. 516func (iter AvailabilitySetListResultIterator) NotDone() bool { 517 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 518} 519 520// Response returns the raw server response from the last page request. 521func (iter AvailabilitySetListResultIterator) Response() AvailabilitySetListResult { 522 return iter.page.Response() 523} 524 525// Value returns the current value or a zero-initialized value if the 526// iterator has advanced beyond the end of the collection. 527func (iter AvailabilitySetListResultIterator) Value() AvailabilitySet { 528 if !iter.page.NotDone() { 529 return AvailabilitySet{} 530 } 531 return iter.page.Values()[iter.i] 532} 533 534// Creates a new instance of the AvailabilitySetListResultIterator type. 535func NewAvailabilitySetListResultIterator(page AvailabilitySetListResultPage) AvailabilitySetListResultIterator { 536 return AvailabilitySetListResultIterator{page: page} 537} 538 539// IsEmpty returns true if the ListResult contains no values. 540func (aslr AvailabilitySetListResult) IsEmpty() bool { 541 return aslr.Value == nil || len(*aslr.Value) == 0 542} 543 544// availabilitySetListResultPreparer prepares a request to retrieve the next set of results. 545// It returns nil if no more results exist. 546func (aslr AvailabilitySetListResult) availabilitySetListResultPreparer(ctx context.Context) (*http.Request, error) { 547 if aslr.NextLink == nil || len(to.String(aslr.NextLink)) < 1 { 548 return nil, nil 549 } 550 return autorest.Prepare((&http.Request{}).WithContext(ctx), 551 autorest.AsJSON(), 552 autorest.AsGet(), 553 autorest.WithBaseURL(to.String(aslr.NextLink))) 554} 555 556// AvailabilitySetListResultPage contains a page of AvailabilitySet values. 557type AvailabilitySetListResultPage struct { 558 fn func(context.Context, AvailabilitySetListResult) (AvailabilitySetListResult, error) 559 aslr AvailabilitySetListResult 560} 561 562// NextWithContext advances to the next page of values. If there was an error making 563// the request the page does not advance and the error is returned. 564func (page *AvailabilitySetListResultPage) NextWithContext(ctx context.Context) (err error) { 565 if tracing.IsEnabled() { 566 ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilitySetListResultPage.NextWithContext") 567 defer func() { 568 sc := -1 569 if page.Response().Response.Response != nil { 570 sc = page.Response().Response.Response.StatusCode 571 } 572 tracing.EndSpan(ctx, sc, err) 573 }() 574 } 575 next, err := page.fn(ctx, page.aslr) 576 if err != nil { 577 return err 578 } 579 page.aslr = next 580 return nil 581} 582 583// Next advances to the next page of values. If there was an error making 584// the request the page does not advance and the error is returned. 585// Deprecated: Use NextWithContext() instead. 586func (page *AvailabilitySetListResultPage) Next() error { 587 return page.NextWithContext(context.Background()) 588} 589 590// NotDone returns true if the page enumeration should be started or is not yet complete. 591func (page AvailabilitySetListResultPage) NotDone() bool { 592 return !page.aslr.IsEmpty() 593} 594 595// Response returns the raw server response from the last page request. 596func (page AvailabilitySetListResultPage) Response() AvailabilitySetListResult { 597 return page.aslr 598} 599 600// Values returns the slice of values for the current page or nil if there are no values. 601func (page AvailabilitySetListResultPage) Values() []AvailabilitySet { 602 if page.aslr.IsEmpty() { 603 return nil 604 } 605 return *page.aslr.Value 606} 607 608// Creates a new instance of the AvailabilitySetListResultPage type. 609func NewAvailabilitySetListResultPage(getNextPage func(context.Context, AvailabilitySetListResult) (AvailabilitySetListResult, error)) AvailabilitySetListResultPage { 610 return AvailabilitySetListResultPage{fn: getNextPage} 611} 612 613// AvailabilitySetProperties the instance view of a resource. 614type AvailabilitySetProperties struct { 615 // PlatformUpdateDomainCount - Update Domain count. 616 PlatformUpdateDomainCount *int32 `json:"platformUpdateDomainCount,omitempty"` 617 // PlatformFaultDomainCount - Fault Domain count. 618 PlatformFaultDomainCount *int32 `json:"platformFaultDomainCount,omitempty"` 619 // VirtualMachines - A list of references to all virtual machines in the availability set. 620 VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"` 621 // Statuses - READ-ONLY; The resource status information. 622 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 623} 624 625// BootDiagnostics boot Diagnostics is a debugging feature which allows you to view Console Output and 626// Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> 627// Azure also enables you to see a screenshot of the VM from the hypervisor. 628type BootDiagnostics struct { 629 // Enabled - Whether boot diagnostics should be enabled on the Virtual Machine. 630 Enabled *bool `json:"enabled,omitempty"` 631 // StorageURI - Uri of the storage account to use for placing the console output and screenshot. 632 StorageURI *string `json:"storageUri,omitempty"` 633} 634 635// BootDiagnosticsInstanceView the instance view of a virtual machine boot diagnostics. 636type BootDiagnosticsInstanceView struct { 637 // ConsoleScreenshotBlobURI - READ-ONLY; The console screenshot blob URI. 638 ConsoleScreenshotBlobURI *string `json:"consoleScreenshotBlobUri,omitempty"` 639 // SerialConsoleLogBlobURI - READ-ONLY; The Linux serial console log blob Uri. 640 SerialConsoleLogBlobURI *string `json:"serialConsoleLogBlobUri,omitempty"` 641} 642 643// DataDisk describes a data disk. 644type DataDisk struct { 645 // 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. 646 Lun *int32 `json:"lun,omitempty"` 647 // Name - The disk name. 648 Name *string `json:"name,omitempty"` 649 // Vhd - The virtual hard disk. 650 Vhd *VirtualHardDisk `json:"vhd,omitempty"` 651 // 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. 652 Image *VirtualHardDisk `json:"image,omitempty"` 653 // 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: 'None', 'ReadOnly', 'ReadWrite' 654 Caching CachingTypes `json:"caching,omitempty"` 655 // 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: 'FromImage', 'Empty', 'Attach' 656 CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` 657 // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB 658 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 659} 660 661// DataDiskImage contains the data disk images information. 662type DataDiskImage struct { 663 // Lun - READ-ONLY; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. 664 Lun *int32 `json:"lun,omitempty"` 665} 666 667// DiagnosticsProfile specifies the boot diagnostic settings state. <br><br>Minimum api-version: 668// 2015-06-15. 669type DiagnosticsProfile struct { 670 // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. 671 BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` 672} 673 674// DiskEncryptionSettings describes a Encryption Settings for a Disk 675type DiskEncryptionSettings struct { 676 // DiskEncryptionKey - Specifies the location of the disk encryption key, which is a Key Vault Secret. 677 DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` 678 // KeyEncryptionKey - Specifies the location of the key encryption key in Key Vault. 679 KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` 680 // Enabled - Specifies whether disk encryption should be enabled on the virtual machine. 681 Enabled *bool `json:"enabled,omitempty"` 682} 683 684// DiskInstanceView the instance view of the disk. 685type DiskInstanceView struct { 686 // Name - The disk name. 687 Name *string `json:"name,omitempty"` 688 // Statuses - The resource status information. 689 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 690} 691 692// HardwareProfile specifies the hardware settings for the virtual machine. 693type HardwareProfile struct { 694 // 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](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) <br><br> [List all available virtual machine sizes in a region](https://docs.microsoft.com/rest/api/compute/virtualmachinesizes/list) <br><br> [List all available virtual machine sizes for resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). 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', 'StandardDS1', 'StandardDS2', 'StandardDS3', 'StandardDS4', 'StandardDS11', 'StandardDS12', 'StandardDS13', 'StandardDS14', 'StandardG1', 'StandardG2', 'StandardG3', 'StandardG4', 'StandardG5', 'StandardGS1', 'StandardGS2', 'StandardGS3', 'StandardGS4', 'StandardGS5' 695 VMSize VirtualMachineSizeTypes `json:"vmSize,omitempty"` 696} 697 698// ImageReference specifies information about the image to use. You can specify information about platform 699// images, marketplace images, or virtual machine images. This element is required when you want to use a 700// platform image, marketplace image, or virtual machine image, but is not used in other creation 701// operations. 702type ImageReference struct { 703 // Publisher - The image publisher. 704 Publisher *string `json:"publisher,omitempty"` 705 // Offer - Specifies the offer of the platform image or marketplace image used to create the virtual machine. 706 Offer *string `json:"offer,omitempty"` 707 // Sku - The image SKU. 708 Sku *string `json:"sku,omitempty"` 709 // 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. 710 Version *string `json:"version,omitempty"` 711} 712 713// InnerError inner error details. 714type InnerError struct { 715 // Exceptiontype - The exception type. 716 Exceptiontype *string `json:"exceptiontype,omitempty"` 717 // Errordetail - The internal error message or exception dump. 718 Errordetail *string `json:"errordetail,omitempty"` 719} 720 721// InstanceViewStatus instance view status. 722type InstanceViewStatus struct { 723 // Code - The status code. 724 Code *string `json:"code,omitempty"` 725 // Level - The level code. Possible values include: 'Info', 'Warning', 'Error' 726 Level StatusLevelTypes `json:"level,omitempty"` 727 // DisplayStatus - The short localizable label for the status. 728 DisplayStatus *string `json:"displayStatus,omitempty"` 729 // Message - The detailed status message, including for alerts and error messages. 730 Message *string `json:"message,omitempty"` 731 // Time - The time of the status. 732 Time *date.Time `json:"time,omitempty"` 733} 734 735// KeyVaultKeyReference describes a reference to Key Vault Key 736type KeyVaultKeyReference struct { 737 // KeyURL - The URL referencing a key encryption key in Key Vault. 738 KeyURL *string `json:"keyUrl,omitempty"` 739 // SourceVault - The relative URL of the Key Vault containing the key. 740 SourceVault *SubResource `json:"sourceVault,omitempty"` 741} 742 743// KeyVaultSecretReference describes a reference to Key Vault Secret 744type KeyVaultSecretReference struct { 745 // SecretURL - The URL referencing a secret in a Key Vault. 746 SecretURL *string `json:"secretUrl,omitempty"` 747 // SourceVault - The relative URL of the Key Vault containing the secret. 748 SourceVault *SubResource `json:"sourceVault,omitempty"` 749} 750 751// LinuxConfiguration specifies the Linux operating system settings on the virtual machine. <br><br>For a 752// list of supported Linux distributions, see [Linux on Azure-Endorsed 753// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) 754// <br><br> For running non-endorsed distributions, see [Information for Non-Endorsed 755// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). 756type LinuxConfiguration struct { 757 // DisablePasswordAuthentication - Specifies whether password authentication should be disabled. 758 DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` 759 // SSH - Specifies the ssh key configuration for a Linux OS. 760 SSH *SSHConfiguration `json:"ssh,omitempty"` 761} 762 763// ListUsagesResult the List Usages operation response. 764type ListUsagesResult struct { 765 autorest.Response `json:"-"` 766 // Value - The list of compute resource usages. 767 Value *[]Usage `json:"value,omitempty"` 768 // 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. 769 NextLink *string `json:"nextLink,omitempty"` 770} 771 772// ListUsagesResultIterator provides access to a complete listing of Usage values. 773type ListUsagesResultIterator struct { 774 i int 775 page ListUsagesResultPage 776} 777 778// NextWithContext advances to the next value. If there was an error making 779// the request the iterator does not advance and the error is returned. 780func (iter *ListUsagesResultIterator) NextWithContext(ctx context.Context) (err error) { 781 if tracing.IsEnabled() { 782 ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultIterator.NextWithContext") 783 defer func() { 784 sc := -1 785 if iter.Response().Response.Response != nil { 786 sc = iter.Response().Response.Response.StatusCode 787 } 788 tracing.EndSpan(ctx, sc, err) 789 }() 790 } 791 iter.i++ 792 if iter.i < len(iter.page.Values()) { 793 return nil 794 } 795 err = iter.page.NextWithContext(ctx) 796 if err != nil { 797 iter.i-- 798 return err 799 } 800 iter.i = 0 801 return nil 802} 803 804// Next advances to the next value. If there was an error making 805// the request the iterator does not advance and the error is returned. 806// Deprecated: Use NextWithContext() instead. 807func (iter *ListUsagesResultIterator) Next() error { 808 return iter.NextWithContext(context.Background()) 809} 810 811// NotDone returns true if the enumeration should be started or is not yet complete. 812func (iter ListUsagesResultIterator) NotDone() bool { 813 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 814} 815 816// Response returns the raw server response from the last page request. 817func (iter ListUsagesResultIterator) Response() ListUsagesResult { 818 return iter.page.Response() 819} 820 821// Value returns the current value or a zero-initialized value if the 822// iterator has advanced beyond the end of the collection. 823func (iter ListUsagesResultIterator) Value() Usage { 824 if !iter.page.NotDone() { 825 return Usage{} 826 } 827 return iter.page.Values()[iter.i] 828} 829 830// Creates a new instance of the ListUsagesResultIterator type. 831func NewListUsagesResultIterator(page ListUsagesResultPage) ListUsagesResultIterator { 832 return ListUsagesResultIterator{page: page} 833} 834 835// IsEmpty returns true if the ListResult contains no values. 836func (lur ListUsagesResult) IsEmpty() bool { 837 return lur.Value == nil || len(*lur.Value) == 0 838} 839 840// listUsagesResultPreparer prepares a request to retrieve the next set of results. 841// It returns nil if no more results exist. 842func (lur ListUsagesResult) listUsagesResultPreparer(ctx context.Context) (*http.Request, error) { 843 if lur.NextLink == nil || len(to.String(lur.NextLink)) < 1 { 844 return nil, nil 845 } 846 return autorest.Prepare((&http.Request{}).WithContext(ctx), 847 autorest.AsJSON(), 848 autorest.AsGet(), 849 autorest.WithBaseURL(to.String(lur.NextLink))) 850} 851 852// ListUsagesResultPage contains a page of Usage values. 853type ListUsagesResultPage struct { 854 fn func(context.Context, ListUsagesResult) (ListUsagesResult, error) 855 lur ListUsagesResult 856} 857 858// NextWithContext advances to the next page of values. If there was an error making 859// the request the page does not advance and the error is returned. 860func (page *ListUsagesResultPage) NextWithContext(ctx context.Context) (err error) { 861 if tracing.IsEnabled() { 862 ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultPage.NextWithContext") 863 defer func() { 864 sc := -1 865 if page.Response().Response.Response != nil { 866 sc = page.Response().Response.Response.StatusCode 867 } 868 tracing.EndSpan(ctx, sc, err) 869 }() 870 } 871 next, err := page.fn(ctx, page.lur) 872 if err != nil { 873 return err 874 } 875 page.lur = next 876 return nil 877} 878 879// Next advances to the next page of values. If there was an error making 880// the request the page does not advance and the error is returned. 881// Deprecated: Use NextWithContext() instead. 882func (page *ListUsagesResultPage) Next() error { 883 return page.NextWithContext(context.Background()) 884} 885 886// NotDone returns true if the page enumeration should be started or is not yet complete. 887func (page ListUsagesResultPage) NotDone() bool { 888 return !page.lur.IsEmpty() 889} 890 891// Response returns the raw server response from the last page request. 892func (page ListUsagesResultPage) Response() ListUsagesResult { 893 return page.lur 894} 895 896// Values returns the slice of values for the current page or nil if there are no values. 897func (page ListUsagesResultPage) Values() []Usage { 898 if page.lur.IsEmpty() { 899 return nil 900 } 901 return *page.lur.Value 902} 903 904// Creates a new instance of the ListUsagesResultPage type. 905func NewListUsagesResultPage(getNextPage func(context.Context, ListUsagesResult) (ListUsagesResult, error)) ListUsagesResultPage { 906 return ListUsagesResultPage{fn: getNextPage} 907} 908 909// ListVirtualMachineExtensionImage ... 910type ListVirtualMachineExtensionImage struct { 911 autorest.Response `json:"-"` 912 Value *[]VirtualMachineExtensionImage `json:"value,omitempty"` 913} 914 915// ListVirtualMachineImageResource ... 916type ListVirtualMachineImageResource struct { 917 autorest.Response `json:"-"` 918 Value *[]VirtualMachineImageResource `json:"value,omitempty"` 919} 920 921// LongRunningOperationProperties compute-specific operation properties, including output 922type LongRunningOperationProperties struct { 923 // Output - Operation output data (raw JSON) 924 Output interface{} `json:"output,omitempty"` 925} 926 927// NetworkInterfaceReference describes a network interface reference. 928type NetworkInterfaceReference struct { 929 *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` 930 // ID - Resource Id 931 ID *string `json:"id,omitempty"` 932} 933 934// MarshalJSON is the custom marshaler for NetworkInterfaceReference. 935func (nir NetworkInterfaceReference) MarshalJSON() ([]byte, error) { 936 objectMap := make(map[string]interface{}) 937 if nir.NetworkInterfaceReferenceProperties != nil { 938 objectMap["properties"] = nir.NetworkInterfaceReferenceProperties 939 } 940 if nir.ID != nil { 941 objectMap["id"] = nir.ID 942 } 943 return json.Marshal(objectMap) 944} 945 946// UnmarshalJSON is the custom unmarshaler for NetworkInterfaceReference struct. 947func (nir *NetworkInterfaceReference) UnmarshalJSON(body []byte) error { 948 var m map[string]*json.RawMessage 949 err := json.Unmarshal(body, &m) 950 if err != nil { 951 return err 952 } 953 for k, v := range m { 954 switch k { 955 case "properties": 956 if v != nil { 957 var networkInterfaceReferenceProperties NetworkInterfaceReferenceProperties 958 err = json.Unmarshal(*v, &networkInterfaceReferenceProperties) 959 if err != nil { 960 return err 961 } 962 nir.NetworkInterfaceReferenceProperties = &networkInterfaceReferenceProperties 963 } 964 case "id": 965 if v != nil { 966 var ID string 967 err = json.Unmarshal(*v, &ID) 968 if err != nil { 969 return err 970 } 971 nir.ID = &ID 972 } 973 } 974 } 975 976 return nil 977} 978 979// NetworkInterfaceReferenceProperties describes a network interface reference properties. 980type NetworkInterfaceReferenceProperties struct { 981 // Primary - Specifies the primary network interface in case the virtual machine has more than 1 network interface. 982 Primary *bool `json:"primary,omitempty"` 983} 984 985// NetworkProfile specifies the network interfaces of the virtual machine. 986type NetworkProfile struct { 987 // NetworkInterfaces - Specifies the list of resource Ids for the network interfaces associated with the virtual machine. 988 NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"` 989} 990 991// OperationStatusResponse operation status response 992type OperationStatusResponse struct { 993 autorest.Response `json:"-"` 994 // Name - READ-ONLY; Operation ID 995 Name *string `json:"name,omitempty"` 996 // Status - READ-ONLY; Operation status 997 Status *string `json:"status,omitempty"` 998 // StartTime - READ-ONLY; Start time of the operation 999 StartTime *date.Time `json:"startTime,omitempty"` 1000 // EndTime - READ-ONLY; End time of the operation 1001 EndTime *date.Time `json:"endTime,omitempty"` 1002 // Error - READ-ONLY; Api error 1003 Error *APIError `json:"error,omitempty"` 1004} 1005 1006// OSDisk specifies information about the operating system disk used by the virtual machine. <br><br> For 1007// more information about disks, see [About disks and VHDs for Azure virtual 1008// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). 1009type OSDisk struct { 1010 // 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' 1011 OsType OperatingSystemTypes `json:"osType,omitempty"` 1012 // EncryptionSettings - Specifies the encryption settings for the OS Disk. <br><br> Minimum api-version: 2015-06-15 1013 EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` 1014 // Name - The disk name. 1015 Name *string `json:"name,omitempty"` 1016 // Vhd - The virtual hard disk. 1017 Vhd *VirtualHardDisk `json:"vhd,omitempty"` 1018 // 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. 1019 Image *VirtualHardDisk `json:"image,omitempty"` 1020 // 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: 'None', 'ReadOnly', 'ReadWrite' 1021 Caching CachingTypes `json:"caching,omitempty"` 1022 // 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: 'FromImage', 'Empty', 'Attach' 1023 CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` 1024 // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB 1025 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 1026} 1027 1028// OSDiskImage contains the os disk image information. 1029type OSDiskImage struct { 1030 // OperatingSystem - The operating system of the osDiskImage. Possible values include: 'Windows', 'Linux' 1031 OperatingSystem OperatingSystemTypes `json:"operatingSystem,omitempty"` 1032} 1033 1034// OSProfile specifies the operating system settings for the virtual machine. 1035type OSProfile struct { 1036 // ComputerName - Specifies the host OS name of the virtual machine. <br><br> This name cannot be updated after the VM is created. <br><br> **Max-length (Windows):** 15 characters <br><br> **Max-length (Linux):** 64 characters. <br><br> For naming conventions and restrictions see [Azure infrastructure services implementation guidelines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions). 1037 ComputerName *string `json:"computerName,omitempty"` 1038 // 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) 1039 AdminUsername *string `json:"adminUsername,omitempty"` 1040 // 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) 1041 AdminPassword *string `json:"adminPassword,omitempty"` 1042 // 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) 1043 CustomData *string `json:"customData,omitempty"` 1044 // WindowsConfiguration - Specifies Windows operating system settings on the virtual machine. 1045 WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` 1046 // 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). 1047 LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` 1048 // Secrets - Specifies set of certificates that should be installed onto the virtual machine. 1049 Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` 1050} 1051 1052// Plan specifies information about the marketplace image used to create the virtual machine. This element 1053// is only used for marketplace images. Before you can use a marketplace image from an API, you must enable 1054// the image for programmatic use. In the Azure portal, find the marketplace image that you want to use 1055// and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and 1056// then click **Save**. 1057type Plan struct { 1058 // Name - The plan ID. 1059 Name *string `json:"name,omitempty"` 1060 // Publisher - The publisher ID. 1061 Publisher *string `json:"publisher,omitempty"` 1062 // Product - Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. 1063 Product *string `json:"product,omitempty"` 1064 // PromotionCode - The promotion code. 1065 PromotionCode *string `json:"promotionCode,omitempty"` 1066} 1067 1068// PurchasePlan used for establishing the purchase context of any 3rd Party artifact through MarketPlace. 1069type PurchasePlan struct { 1070 // Publisher - The publisher ID. 1071 Publisher *string `json:"publisher,omitempty"` 1072 // Name - The plan ID. 1073 Name *string `json:"name,omitempty"` 1074 // Product - Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. 1075 Product *string `json:"product,omitempty"` 1076} 1077 1078// Resource the Resource model definition. 1079type Resource struct { 1080 // ID - READ-ONLY; Resource Id 1081 ID *string `json:"id,omitempty"` 1082 // Name - READ-ONLY; Resource name 1083 Name *string `json:"name,omitempty"` 1084 // Type - READ-ONLY; Resource type 1085 Type *string `json:"type,omitempty"` 1086 // Location - Resource location 1087 Location *string `json:"location,omitempty"` 1088 // Tags - Resource tags 1089 Tags map[string]*string `json:"tags"` 1090} 1091 1092// MarshalJSON is the custom marshaler for Resource. 1093func (r Resource) MarshalJSON() ([]byte, error) { 1094 objectMap := make(map[string]interface{}) 1095 if r.Location != nil { 1096 objectMap["location"] = r.Location 1097 } 1098 if r.Tags != nil { 1099 objectMap["tags"] = r.Tags 1100 } 1101 return json.Marshal(objectMap) 1102} 1103 1104// Sku describes a virtual machine scale set sku. 1105type Sku struct { 1106 // Name - The sku name. 1107 Name *string `json:"name,omitempty"` 1108 // Tier - Specifies the tier of virtual machines in a scale set.<br /><br /> Possible Values:<br /><br /> **Standard**<br /><br /> **Basic** 1109 Tier *string `json:"tier,omitempty"` 1110 // Capacity - Specifies the number of virtual machines in the scale set. 1111 Capacity *int64 `json:"capacity,omitempty"` 1112} 1113 1114// SSHConfiguration SSH configuration for Linux based VMs running on Azure 1115type SSHConfiguration struct { 1116 // PublicKeys - The list of SSH public keys used to authenticate with linux based VMs. 1117 PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` 1118} 1119 1120// SSHPublicKey contains information about SSH certificate public key and the path on the Linux VM where 1121// the public key is placed. 1122type SSHPublicKey struct { 1123 // 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 1124 Path *string `json:"path,omitempty"` 1125 // 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). 1126 KeyData *string `json:"keyData,omitempty"` 1127} 1128 1129// StorageProfile specifies the storage settings for the virtual machine disks. 1130type StorageProfile struct { 1131 // 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. 1132 ImageReference *ImageReference `json:"imageReference,omitempty"` 1133 // 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). 1134 OsDisk *OSDisk `json:"osDisk,omitempty"` 1135 // 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). 1136 DataDisks *[]DataDisk `json:"dataDisks,omitempty"` 1137} 1138 1139// SubResource ... 1140type SubResource struct { 1141 // ID - Resource Id 1142 ID *string `json:"id,omitempty"` 1143} 1144 1145// UpdateResource the Update Resource model definition. 1146type UpdateResource struct { 1147 // Tags - Resource tags 1148 Tags map[string]*string `json:"tags"` 1149} 1150 1151// MarshalJSON is the custom marshaler for UpdateResource. 1152func (ur UpdateResource) MarshalJSON() ([]byte, error) { 1153 objectMap := make(map[string]interface{}) 1154 if ur.Tags != nil { 1155 objectMap["tags"] = ur.Tags 1156 } 1157 return json.Marshal(objectMap) 1158} 1159 1160// UpgradePolicy describes an upgrade policy - automatic or manual. 1161type UpgradePolicy struct { 1162 // 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' 1163 Mode UpgradeMode `json:"mode,omitempty"` 1164} 1165 1166// Usage describes Compute Resource Usage. 1167type Usage struct { 1168 // Unit - An enum describing the unit of usage measurement. 1169 Unit *string `json:"unit,omitempty"` 1170 // CurrentValue - The current usage of the resource. 1171 CurrentValue *int32 `json:"currentValue,omitempty"` 1172 // Limit - The maximum permitted usage of the resource. 1173 Limit *int64 `json:"limit,omitempty"` 1174 // Name - The name of the type of usage. 1175 Name *UsageName `json:"name,omitempty"` 1176} 1177 1178// UsageName the Usage Names. 1179type UsageName struct { 1180 // Value - The name of the resource. 1181 Value *string `json:"value,omitempty"` 1182 // LocalizedValue - The localized name of the resource. 1183 LocalizedValue *string `json:"localizedValue,omitempty"` 1184} 1185 1186// VaultCertificate describes a single certificate reference in a Key Vault, and where the certificate 1187// should reside on the VM. 1188type VaultCertificate struct { 1189 // 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>} 1190 CertificateURL *string `json:"certificateUrl,omitempty"` 1191 // CertificateStore - For Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified certificate store is implicitly in the LocalMachine account. <br><br>For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name <UppercaseThumbprint>.crt for the X509 certificate file and <UppercaseThumbprint>.prv for private key. Both of these files are .pem formatted. 1192 CertificateStore *string `json:"certificateStore,omitempty"` 1193} 1194 1195// VaultSecretGroup describes a set of certificates which are all in the same Key Vault. 1196type VaultSecretGroup struct { 1197 // SourceVault - The relative URL of the Key Vault containing all of the certificates in VaultCertificates. 1198 SourceVault *SubResource `json:"sourceVault,omitempty"` 1199 // VaultCertificates - The list of key vault references in SourceVault which contain certificates. 1200 VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` 1201} 1202 1203// VirtualHardDisk describes the uri of a disk. 1204type VirtualHardDisk struct { 1205 // URI - Specifies the virtual hard disk's uri. 1206 URI *string `json:"uri,omitempty"` 1207} 1208 1209// VirtualMachine describes a Virtual Machine. 1210type VirtualMachine struct { 1211 autorest.Response `json:"-"` 1212 // 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**. 1213 Plan *Plan `json:"plan,omitempty"` 1214 *VirtualMachineProperties `json:"properties,omitempty"` 1215 // Resources - READ-ONLY; The virtual machine child extension resources. 1216 Resources *[]VirtualMachineExtension `json:"resources,omitempty"` 1217 // ID - READ-ONLY; Resource Id 1218 ID *string `json:"id,omitempty"` 1219 // Name - READ-ONLY; Resource name 1220 Name *string `json:"name,omitempty"` 1221 // Type - READ-ONLY; Resource type 1222 Type *string `json:"type,omitempty"` 1223 // Location - Resource location 1224 Location *string `json:"location,omitempty"` 1225 // Tags - Resource tags 1226 Tags map[string]*string `json:"tags"` 1227} 1228 1229// MarshalJSON is the custom marshaler for VirtualMachine. 1230func (VM VirtualMachine) MarshalJSON() ([]byte, error) { 1231 objectMap := make(map[string]interface{}) 1232 if VM.Plan != nil { 1233 objectMap["plan"] = VM.Plan 1234 } 1235 if VM.VirtualMachineProperties != nil { 1236 objectMap["properties"] = VM.VirtualMachineProperties 1237 } 1238 if VM.Location != nil { 1239 objectMap["location"] = VM.Location 1240 } 1241 if VM.Tags != nil { 1242 objectMap["tags"] = VM.Tags 1243 } 1244 return json.Marshal(objectMap) 1245} 1246 1247// UnmarshalJSON is the custom unmarshaler for VirtualMachine struct. 1248func (VM *VirtualMachine) UnmarshalJSON(body []byte) error { 1249 var m map[string]*json.RawMessage 1250 err := json.Unmarshal(body, &m) 1251 if err != nil { 1252 return err 1253 } 1254 for k, v := range m { 1255 switch k { 1256 case "plan": 1257 if v != nil { 1258 var plan Plan 1259 err = json.Unmarshal(*v, &plan) 1260 if err != nil { 1261 return err 1262 } 1263 VM.Plan = &plan 1264 } 1265 case "properties": 1266 if v != nil { 1267 var virtualMachineProperties VirtualMachineProperties 1268 err = json.Unmarshal(*v, &virtualMachineProperties) 1269 if err != nil { 1270 return err 1271 } 1272 VM.VirtualMachineProperties = &virtualMachineProperties 1273 } 1274 case "resources": 1275 if v != nil { 1276 var resources []VirtualMachineExtension 1277 err = json.Unmarshal(*v, &resources) 1278 if err != nil { 1279 return err 1280 } 1281 VM.Resources = &resources 1282 } 1283 case "id": 1284 if v != nil { 1285 var ID string 1286 err = json.Unmarshal(*v, &ID) 1287 if err != nil { 1288 return err 1289 } 1290 VM.ID = &ID 1291 } 1292 case "name": 1293 if v != nil { 1294 var name string 1295 err = json.Unmarshal(*v, &name) 1296 if err != nil { 1297 return err 1298 } 1299 VM.Name = &name 1300 } 1301 case "type": 1302 if v != nil { 1303 var typeVar string 1304 err = json.Unmarshal(*v, &typeVar) 1305 if err != nil { 1306 return err 1307 } 1308 VM.Type = &typeVar 1309 } 1310 case "location": 1311 if v != nil { 1312 var location string 1313 err = json.Unmarshal(*v, &location) 1314 if err != nil { 1315 return err 1316 } 1317 VM.Location = &location 1318 } 1319 case "tags": 1320 if v != nil { 1321 var tags map[string]*string 1322 err = json.Unmarshal(*v, &tags) 1323 if err != nil { 1324 return err 1325 } 1326 VM.Tags = tags 1327 } 1328 } 1329 } 1330 1331 return nil 1332} 1333 1334// VirtualMachineAgentInstanceView the instance view of the VM Agent running on the virtual machine. 1335type VirtualMachineAgentInstanceView struct { 1336 // VMAgentVersion - The VM Agent full version. 1337 VMAgentVersion *string `json:"vmAgentVersion,omitempty"` 1338 // ExtensionHandlers - The virtual machine extension handler instance view. 1339 ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` 1340 // Statuses - The resource status information. 1341 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 1342} 1343 1344// VirtualMachineCaptureParameters capture Virtual Machine parameters. 1345type VirtualMachineCaptureParameters struct { 1346 // VhdPrefix - The captured virtual hard disk's name prefix. 1347 VhdPrefix *string `json:"vhdPrefix,omitempty"` 1348 // DestinationContainerName - The destination container name. 1349 DestinationContainerName *string `json:"destinationContainerName,omitempty"` 1350 // OverwriteVhds - Specifies whether to overwrite the destination virtual hard disk, in case of conflict. 1351 OverwriteVhds *bool `json:"overwriteVhds,omitempty"` 1352} 1353 1354// VirtualMachineCaptureResult resource Id. 1355type VirtualMachineCaptureResult struct { 1356 autorest.Response `json:"-"` 1357 *VirtualMachineCaptureResultProperties `json:"properties,omitempty"` 1358 // ID - Resource Id 1359 ID *string `json:"id,omitempty"` 1360} 1361 1362// MarshalJSON is the custom marshaler for VirtualMachineCaptureResult. 1363func (vmcr VirtualMachineCaptureResult) MarshalJSON() ([]byte, error) { 1364 objectMap := make(map[string]interface{}) 1365 if vmcr.VirtualMachineCaptureResultProperties != nil { 1366 objectMap["properties"] = vmcr.VirtualMachineCaptureResultProperties 1367 } 1368 if vmcr.ID != nil { 1369 objectMap["id"] = vmcr.ID 1370 } 1371 return json.Marshal(objectMap) 1372} 1373 1374// UnmarshalJSON is the custom unmarshaler for VirtualMachineCaptureResult struct. 1375func (vmcr *VirtualMachineCaptureResult) UnmarshalJSON(body []byte) error { 1376 var m map[string]*json.RawMessage 1377 err := json.Unmarshal(body, &m) 1378 if err != nil { 1379 return err 1380 } 1381 for k, v := range m { 1382 switch k { 1383 case "properties": 1384 if v != nil { 1385 var virtualMachineCaptureResultProperties VirtualMachineCaptureResultProperties 1386 err = json.Unmarshal(*v, &virtualMachineCaptureResultProperties) 1387 if err != nil { 1388 return err 1389 } 1390 vmcr.VirtualMachineCaptureResultProperties = &virtualMachineCaptureResultProperties 1391 } 1392 case "id": 1393 if v != nil { 1394 var ID string 1395 err = json.Unmarshal(*v, &ID) 1396 if err != nil { 1397 return err 1398 } 1399 vmcr.ID = &ID 1400 } 1401 } 1402 } 1403 1404 return nil 1405} 1406 1407// VirtualMachineCaptureResultProperties compute-specific operation properties, including output 1408type VirtualMachineCaptureResultProperties struct { 1409 // Output - Operation output data (raw JSON) 1410 Output interface{} `json:"output,omitempty"` 1411} 1412 1413// VirtualMachineExtension describes a Virtual Machine Extension. 1414type VirtualMachineExtension struct { 1415 autorest.Response `json:"-"` 1416 *VirtualMachineExtensionProperties `json:"properties,omitempty"` 1417 // ID - READ-ONLY; Resource Id 1418 ID *string `json:"id,omitempty"` 1419 // Name - READ-ONLY; Resource name 1420 Name *string `json:"name,omitempty"` 1421 // Type - READ-ONLY; Resource type 1422 Type *string `json:"type,omitempty"` 1423 // Location - Resource location 1424 Location *string `json:"location,omitempty"` 1425 // Tags - Resource tags 1426 Tags map[string]*string `json:"tags"` 1427} 1428 1429// MarshalJSON is the custom marshaler for VirtualMachineExtension. 1430func (vme VirtualMachineExtension) MarshalJSON() ([]byte, error) { 1431 objectMap := make(map[string]interface{}) 1432 if vme.VirtualMachineExtensionProperties != nil { 1433 objectMap["properties"] = vme.VirtualMachineExtensionProperties 1434 } 1435 if vme.Location != nil { 1436 objectMap["location"] = vme.Location 1437 } 1438 if vme.Tags != nil { 1439 objectMap["tags"] = vme.Tags 1440 } 1441 return json.Marshal(objectMap) 1442} 1443 1444// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtension struct. 1445func (vme *VirtualMachineExtension) UnmarshalJSON(body []byte) error { 1446 var m map[string]*json.RawMessage 1447 err := json.Unmarshal(body, &m) 1448 if err != nil { 1449 return err 1450 } 1451 for k, v := range m { 1452 switch k { 1453 case "properties": 1454 if v != nil { 1455 var virtualMachineExtensionProperties VirtualMachineExtensionProperties 1456 err = json.Unmarshal(*v, &virtualMachineExtensionProperties) 1457 if err != nil { 1458 return err 1459 } 1460 vme.VirtualMachineExtensionProperties = &virtualMachineExtensionProperties 1461 } 1462 case "id": 1463 if v != nil { 1464 var ID string 1465 err = json.Unmarshal(*v, &ID) 1466 if err != nil { 1467 return err 1468 } 1469 vme.ID = &ID 1470 } 1471 case "name": 1472 if v != nil { 1473 var name string 1474 err = json.Unmarshal(*v, &name) 1475 if err != nil { 1476 return err 1477 } 1478 vme.Name = &name 1479 } 1480 case "type": 1481 if v != nil { 1482 var typeVar string 1483 err = json.Unmarshal(*v, &typeVar) 1484 if err != nil { 1485 return err 1486 } 1487 vme.Type = &typeVar 1488 } 1489 case "location": 1490 if v != nil { 1491 var location string 1492 err = json.Unmarshal(*v, &location) 1493 if err != nil { 1494 return err 1495 } 1496 vme.Location = &location 1497 } 1498 case "tags": 1499 if v != nil { 1500 var tags map[string]*string 1501 err = json.Unmarshal(*v, &tags) 1502 if err != nil { 1503 return err 1504 } 1505 vme.Tags = tags 1506 } 1507 } 1508 } 1509 1510 return nil 1511} 1512 1513// VirtualMachineExtensionHandlerInstanceView the instance view of a virtual machine extension handler. 1514type VirtualMachineExtensionHandlerInstanceView struct { 1515 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 1516 Type *string `json:"type,omitempty"` 1517 // TypeHandlerVersion - Specifies the version of the script handler. 1518 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 1519 // Status - The extension handler status. 1520 Status *InstanceViewStatus `json:"status,omitempty"` 1521} 1522 1523// VirtualMachineExtensionImage describes a Virtual Machine Extension Image. 1524type VirtualMachineExtensionImage struct { 1525 autorest.Response `json:"-"` 1526 *VirtualMachineExtensionImageProperties `json:"properties,omitempty"` 1527 // ID - READ-ONLY; Resource Id 1528 ID *string `json:"id,omitempty"` 1529 // Name - READ-ONLY; Resource name 1530 Name *string `json:"name,omitempty"` 1531 // Type - READ-ONLY; Resource type 1532 Type *string `json:"type,omitempty"` 1533 // Location - Resource location 1534 Location *string `json:"location,omitempty"` 1535 // Tags - Resource tags 1536 Tags map[string]*string `json:"tags"` 1537} 1538 1539// MarshalJSON is the custom marshaler for VirtualMachineExtensionImage. 1540func (vmei VirtualMachineExtensionImage) MarshalJSON() ([]byte, error) { 1541 objectMap := make(map[string]interface{}) 1542 if vmei.VirtualMachineExtensionImageProperties != nil { 1543 objectMap["properties"] = vmei.VirtualMachineExtensionImageProperties 1544 } 1545 if vmei.Location != nil { 1546 objectMap["location"] = vmei.Location 1547 } 1548 if vmei.Tags != nil { 1549 objectMap["tags"] = vmei.Tags 1550 } 1551 return json.Marshal(objectMap) 1552} 1553 1554// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtensionImage struct. 1555func (vmei *VirtualMachineExtensionImage) UnmarshalJSON(body []byte) error { 1556 var m map[string]*json.RawMessage 1557 err := json.Unmarshal(body, &m) 1558 if err != nil { 1559 return err 1560 } 1561 for k, v := range m { 1562 switch k { 1563 case "properties": 1564 if v != nil { 1565 var virtualMachineExtensionImageProperties VirtualMachineExtensionImageProperties 1566 err = json.Unmarshal(*v, &virtualMachineExtensionImageProperties) 1567 if err != nil { 1568 return err 1569 } 1570 vmei.VirtualMachineExtensionImageProperties = &virtualMachineExtensionImageProperties 1571 } 1572 case "id": 1573 if v != nil { 1574 var ID string 1575 err = json.Unmarshal(*v, &ID) 1576 if err != nil { 1577 return err 1578 } 1579 vmei.ID = &ID 1580 } 1581 case "name": 1582 if v != nil { 1583 var name string 1584 err = json.Unmarshal(*v, &name) 1585 if err != nil { 1586 return err 1587 } 1588 vmei.Name = &name 1589 } 1590 case "type": 1591 if v != nil { 1592 var typeVar string 1593 err = json.Unmarshal(*v, &typeVar) 1594 if err != nil { 1595 return err 1596 } 1597 vmei.Type = &typeVar 1598 } 1599 case "location": 1600 if v != nil { 1601 var location string 1602 err = json.Unmarshal(*v, &location) 1603 if err != nil { 1604 return err 1605 } 1606 vmei.Location = &location 1607 } 1608 case "tags": 1609 if v != nil { 1610 var tags map[string]*string 1611 err = json.Unmarshal(*v, &tags) 1612 if err != nil { 1613 return err 1614 } 1615 vmei.Tags = tags 1616 } 1617 } 1618 } 1619 1620 return nil 1621} 1622 1623// VirtualMachineExtensionImageProperties describes the properties of a Virtual Machine Extension Image. 1624type VirtualMachineExtensionImageProperties struct { 1625 // OperatingSystem - The operating system this extension supports. 1626 OperatingSystem *string `json:"operatingSystem,omitempty"` 1627 // ComputeRole - The type of role (IaaS or PaaS) this extension supports. 1628 ComputeRole *string `json:"computeRole,omitempty"` 1629 // HandlerSchema - The schema defined by publisher, where extension consumers should provide settings in a matching schema. 1630 HandlerSchema *string `json:"handlerSchema,omitempty"` 1631 // 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. 1632 VMScaleSetEnabled *bool `json:"vmScaleSetEnabled,omitempty"` 1633 // SupportsMultipleExtensions - Whether the handler can support multiple extensions. 1634 SupportsMultipleExtensions *bool `json:"supportsMultipleExtensions,omitempty"` 1635} 1636 1637// VirtualMachineExtensionInstanceView the instance view of a virtual machine extension. 1638type VirtualMachineExtensionInstanceView struct { 1639 // Name - The virtual machine extension name. 1640 Name *string `json:"name,omitempty"` 1641 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 1642 Type *string `json:"type,omitempty"` 1643 // TypeHandlerVersion - Specifies the version of the script handler. 1644 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 1645 // Substatuses - The resource status information. 1646 Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` 1647 // Statuses - The resource status information. 1648 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 1649} 1650 1651// VirtualMachineExtensionProperties describes the properties of a Virtual Machine Extension. 1652type VirtualMachineExtensionProperties struct { 1653 // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. 1654 ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` 1655 // Publisher - The name of the extension handler publisher. 1656 Publisher *string `json:"publisher,omitempty"` 1657 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 1658 Type *string `json:"type,omitempty"` 1659 // TypeHandlerVersion - Specifies the version of the script handler. 1660 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 1661 // 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. 1662 AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` 1663 // Settings - Json formatted public settings for the extension. 1664 Settings interface{} `json:"settings,omitempty"` 1665 // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. 1666 ProtectedSettings interface{} `json:"protectedSettings,omitempty"` 1667 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 1668 ProvisioningState *string `json:"provisioningState,omitempty"` 1669 // InstanceView - The virtual machine extension instance view. 1670 InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` 1671} 1672 1673// VirtualMachineExtensionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of 1674// a long-running operation. 1675type VirtualMachineExtensionsCreateOrUpdateFuture struct { 1676 azure.Future 1677} 1678 1679// Result returns the result of the asynchronous operation. 1680// If the operation has not completed it will return an error. 1681func (future *VirtualMachineExtensionsCreateOrUpdateFuture) Result(client VirtualMachineExtensionsClient) (vme VirtualMachineExtension, err error) { 1682 var done bool 1683 done, err = future.DoneWithContext(context.Background(), client) 1684 if err != nil { 1685 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1686 return 1687 } 1688 if !done { 1689 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsCreateOrUpdateFuture") 1690 return 1691 } 1692 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1693 if vme.Response.Response, err = future.GetResult(sender); err == nil && vme.Response.Response.StatusCode != http.StatusNoContent { 1694 vme, err = client.CreateOrUpdateResponder(vme.Response.Response) 1695 if err != nil { 1696 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsCreateOrUpdateFuture", "Result", vme.Response.Response, "Failure responding to request") 1697 } 1698 } 1699 return 1700} 1701 1702// VirtualMachineExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a 1703// long-running operation. 1704type VirtualMachineExtensionsDeleteFuture struct { 1705 azure.Future 1706} 1707 1708// Result returns the result of the asynchronous operation. 1709// If the operation has not completed it will return an error. 1710func (future *VirtualMachineExtensionsDeleteFuture) Result(client VirtualMachineExtensionsClient) (osr OperationStatusResponse, err error) { 1711 var done bool 1712 done, err = future.DoneWithContext(context.Background(), client) 1713 if err != nil { 1714 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") 1715 return 1716 } 1717 if !done { 1718 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsDeleteFuture") 1719 return 1720 } 1721 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1722 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 1723 osr, err = client.DeleteResponder(osr.Response.Response) 1724 if err != nil { 1725 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") 1726 } 1727 } 1728 return 1729} 1730 1731// VirtualMachineExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a 1732// long-running operation. 1733type VirtualMachineExtensionsUpdateFuture struct { 1734 azure.Future 1735} 1736 1737// Result returns the result of the asynchronous operation. 1738// If the operation has not completed it will return an error. 1739func (future *VirtualMachineExtensionsUpdateFuture) Result(client VirtualMachineExtensionsClient) (vme VirtualMachineExtension, err error) { 1740 var done bool 1741 done, err = future.DoneWithContext(context.Background(), client) 1742 if err != nil { 1743 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") 1744 return 1745 } 1746 if !done { 1747 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineExtensionsUpdateFuture") 1748 return 1749 } 1750 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1751 if vme.Response.Response, err = future.GetResult(sender); err == nil && vme.Response.Response.StatusCode != http.StatusNoContent { 1752 vme, err = client.UpdateResponder(vme.Response.Response) 1753 if err != nil { 1754 err = autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionsUpdateFuture", "Result", vme.Response.Response, "Failure responding to request") 1755 } 1756 } 1757 return 1758} 1759 1760// VirtualMachineExtensionUpdate describes a Virtual Machine Extension. 1761type VirtualMachineExtensionUpdate struct { 1762 *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` 1763 // Tags - Resource tags 1764 Tags map[string]*string `json:"tags"` 1765} 1766 1767// MarshalJSON is the custom marshaler for VirtualMachineExtensionUpdate. 1768func (vmeu VirtualMachineExtensionUpdate) MarshalJSON() ([]byte, error) { 1769 objectMap := make(map[string]interface{}) 1770 if vmeu.VirtualMachineExtensionUpdateProperties != nil { 1771 objectMap["properties"] = vmeu.VirtualMachineExtensionUpdateProperties 1772 } 1773 if vmeu.Tags != nil { 1774 objectMap["tags"] = vmeu.Tags 1775 } 1776 return json.Marshal(objectMap) 1777} 1778 1779// UnmarshalJSON is the custom unmarshaler for VirtualMachineExtensionUpdate struct. 1780func (vmeu *VirtualMachineExtensionUpdate) UnmarshalJSON(body []byte) error { 1781 var m map[string]*json.RawMessage 1782 err := json.Unmarshal(body, &m) 1783 if err != nil { 1784 return err 1785 } 1786 for k, v := range m { 1787 switch k { 1788 case "properties": 1789 if v != nil { 1790 var virtualMachineExtensionUpdateProperties VirtualMachineExtensionUpdateProperties 1791 err = json.Unmarshal(*v, &virtualMachineExtensionUpdateProperties) 1792 if err != nil { 1793 return err 1794 } 1795 vmeu.VirtualMachineExtensionUpdateProperties = &virtualMachineExtensionUpdateProperties 1796 } 1797 case "tags": 1798 if v != nil { 1799 var tags map[string]*string 1800 err = json.Unmarshal(*v, &tags) 1801 if err != nil { 1802 return err 1803 } 1804 vmeu.Tags = tags 1805 } 1806 } 1807 } 1808 1809 return nil 1810} 1811 1812// VirtualMachineExtensionUpdateProperties describes the properties of a Virtual Machine Extension. 1813type VirtualMachineExtensionUpdateProperties struct { 1814 // ForceUpdateTag - How the extension handler should be forced to update even if the extension configuration has not changed. 1815 ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` 1816 // Publisher - The name of the extension handler publisher. 1817 Publisher *string `json:"publisher,omitempty"` 1818 // Type - Specifies the type of the extension; an example is "CustomScriptExtension". 1819 Type *string `json:"type,omitempty"` 1820 // TypeHandlerVersion - Specifies the version of the script handler. 1821 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 1822 // 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. 1823 AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` 1824 // Settings - Json formatted public settings for the extension. 1825 Settings interface{} `json:"settings,omitempty"` 1826 // ProtectedSettings - The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. 1827 ProtectedSettings interface{} `json:"protectedSettings,omitempty"` 1828} 1829 1830// VirtualMachineImage describes a Virtual Machine Image. 1831type VirtualMachineImage struct { 1832 autorest.Response `json:"-"` 1833 *VirtualMachineImageProperties `json:"properties,omitempty"` 1834 // Name - The name of the resource. 1835 Name *string `json:"name,omitempty"` 1836 // Location - The supported Azure location of the resource. 1837 Location *string `json:"location,omitempty"` 1838 // 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). 1839 Tags map[string]*string `json:"tags"` 1840 // ID - Resource Id 1841 ID *string `json:"id,omitempty"` 1842} 1843 1844// MarshalJSON is the custom marshaler for VirtualMachineImage. 1845func (vmi VirtualMachineImage) MarshalJSON() ([]byte, error) { 1846 objectMap := make(map[string]interface{}) 1847 if vmi.VirtualMachineImageProperties != nil { 1848 objectMap["properties"] = vmi.VirtualMachineImageProperties 1849 } 1850 if vmi.Name != nil { 1851 objectMap["name"] = vmi.Name 1852 } 1853 if vmi.Location != nil { 1854 objectMap["location"] = vmi.Location 1855 } 1856 if vmi.Tags != nil { 1857 objectMap["tags"] = vmi.Tags 1858 } 1859 if vmi.ID != nil { 1860 objectMap["id"] = vmi.ID 1861 } 1862 return json.Marshal(objectMap) 1863} 1864 1865// UnmarshalJSON is the custom unmarshaler for VirtualMachineImage struct. 1866func (vmi *VirtualMachineImage) UnmarshalJSON(body []byte) error { 1867 var m map[string]*json.RawMessage 1868 err := json.Unmarshal(body, &m) 1869 if err != nil { 1870 return err 1871 } 1872 for k, v := range m { 1873 switch k { 1874 case "properties": 1875 if v != nil { 1876 var virtualMachineImageProperties VirtualMachineImageProperties 1877 err = json.Unmarshal(*v, &virtualMachineImageProperties) 1878 if err != nil { 1879 return err 1880 } 1881 vmi.VirtualMachineImageProperties = &virtualMachineImageProperties 1882 } 1883 case "name": 1884 if v != nil { 1885 var name string 1886 err = json.Unmarshal(*v, &name) 1887 if err != nil { 1888 return err 1889 } 1890 vmi.Name = &name 1891 } 1892 case "location": 1893 if v != nil { 1894 var location string 1895 err = json.Unmarshal(*v, &location) 1896 if err != nil { 1897 return err 1898 } 1899 vmi.Location = &location 1900 } 1901 case "tags": 1902 if v != nil { 1903 var tags map[string]*string 1904 err = json.Unmarshal(*v, &tags) 1905 if err != nil { 1906 return err 1907 } 1908 vmi.Tags = tags 1909 } 1910 case "id": 1911 if v != nil { 1912 var ID string 1913 err = json.Unmarshal(*v, &ID) 1914 if err != nil { 1915 return err 1916 } 1917 vmi.ID = &ID 1918 } 1919 } 1920 } 1921 1922 return nil 1923} 1924 1925// VirtualMachineImageProperties describes the properties of a Virtual Machine Image. 1926type VirtualMachineImageProperties struct { 1927 Plan *PurchasePlan `json:"plan,omitempty"` 1928 OsDiskImage *OSDiskImage `json:"osDiskImage,omitempty"` 1929 DataDiskImages *[]DataDiskImage `json:"dataDiskImages,omitempty"` 1930} 1931 1932// VirtualMachineImageResource virtual machine image resource information. 1933type VirtualMachineImageResource struct { 1934 // Name - The name of the resource. 1935 Name *string `json:"name,omitempty"` 1936 // Location - The supported Azure location of the resource. 1937 Location *string `json:"location,omitempty"` 1938 // 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). 1939 Tags map[string]*string `json:"tags"` 1940 // ID - Resource Id 1941 ID *string `json:"id,omitempty"` 1942} 1943 1944// MarshalJSON is the custom marshaler for VirtualMachineImageResource. 1945func (vmir VirtualMachineImageResource) MarshalJSON() ([]byte, error) { 1946 objectMap := make(map[string]interface{}) 1947 if vmir.Name != nil { 1948 objectMap["name"] = vmir.Name 1949 } 1950 if vmir.Location != nil { 1951 objectMap["location"] = vmir.Location 1952 } 1953 if vmir.Tags != nil { 1954 objectMap["tags"] = vmir.Tags 1955 } 1956 if vmir.ID != nil { 1957 objectMap["id"] = vmir.ID 1958 } 1959 return json.Marshal(objectMap) 1960} 1961 1962// VirtualMachineInstanceView the instance view of a virtual machine. 1963type VirtualMachineInstanceView struct { 1964 // PlatformUpdateDomain - Specifies the update domain of the virtual machine. 1965 PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` 1966 // PlatformFaultDomain - Specifies the fault domain of the virtual machine. 1967 PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` 1968 // RdpThumbPrint - The Remote desktop certificate thumbprint. 1969 RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` 1970 // VMAgent - The VM Agent running on the virtual machine. 1971 VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` 1972 // Disks - The virtual machine disk information. 1973 Disks *[]DiskInstanceView `json:"disks,omitempty"` 1974 // Extensions - The extensions information. 1975 Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` 1976 // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. 1977 BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` 1978 // Statuses - The resource status information. 1979 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 1980} 1981 1982// VirtualMachineListResult the List Virtual Machine operation response. 1983type VirtualMachineListResult struct { 1984 autorest.Response `json:"-"` 1985 // Value - The list of virtual machines. 1986 Value *[]VirtualMachine `json:"value,omitempty"` 1987 // NextLink - The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch the next page of Virtual Machines. 1988 NextLink *string `json:"nextLink,omitempty"` 1989} 1990 1991// VirtualMachineListResultIterator provides access to a complete listing of VirtualMachine values. 1992type VirtualMachineListResultIterator struct { 1993 i int 1994 page VirtualMachineListResultPage 1995} 1996 1997// NextWithContext advances to the next value. If there was an error making 1998// the request the iterator does not advance and the error is returned. 1999func (iter *VirtualMachineListResultIterator) NextWithContext(ctx context.Context) (err error) { 2000 if tracing.IsEnabled() { 2001 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineListResultIterator.NextWithContext") 2002 defer func() { 2003 sc := -1 2004 if iter.Response().Response.Response != nil { 2005 sc = iter.Response().Response.Response.StatusCode 2006 } 2007 tracing.EndSpan(ctx, sc, err) 2008 }() 2009 } 2010 iter.i++ 2011 if iter.i < len(iter.page.Values()) { 2012 return nil 2013 } 2014 err = iter.page.NextWithContext(ctx) 2015 if err != nil { 2016 iter.i-- 2017 return err 2018 } 2019 iter.i = 0 2020 return nil 2021} 2022 2023// Next advances to the next value. If there was an error making 2024// the request the iterator does not advance and the error is returned. 2025// Deprecated: Use NextWithContext() instead. 2026func (iter *VirtualMachineListResultIterator) Next() error { 2027 return iter.NextWithContext(context.Background()) 2028} 2029 2030// NotDone returns true if the enumeration should be started or is not yet complete. 2031func (iter VirtualMachineListResultIterator) NotDone() bool { 2032 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2033} 2034 2035// Response returns the raw server response from the last page request. 2036func (iter VirtualMachineListResultIterator) Response() VirtualMachineListResult { 2037 return iter.page.Response() 2038} 2039 2040// Value returns the current value or a zero-initialized value if the 2041// iterator has advanced beyond the end of the collection. 2042func (iter VirtualMachineListResultIterator) Value() VirtualMachine { 2043 if !iter.page.NotDone() { 2044 return VirtualMachine{} 2045 } 2046 return iter.page.Values()[iter.i] 2047} 2048 2049// Creates a new instance of the VirtualMachineListResultIterator type. 2050func NewVirtualMachineListResultIterator(page VirtualMachineListResultPage) VirtualMachineListResultIterator { 2051 return VirtualMachineListResultIterator{page: page} 2052} 2053 2054// IsEmpty returns true if the ListResult contains no values. 2055func (vmlr VirtualMachineListResult) IsEmpty() bool { 2056 return vmlr.Value == nil || len(*vmlr.Value) == 0 2057} 2058 2059// virtualMachineListResultPreparer prepares a request to retrieve the next set of results. 2060// It returns nil if no more results exist. 2061func (vmlr VirtualMachineListResult) virtualMachineListResultPreparer(ctx context.Context) (*http.Request, error) { 2062 if vmlr.NextLink == nil || len(to.String(vmlr.NextLink)) < 1 { 2063 return nil, nil 2064 } 2065 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2066 autorest.AsJSON(), 2067 autorest.AsGet(), 2068 autorest.WithBaseURL(to.String(vmlr.NextLink))) 2069} 2070 2071// VirtualMachineListResultPage contains a page of VirtualMachine values. 2072type VirtualMachineListResultPage struct { 2073 fn func(context.Context, VirtualMachineListResult) (VirtualMachineListResult, error) 2074 vmlr VirtualMachineListResult 2075} 2076 2077// NextWithContext advances to the next page of values. If there was an error making 2078// the request the page does not advance and the error is returned. 2079func (page *VirtualMachineListResultPage) NextWithContext(ctx context.Context) (err error) { 2080 if tracing.IsEnabled() { 2081 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineListResultPage.NextWithContext") 2082 defer func() { 2083 sc := -1 2084 if page.Response().Response.Response != nil { 2085 sc = page.Response().Response.Response.StatusCode 2086 } 2087 tracing.EndSpan(ctx, sc, err) 2088 }() 2089 } 2090 next, err := page.fn(ctx, page.vmlr) 2091 if err != nil { 2092 return err 2093 } 2094 page.vmlr = next 2095 return nil 2096} 2097 2098// Next advances to the next page of values. If there was an error making 2099// the request the page does not advance and the error is returned. 2100// Deprecated: Use NextWithContext() instead. 2101func (page *VirtualMachineListResultPage) Next() error { 2102 return page.NextWithContext(context.Background()) 2103} 2104 2105// NotDone returns true if the page enumeration should be started or is not yet complete. 2106func (page VirtualMachineListResultPage) NotDone() bool { 2107 return !page.vmlr.IsEmpty() 2108} 2109 2110// Response returns the raw server response from the last page request. 2111func (page VirtualMachineListResultPage) Response() VirtualMachineListResult { 2112 return page.vmlr 2113} 2114 2115// Values returns the slice of values for the current page or nil if there are no values. 2116func (page VirtualMachineListResultPage) Values() []VirtualMachine { 2117 if page.vmlr.IsEmpty() { 2118 return nil 2119 } 2120 return *page.vmlr.Value 2121} 2122 2123// Creates a new instance of the VirtualMachineListResultPage type. 2124func NewVirtualMachineListResultPage(getNextPage func(context.Context, VirtualMachineListResult) (VirtualMachineListResult, error)) VirtualMachineListResultPage { 2125 return VirtualMachineListResultPage{fn: getNextPage} 2126} 2127 2128// VirtualMachineProperties describes the properties of a Virtual Machine. 2129type VirtualMachineProperties struct { 2130 // HardwareProfile - Specifies the hardware settings for the virtual machine. 2131 HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` 2132 // StorageProfile - Specifies the storage settings for the virtual machine disks. 2133 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 2134 // OsProfile - Specifies the operating system settings for the virtual machine. 2135 OsProfile *OSProfile `json:"osProfile,omitempty"` 2136 // NetworkProfile - Specifies the network interfaces of the virtual machine. 2137 NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` 2138 // DiagnosticsProfile - Specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. 2139 DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` 2140 // AvailabilitySet - Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. 2141 AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` 2142 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 2143 ProvisioningState *string `json:"provisioningState,omitempty"` 2144 // InstanceView - READ-ONLY; The virtual machine instance view. 2145 InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"` 2146 // 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 2147 LicenseType *string `json:"licenseType,omitempty"` 2148} 2149 2150// VirtualMachineScaleSet describes a Virtual Machine Scale Set. 2151type VirtualMachineScaleSet struct { 2152 autorest.Response `json:"-"` 2153 // Sku - The virtual machine scale set sku. 2154 Sku *Sku `json:"sku,omitempty"` 2155 *VirtualMachineScaleSetProperties `json:"properties,omitempty"` 2156 // ID - READ-ONLY; Resource Id 2157 ID *string `json:"id,omitempty"` 2158 // Name - READ-ONLY; Resource name 2159 Name *string `json:"name,omitempty"` 2160 // Type - READ-ONLY; Resource type 2161 Type *string `json:"type,omitempty"` 2162 // Location - Resource location 2163 Location *string `json:"location,omitempty"` 2164 // Tags - Resource tags 2165 Tags map[string]*string `json:"tags"` 2166} 2167 2168// MarshalJSON is the custom marshaler for VirtualMachineScaleSet. 2169func (vmss VirtualMachineScaleSet) MarshalJSON() ([]byte, error) { 2170 objectMap := make(map[string]interface{}) 2171 if vmss.Sku != nil { 2172 objectMap["sku"] = vmss.Sku 2173 } 2174 if vmss.VirtualMachineScaleSetProperties != nil { 2175 objectMap["properties"] = vmss.VirtualMachineScaleSetProperties 2176 } 2177 if vmss.Location != nil { 2178 objectMap["location"] = vmss.Location 2179 } 2180 if vmss.Tags != nil { 2181 objectMap["tags"] = vmss.Tags 2182 } 2183 return json.Marshal(objectMap) 2184} 2185 2186// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSet struct. 2187func (vmss *VirtualMachineScaleSet) UnmarshalJSON(body []byte) error { 2188 var m map[string]*json.RawMessage 2189 err := json.Unmarshal(body, &m) 2190 if err != nil { 2191 return err 2192 } 2193 for k, v := range m { 2194 switch k { 2195 case "sku": 2196 if v != nil { 2197 var sku Sku 2198 err = json.Unmarshal(*v, &sku) 2199 if err != nil { 2200 return err 2201 } 2202 vmss.Sku = &sku 2203 } 2204 case "properties": 2205 if v != nil { 2206 var virtualMachineScaleSetProperties VirtualMachineScaleSetProperties 2207 err = json.Unmarshal(*v, &virtualMachineScaleSetProperties) 2208 if err != nil { 2209 return err 2210 } 2211 vmss.VirtualMachineScaleSetProperties = &virtualMachineScaleSetProperties 2212 } 2213 case "id": 2214 if v != nil { 2215 var ID string 2216 err = json.Unmarshal(*v, &ID) 2217 if err != nil { 2218 return err 2219 } 2220 vmss.ID = &ID 2221 } 2222 case "name": 2223 if v != nil { 2224 var name string 2225 err = json.Unmarshal(*v, &name) 2226 if err != nil { 2227 return err 2228 } 2229 vmss.Name = &name 2230 } 2231 case "type": 2232 if v != nil { 2233 var typeVar string 2234 err = json.Unmarshal(*v, &typeVar) 2235 if err != nil { 2236 return err 2237 } 2238 vmss.Type = &typeVar 2239 } 2240 case "location": 2241 if v != nil { 2242 var location string 2243 err = json.Unmarshal(*v, &location) 2244 if err != nil { 2245 return err 2246 } 2247 vmss.Location = &location 2248 } 2249 case "tags": 2250 if v != nil { 2251 var tags map[string]*string 2252 err = json.Unmarshal(*v, &tags) 2253 if err != nil { 2254 return err 2255 } 2256 vmss.Tags = tags 2257 } 2258 } 2259 } 2260 2261 return nil 2262} 2263 2264// VirtualMachineScaleSetExtension describes a Virtual Machine Scale Set Extension. 2265type VirtualMachineScaleSetExtension struct { 2266 // Name - The name of the extension. 2267 Name *string `json:"name,omitempty"` 2268 *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` 2269 // ID - Resource Id 2270 ID *string `json:"id,omitempty"` 2271} 2272 2273// MarshalJSON is the custom marshaler for VirtualMachineScaleSetExtension. 2274func (vmsse VirtualMachineScaleSetExtension) MarshalJSON() ([]byte, error) { 2275 objectMap := make(map[string]interface{}) 2276 if vmsse.Name != nil { 2277 objectMap["name"] = vmsse.Name 2278 } 2279 if vmsse.VirtualMachineScaleSetExtensionProperties != nil { 2280 objectMap["properties"] = vmsse.VirtualMachineScaleSetExtensionProperties 2281 } 2282 if vmsse.ID != nil { 2283 objectMap["id"] = vmsse.ID 2284 } 2285 return json.Marshal(objectMap) 2286} 2287 2288// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetExtension struct. 2289func (vmsse *VirtualMachineScaleSetExtension) UnmarshalJSON(body []byte) error { 2290 var m map[string]*json.RawMessage 2291 err := json.Unmarshal(body, &m) 2292 if err != nil { 2293 return err 2294 } 2295 for k, v := range m { 2296 switch k { 2297 case "name": 2298 if v != nil { 2299 var name string 2300 err = json.Unmarshal(*v, &name) 2301 if err != nil { 2302 return err 2303 } 2304 vmsse.Name = &name 2305 } 2306 case "properties": 2307 if v != nil { 2308 var virtualMachineScaleSetExtensionProperties VirtualMachineScaleSetExtensionProperties 2309 err = json.Unmarshal(*v, &virtualMachineScaleSetExtensionProperties) 2310 if err != nil { 2311 return err 2312 } 2313 vmsse.VirtualMachineScaleSetExtensionProperties = &virtualMachineScaleSetExtensionProperties 2314 } 2315 case "id": 2316 if v != nil { 2317 var ID string 2318 err = json.Unmarshal(*v, &ID) 2319 if err != nil { 2320 return err 2321 } 2322 vmsse.ID = &ID 2323 } 2324 } 2325 } 2326 2327 return nil 2328} 2329 2330// VirtualMachineScaleSetExtensionProfile describes a virtual machine scale set extension profile. 2331type VirtualMachineScaleSetExtensionProfile struct { 2332 // Extensions - The virtual machine scale set child extension resources. 2333 Extensions *[]VirtualMachineScaleSetExtension `json:"extensions,omitempty"` 2334} 2335 2336// VirtualMachineScaleSetExtensionProperties describes the properties of a Virtual Machine Scale Set 2337// Extension. 2338type VirtualMachineScaleSetExtensionProperties struct { 2339 // Publisher - The name of the extension handler publisher. 2340 Publisher *string `json:"publisher,omitempty"` 2341 // Type - The type of the extension handler. 2342 Type *string `json:"type,omitempty"` 2343 // TypeHandlerVersion - The type version of the extension handler. 2344 TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` 2345 // AutoUpgradeMinorVersion - Whether the extension handler should be automatically upgraded across minor versions. 2346 AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` 2347 // Settings - Json formatted public settings for the extension. 2348 Settings interface{} `json:"settings,omitempty"` 2349 // ProtectedSettings - Json formatted protected settings for the extension. 2350 ProtectedSettings interface{} `json:"protectedSettings,omitempty"` 2351 // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. 2352 ProvisioningState *string `json:"provisioningState,omitempty"` 2353} 2354 2355// VirtualMachineScaleSetInstanceView the instance view of a virtual machine scale set. 2356type VirtualMachineScaleSetInstanceView struct { 2357 autorest.Response `json:"-"` 2358 // VirtualMachine - READ-ONLY; The instance view status summary for the virtual machine scale set. 2359 VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary `json:"virtualMachine,omitempty"` 2360 // Extensions - READ-ONLY; The extensions information. 2361 Extensions *[]VirtualMachineScaleSetVMExtensionsSummary `json:"extensions,omitempty"` 2362 // Statuses - The resource status information. 2363 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 2364} 2365 2366// VirtualMachineScaleSetInstanceViewStatusesSummary instance view statuses summary for virtual machines of 2367// a virtual machine scale set. 2368type VirtualMachineScaleSetInstanceViewStatusesSummary struct { 2369 // StatusesSummary - READ-ONLY; The extensions information. 2370 StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` 2371} 2372 2373// VirtualMachineScaleSetIPConfiguration describes a virtual machine scale set network profile's IP 2374// configuration. 2375type VirtualMachineScaleSetIPConfiguration struct { 2376 // Name - The IP configuration name. 2377 Name *string `json:"name,omitempty"` 2378 *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` 2379 // ID - Resource Id 2380 ID *string `json:"id,omitempty"` 2381} 2382 2383// MarshalJSON is the custom marshaler for VirtualMachineScaleSetIPConfiguration. 2384func (vmssic VirtualMachineScaleSetIPConfiguration) MarshalJSON() ([]byte, error) { 2385 objectMap := make(map[string]interface{}) 2386 if vmssic.Name != nil { 2387 objectMap["name"] = vmssic.Name 2388 } 2389 if vmssic.VirtualMachineScaleSetIPConfigurationProperties != nil { 2390 objectMap["properties"] = vmssic.VirtualMachineScaleSetIPConfigurationProperties 2391 } 2392 if vmssic.ID != nil { 2393 objectMap["id"] = vmssic.ID 2394 } 2395 return json.Marshal(objectMap) 2396} 2397 2398// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetIPConfiguration struct. 2399func (vmssic *VirtualMachineScaleSetIPConfiguration) UnmarshalJSON(body []byte) error { 2400 var m map[string]*json.RawMessage 2401 err := json.Unmarshal(body, &m) 2402 if err != nil { 2403 return err 2404 } 2405 for k, v := range m { 2406 switch k { 2407 case "name": 2408 if v != nil { 2409 var name string 2410 err = json.Unmarshal(*v, &name) 2411 if err != nil { 2412 return err 2413 } 2414 vmssic.Name = &name 2415 } 2416 case "properties": 2417 if v != nil { 2418 var virtualMachineScaleSetIPConfigurationProperties VirtualMachineScaleSetIPConfigurationProperties 2419 err = json.Unmarshal(*v, &virtualMachineScaleSetIPConfigurationProperties) 2420 if err != nil { 2421 return err 2422 } 2423 vmssic.VirtualMachineScaleSetIPConfigurationProperties = &virtualMachineScaleSetIPConfigurationProperties 2424 } 2425 case "id": 2426 if v != nil { 2427 var ID string 2428 err = json.Unmarshal(*v, &ID) 2429 if err != nil { 2430 return err 2431 } 2432 vmssic.ID = &ID 2433 } 2434 } 2435 } 2436 2437 return nil 2438} 2439 2440// VirtualMachineScaleSetIPConfigurationProperties describes a virtual machine scale set network profile's 2441// IP configuration properties. 2442type VirtualMachineScaleSetIPConfigurationProperties struct { 2443 // Subnet - The subnet. 2444 Subnet *APIEntityReference `json:"subnet,omitempty"` 2445 // LoadBalancerBackendAddressPools - The load balancer backend address pools. 2446 LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` 2447 // LoadBalancerInboundNatPools - The load balancer inbound nat pools. 2448 LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` 2449} 2450 2451// VirtualMachineScaleSetListResult the List Virtual Machine operation response. 2452type VirtualMachineScaleSetListResult struct { 2453 autorest.Response `json:"-"` 2454 // Value - The list of virtual machine scale sets. 2455 Value *[]VirtualMachineScaleSet `json:"value,omitempty"` 2456 // 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. 2457 NextLink *string `json:"nextLink,omitempty"` 2458} 2459 2460// VirtualMachineScaleSetListResultIterator provides access to a complete listing of VirtualMachineScaleSet 2461// values. 2462type VirtualMachineScaleSetListResultIterator struct { 2463 i int 2464 page VirtualMachineScaleSetListResultPage 2465} 2466 2467// NextWithContext advances to the next value. If there was an error making 2468// the request the iterator does not advance and the error is returned. 2469func (iter *VirtualMachineScaleSetListResultIterator) NextWithContext(ctx context.Context) (err error) { 2470 if tracing.IsEnabled() { 2471 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListResultIterator.NextWithContext") 2472 defer func() { 2473 sc := -1 2474 if iter.Response().Response.Response != nil { 2475 sc = iter.Response().Response.Response.StatusCode 2476 } 2477 tracing.EndSpan(ctx, sc, err) 2478 }() 2479 } 2480 iter.i++ 2481 if iter.i < len(iter.page.Values()) { 2482 return nil 2483 } 2484 err = iter.page.NextWithContext(ctx) 2485 if err != nil { 2486 iter.i-- 2487 return err 2488 } 2489 iter.i = 0 2490 return nil 2491} 2492 2493// Next advances to the next value. If there was an error making 2494// the request the iterator does not advance and the error is returned. 2495// Deprecated: Use NextWithContext() instead. 2496func (iter *VirtualMachineScaleSetListResultIterator) Next() error { 2497 return iter.NextWithContext(context.Background()) 2498} 2499 2500// NotDone returns true if the enumeration should be started or is not yet complete. 2501func (iter VirtualMachineScaleSetListResultIterator) NotDone() bool { 2502 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2503} 2504 2505// Response returns the raw server response from the last page request. 2506func (iter VirtualMachineScaleSetListResultIterator) Response() VirtualMachineScaleSetListResult { 2507 return iter.page.Response() 2508} 2509 2510// Value returns the current value or a zero-initialized value if the 2511// iterator has advanced beyond the end of the collection. 2512func (iter VirtualMachineScaleSetListResultIterator) Value() VirtualMachineScaleSet { 2513 if !iter.page.NotDone() { 2514 return VirtualMachineScaleSet{} 2515 } 2516 return iter.page.Values()[iter.i] 2517} 2518 2519// Creates a new instance of the VirtualMachineScaleSetListResultIterator type. 2520func NewVirtualMachineScaleSetListResultIterator(page VirtualMachineScaleSetListResultPage) VirtualMachineScaleSetListResultIterator { 2521 return VirtualMachineScaleSetListResultIterator{page: page} 2522} 2523 2524// IsEmpty returns true if the ListResult contains no values. 2525func (vmsslr VirtualMachineScaleSetListResult) IsEmpty() bool { 2526 return vmsslr.Value == nil || len(*vmsslr.Value) == 0 2527} 2528 2529// virtualMachineScaleSetListResultPreparer prepares a request to retrieve the next set of results. 2530// It returns nil if no more results exist. 2531func (vmsslr VirtualMachineScaleSetListResult) virtualMachineScaleSetListResultPreparer(ctx context.Context) (*http.Request, error) { 2532 if vmsslr.NextLink == nil || len(to.String(vmsslr.NextLink)) < 1 { 2533 return nil, nil 2534 } 2535 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2536 autorest.AsJSON(), 2537 autorest.AsGet(), 2538 autorest.WithBaseURL(to.String(vmsslr.NextLink))) 2539} 2540 2541// VirtualMachineScaleSetListResultPage contains a page of VirtualMachineScaleSet values. 2542type VirtualMachineScaleSetListResultPage struct { 2543 fn func(context.Context, VirtualMachineScaleSetListResult) (VirtualMachineScaleSetListResult, error) 2544 vmsslr VirtualMachineScaleSetListResult 2545} 2546 2547// NextWithContext advances to the next page of values. If there was an error making 2548// the request the page does not advance and the error is returned. 2549func (page *VirtualMachineScaleSetListResultPage) NextWithContext(ctx context.Context) (err error) { 2550 if tracing.IsEnabled() { 2551 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListResultPage.NextWithContext") 2552 defer func() { 2553 sc := -1 2554 if page.Response().Response.Response != nil { 2555 sc = page.Response().Response.Response.StatusCode 2556 } 2557 tracing.EndSpan(ctx, sc, err) 2558 }() 2559 } 2560 next, err := page.fn(ctx, page.vmsslr) 2561 if err != nil { 2562 return err 2563 } 2564 page.vmsslr = next 2565 return nil 2566} 2567 2568// Next advances to the next page of values. If there was an error making 2569// the request the page does not advance and the error is returned. 2570// Deprecated: Use NextWithContext() instead. 2571func (page *VirtualMachineScaleSetListResultPage) Next() error { 2572 return page.NextWithContext(context.Background()) 2573} 2574 2575// NotDone returns true if the page enumeration should be started or is not yet complete. 2576func (page VirtualMachineScaleSetListResultPage) NotDone() bool { 2577 return !page.vmsslr.IsEmpty() 2578} 2579 2580// Response returns the raw server response from the last page request. 2581func (page VirtualMachineScaleSetListResultPage) Response() VirtualMachineScaleSetListResult { 2582 return page.vmsslr 2583} 2584 2585// Values returns the slice of values for the current page or nil if there are no values. 2586func (page VirtualMachineScaleSetListResultPage) Values() []VirtualMachineScaleSet { 2587 if page.vmsslr.IsEmpty() { 2588 return nil 2589 } 2590 return *page.vmsslr.Value 2591} 2592 2593// Creates a new instance of the VirtualMachineScaleSetListResultPage type. 2594func NewVirtualMachineScaleSetListResultPage(getNextPage func(context.Context, VirtualMachineScaleSetListResult) (VirtualMachineScaleSetListResult, error)) VirtualMachineScaleSetListResultPage { 2595 return VirtualMachineScaleSetListResultPage{fn: getNextPage} 2596} 2597 2598// VirtualMachineScaleSetListSkusResult the Virtual Machine Scale Set List Skus operation response. 2599type VirtualMachineScaleSetListSkusResult struct { 2600 autorest.Response `json:"-"` 2601 // Value - READ-ONLY; The list of skus available for the virtual machine scale set. 2602 Value *[]VirtualMachineScaleSetSku `json:"value,omitempty"` 2603 // NextLink - The URI to fetch the next page of skus available for the virtual machine scale set. Call ListNext() with this to fetch the next page of skus available for the virtual machine scale set. 2604 NextLink *string `json:"nextLink,omitempty"` 2605} 2606 2607// VirtualMachineScaleSetListSkusResultIterator provides access to a complete listing of 2608// VirtualMachineScaleSetSku values. 2609type VirtualMachineScaleSetListSkusResultIterator struct { 2610 i int 2611 page VirtualMachineScaleSetListSkusResultPage 2612} 2613 2614// NextWithContext advances to the next value. If there was an error making 2615// the request the iterator does not advance and the error is returned. 2616func (iter *VirtualMachineScaleSetListSkusResultIterator) NextWithContext(ctx context.Context) (err error) { 2617 if tracing.IsEnabled() { 2618 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListSkusResultIterator.NextWithContext") 2619 defer func() { 2620 sc := -1 2621 if iter.Response().Response.Response != nil { 2622 sc = iter.Response().Response.Response.StatusCode 2623 } 2624 tracing.EndSpan(ctx, sc, err) 2625 }() 2626 } 2627 iter.i++ 2628 if iter.i < len(iter.page.Values()) { 2629 return nil 2630 } 2631 err = iter.page.NextWithContext(ctx) 2632 if err != nil { 2633 iter.i-- 2634 return err 2635 } 2636 iter.i = 0 2637 return nil 2638} 2639 2640// Next advances to the next value. If there was an error making 2641// the request the iterator does not advance and the error is returned. 2642// Deprecated: Use NextWithContext() instead. 2643func (iter *VirtualMachineScaleSetListSkusResultIterator) Next() error { 2644 return iter.NextWithContext(context.Background()) 2645} 2646 2647// NotDone returns true if the enumeration should be started or is not yet complete. 2648func (iter VirtualMachineScaleSetListSkusResultIterator) NotDone() bool { 2649 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2650} 2651 2652// Response returns the raw server response from the last page request. 2653func (iter VirtualMachineScaleSetListSkusResultIterator) Response() VirtualMachineScaleSetListSkusResult { 2654 return iter.page.Response() 2655} 2656 2657// Value returns the current value or a zero-initialized value if the 2658// iterator has advanced beyond the end of the collection. 2659func (iter VirtualMachineScaleSetListSkusResultIterator) Value() VirtualMachineScaleSetSku { 2660 if !iter.page.NotDone() { 2661 return VirtualMachineScaleSetSku{} 2662 } 2663 return iter.page.Values()[iter.i] 2664} 2665 2666// Creates a new instance of the VirtualMachineScaleSetListSkusResultIterator type. 2667func NewVirtualMachineScaleSetListSkusResultIterator(page VirtualMachineScaleSetListSkusResultPage) VirtualMachineScaleSetListSkusResultIterator { 2668 return VirtualMachineScaleSetListSkusResultIterator{page: page} 2669} 2670 2671// IsEmpty returns true if the ListResult contains no values. 2672func (vmsslsr VirtualMachineScaleSetListSkusResult) IsEmpty() bool { 2673 return vmsslsr.Value == nil || len(*vmsslsr.Value) == 0 2674} 2675 2676// virtualMachineScaleSetListSkusResultPreparer prepares a request to retrieve the next set of results. 2677// It returns nil if no more results exist. 2678func (vmsslsr VirtualMachineScaleSetListSkusResult) virtualMachineScaleSetListSkusResultPreparer(ctx context.Context) (*http.Request, error) { 2679 if vmsslsr.NextLink == nil || len(to.String(vmsslsr.NextLink)) < 1 { 2680 return nil, nil 2681 } 2682 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2683 autorest.AsJSON(), 2684 autorest.AsGet(), 2685 autorest.WithBaseURL(to.String(vmsslsr.NextLink))) 2686} 2687 2688// VirtualMachineScaleSetListSkusResultPage contains a page of VirtualMachineScaleSetSku values. 2689type VirtualMachineScaleSetListSkusResultPage struct { 2690 fn func(context.Context, VirtualMachineScaleSetListSkusResult) (VirtualMachineScaleSetListSkusResult, error) 2691 vmsslsr VirtualMachineScaleSetListSkusResult 2692} 2693 2694// NextWithContext advances to the next page of values. If there was an error making 2695// the request the page does not advance and the error is returned. 2696func (page *VirtualMachineScaleSetListSkusResultPage) NextWithContext(ctx context.Context) (err error) { 2697 if tracing.IsEnabled() { 2698 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListSkusResultPage.NextWithContext") 2699 defer func() { 2700 sc := -1 2701 if page.Response().Response.Response != nil { 2702 sc = page.Response().Response.Response.StatusCode 2703 } 2704 tracing.EndSpan(ctx, sc, err) 2705 }() 2706 } 2707 next, err := page.fn(ctx, page.vmsslsr) 2708 if err != nil { 2709 return err 2710 } 2711 page.vmsslsr = next 2712 return nil 2713} 2714 2715// Next advances to the next page of values. If there was an error making 2716// the request the page does not advance and the error is returned. 2717// Deprecated: Use NextWithContext() instead. 2718func (page *VirtualMachineScaleSetListSkusResultPage) Next() error { 2719 return page.NextWithContext(context.Background()) 2720} 2721 2722// NotDone returns true if the page enumeration should be started or is not yet complete. 2723func (page VirtualMachineScaleSetListSkusResultPage) NotDone() bool { 2724 return !page.vmsslsr.IsEmpty() 2725} 2726 2727// Response returns the raw server response from the last page request. 2728func (page VirtualMachineScaleSetListSkusResultPage) Response() VirtualMachineScaleSetListSkusResult { 2729 return page.vmsslsr 2730} 2731 2732// Values returns the slice of values for the current page or nil if there are no values. 2733func (page VirtualMachineScaleSetListSkusResultPage) Values() []VirtualMachineScaleSetSku { 2734 if page.vmsslsr.IsEmpty() { 2735 return nil 2736 } 2737 return *page.vmsslsr.Value 2738} 2739 2740// Creates a new instance of the VirtualMachineScaleSetListSkusResultPage type. 2741func NewVirtualMachineScaleSetListSkusResultPage(getNextPage func(context.Context, VirtualMachineScaleSetListSkusResult) (VirtualMachineScaleSetListSkusResult, error)) VirtualMachineScaleSetListSkusResultPage { 2742 return VirtualMachineScaleSetListSkusResultPage{fn: getNextPage} 2743} 2744 2745// VirtualMachineScaleSetListWithLinkResult the List Virtual Machine operation response. 2746type VirtualMachineScaleSetListWithLinkResult struct { 2747 autorest.Response `json:"-"` 2748 // Value - The list of virtual machine scale sets. 2749 Value *[]VirtualMachineScaleSet `json:"value,omitempty"` 2750 // 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. 2751 NextLink *string `json:"nextLink,omitempty"` 2752} 2753 2754// VirtualMachineScaleSetListWithLinkResultIterator provides access to a complete listing of 2755// VirtualMachineScaleSet values. 2756type VirtualMachineScaleSetListWithLinkResultIterator struct { 2757 i int 2758 page VirtualMachineScaleSetListWithLinkResultPage 2759} 2760 2761// NextWithContext advances to the next value. If there was an error making 2762// the request the iterator does not advance and the error is returned. 2763func (iter *VirtualMachineScaleSetListWithLinkResultIterator) NextWithContext(ctx context.Context) (err error) { 2764 if tracing.IsEnabled() { 2765 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListWithLinkResultIterator.NextWithContext") 2766 defer func() { 2767 sc := -1 2768 if iter.Response().Response.Response != nil { 2769 sc = iter.Response().Response.Response.StatusCode 2770 } 2771 tracing.EndSpan(ctx, sc, err) 2772 }() 2773 } 2774 iter.i++ 2775 if iter.i < len(iter.page.Values()) { 2776 return nil 2777 } 2778 err = iter.page.NextWithContext(ctx) 2779 if err != nil { 2780 iter.i-- 2781 return err 2782 } 2783 iter.i = 0 2784 return nil 2785} 2786 2787// Next advances to the next value. If there was an error making 2788// the request the iterator does not advance and the error is returned. 2789// Deprecated: Use NextWithContext() instead. 2790func (iter *VirtualMachineScaleSetListWithLinkResultIterator) Next() error { 2791 return iter.NextWithContext(context.Background()) 2792} 2793 2794// NotDone returns true if the enumeration should be started or is not yet complete. 2795func (iter VirtualMachineScaleSetListWithLinkResultIterator) NotDone() bool { 2796 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2797} 2798 2799// Response returns the raw server response from the last page request. 2800func (iter VirtualMachineScaleSetListWithLinkResultIterator) Response() VirtualMachineScaleSetListWithLinkResult { 2801 return iter.page.Response() 2802} 2803 2804// Value returns the current value or a zero-initialized value if the 2805// iterator has advanced beyond the end of the collection. 2806func (iter VirtualMachineScaleSetListWithLinkResultIterator) Value() VirtualMachineScaleSet { 2807 if !iter.page.NotDone() { 2808 return VirtualMachineScaleSet{} 2809 } 2810 return iter.page.Values()[iter.i] 2811} 2812 2813// Creates a new instance of the VirtualMachineScaleSetListWithLinkResultIterator type. 2814func NewVirtualMachineScaleSetListWithLinkResultIterator(page VirtualMachineScaleSetListWithLinkResultPage) VirtualMachineScaleSetListWithLinkResultIterator { 2815 return VirtualMachineScaleSetListWithLinkResultIterator{page: page} 2816} 2817 2818// IsEmpty returns true if the ListResult contains no values. 2819func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) IsEmpty() bool { 2820 return vmsslwlr.Value == nil || len(*vmsslwlr.Value) == 0 2821} 2822 2823// virtualMachineScaleSetListWithLinkResultPreparer prepares a request to retrieve the next set of results. 2824// It returns nil if no more results exist. 2825func (vmsslwlr VirtualMachineScaleSetListWithLinkResult) virtualMachineScaleSetListWithLinkResultPreparer(ctx context.Context) (*http.Request, error) { 2826 if vmsslwlr.NextLink == nil || len(to.String(vmsslwlr.NextLink)) < 1 { 2827 return nil, nil 2828 } 2829 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2830 autorest.AsJSON(), 2831 autorest.AsGet(), 2832 autorest.WithBaseURL(to.String(vmsslwlr.NextLink))) 2833} 2834 2835// VirtualMachineScaleSetListWithLinkResultPage contains a page of VirtualMachineScaleSet values. 2836type VirtualMachineScaleSetListWithLinkResultPage struct { 2837 fn func(context.Context, VirtualMachineScaleSetListWithLinkResult) (VirtualMachineScaleSetListWithLinkResult, error) 2838 vmsslwlr VirtualMachineScaleSetListWithLinkResult 2839} 2840 2841// NextWithContext advances to the next page of values. If there was an error making 2842// the request the page does not advance and the error is returned. 2843func (page *VirtualMachineScaleSetListWithLinkResultPage) NextWithContext(ctx context.Context) (err error) { 2844 if tracing.IsEnabled() { 2845 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetListWithLinkResultPage.NextWithContext") 2846 defer func() { 2847 sc := -1 2848 if page.Response().Response.Response != nil { 2849 sc = page.Response().Response.Response.StatusCode 2850 } 2851 tracing.EndSpan(ctx, sc, err) 2852 }() 2853 } 2854 next, err := page.fn(ctx, page.vmsslwlr) 2855 if err != nil { 2856 return err 2857 } 2858 page.vmsslwlr = next 2859 return nil 2860} 2861 2862// Next advances to the next page of values. If there was an error making 2863// the request the page does not advance and the error is returned. 2864// Deprecated: Use NextWithContext() instead. 2865func (page *VirtualMachineScaleSetListWithLinkResultPage) Next() error { 2866 return page.NextWithContext(context.Background()) 2867} 2868 2869// NotDone returns true if the page enumeration should be started or is not yet complete. 2870func (page VirtualMachineScaleSetListWithLinkResultPage) NotDone() bool { 2871 return !page.vmsslwlr.IsEmpty() 2872} 2873 2874// Response returns the raw server response from the last page request. 2875func (page VirtualMachineScaleSetListWithLinkResultPage) Response() VirtualMachineScaleSetListWithLinkResult { 2876 return page.vmsslwlr 2877} 2878 2879// Values returns the slice of values for the current page or nil if there are no values. 2880func (page VirtualMachineScaleSetListWithLinkResultPage) Values() []VirtualMachineScaleSet { 2881 if page.vmsslwlr.IsEmpty() { 2882 return nil 2883 } 2884 return *page.vmsslwlr.Value 2885} 2886 2887// Creates a new instance of the VirtualMachineScaleSetListWithLinkResultPage type. 2888func NewVirtualMachineScaleSetListWithLinkResultPage(getNextPage func(context.Context, VirtualMachineScaleSetListWithLinkResult) (VirtualMachineScaleSetListWithLinkResult, error)) VirtualMachineScaleSetListWithLinkResultPage { 2889 return VirtualMachineScaleSetListWithLinkResultPage{fn: getNextPage} 2890} 2891 2892// VirtualMachineScaleSetNetworkConfiguration describes a virtual machine scale set network profile's 2893// network configurations. 2894type VirtualMachineScaleSetNetworkConfiguration struct { 2895 // Name - The network configuration name. 2896 Name *string `json:"name,omitempty"` 2897 *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` 2898 // ID - Resource Id 2899 ID *string `json:"id,omitempty"` 2900} 2901 2902// MarshalJSON is the custom marshaler for VirtualMachineScaleSetNetworkConfiguration. 2903func (vmssnc VirtualMachineScaleSetNetworkConfiguration) MarshalJSON() ([]byte, error) { 2904 objectMap := make(map[string]interface{}) 2905 if vmssnc.Name != nil { 2906 objectMap["name"] = vmssnc.Name 2907 } 2908 if vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties != nil { 2909 objectMap["properties"] = vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties 2910 } 2911 if vmssnc.ID != nil { 2912 objectMap["id"] = vmssnc.ID 2913 } 2914 return json.Marshal(objectMap) 2915} 2916 2917// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetNetworkConfiguration struct. 2918func (vmssnc *VirtualMachineScaleSetNetworkConfiguration) UnmarshalJSON(body []byte) error { 2919 var m map[string]*json.RawMessage 2920 err := json.Unmarshal(body, &m) 2921 if err != nil { 2922 return err 2923 } 2924 for k, v := range m { 2925 switch k { 2926 case "name": 2927 if v != nil { 2928 var name string 2929 err = json.Unmarshal(*v, &name) 2930 if err != nil { 2931 return err 2932 } 2933 vmssnc.Name = &name 2934 } 2935 case "properties": 2936 if v != nil { 2937 var virtualMachineScaleSetNetworkConfigurationProperties VirtualMachineScaleSetNetworkConfigurationProperties 2938 err = json.Unmarshal(*v, &virtualMachineScaleSetNetworkConfigurationProperties) 2939 if err != nil { 2940 return err 2941 } 2942 vmssnc.VirtualMachineScaleSetNetworkConfigurationProperties = &virtualMachineScaleSetNetworkConfigurationProperties 2943 } 2944 case "id": 2945 if v != nil { 2946 var ID string 2947 err = json.Unmarshal(*v, &ID) 2948 if err != nil { 2949 return err 2950 } 2951 vmssnc.ID = &ID 2952 } 2953 } 2954 } 2955 2956 return nil 2957} 2958 2959// VirtualMachineScaleSetNetworkConfigurationProperties describes a virtual machine scale set network 2960// profile's IP configuration. 2961type VirtualMachineScaleSetNetworkConfigurationProperties struct { 2962 // Primary - Whether this is a primary NIC on a virtual machine. 2963 Primary *bool `json:"primary,omitempty"` 2964 // IPConfigurations - The virtual machine scale set IP Configuration. 2965 IPConfigurations *[]VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations,omitempty"` 2966} 2967 2968// VirtualMachineScaleSetNetworkProfile describes a virtual machine scale set network profile. 2969type VirtualMachineScaleSetNetworkProfile struct { 2970 // NetworkInterfaceConfigurations - The list of network configurations. 2971 NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` 2972} 2973 2974// VirtualMachineScaleSetOSDisk describes a virtual machine scale set operating system disk. 2975type VirtualMachineScaleSetOSDisk struct { 2976 // Name - The disk name. 2977 Name *string `json:"name,omitempty"` 2978 // 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: 'None', 'ReadOnly', 'ReadWrite' 2979 Caching CachingTypes `json:"caching,omitempty"` 2980 // 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: 'FromImage', 'Empty', 'Attach' 2981 CreateOption DiskCreateOptionTypes `json:"createOption,omitempty"` 2982 // 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' 2983 OsType OperatingSystemTypes `json:"osType,omitempty"` 2984 // 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. 2985 Image *VirtualHardDisk `json:"image,omitempty"` 2986 // VhdContainers - The list of virtual hard disk container uris. 2987 VhdContainers *[]string `json:"vhdContainers,omitempty"` 2988} 2989 2990// VirtualMachineScaleSetOSProfile describes a virtual machine scale set OS profile. 2991type VirtualMachineScaleSetOSProfile struct { 2992 // 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. 2993 ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"` 2994 // 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) 2995 AdminUsername *string `json:"adminUsername,omitempty"` 2996 // 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) 2997 AdminPassword *string `json:"adminPassword,omitempty"` 2998 // CustomData - A base-64 encoded string of custom data. 2999 CustomData *string `json:"customData,omitempty"` 3000 // WindowsConfiguration - The Windows Configuration of the OS profile. 3001 WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` 3002 // LinuxConfiguration - The Linux Configuration of the OS profile. 3003 LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` 3004 // Secrets - The List of certificates for addition to the VM. 3005 Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` 3006} 3007 3008// VirtualMachineScaleSetProperties describes the properties of a Virtual Machine Scale Set. 3009type VirtualMachineScaleSetProperties struct { 3010 // UpgradePolicy - The upgrade policy. 3011 UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` 3012 // VirtualMachineProfile - The virtual machine profile. 3013 VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` 3014 // ProvisioningState - The provisioning state, which only appears in the response. 3015 ProvisioningState *string `json:"provisioningState,omitempty"` 3016 // OverProvision - Specifies whether the Virtual Machine Scale Set should be overprovisioned. 3017 OverProvision *bool `json:"overProvision,omitempty"` 3018} 3019 3020// VirtualMachineScaleSetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of 3021// a long-running operation. 3022type VirtualMachineScaleSetsCreateOrUpdateFuture struct { 3023 azure.Future 3024} 3025 3026// Result returns the result of the asynchronous operation. 3027// If the operation has not completed it will return an error. 3028func (future *VirtualMachineScaleSetsCreateOrUpdateFuture) Result(client VirtualMachineScaleSetsClient) (vmss VirtualMachineScaleSet, err error) { 3029 var done bool 3030 done, err = future.DoneWithContext(context.Background(), client) 3031 if err != nil { 3032 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 3033 return 3034 } 3035 if !done { 3036 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsCreateOrUpdateFuture") 3037 return 3038 } 3039 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3040 if vmss.Response.Response, err = future.GetResult(sender); err == nil && vmss.Response.Response.StatusCode != http.StatusNoContent { 3041 vmss, err = client.CreateOrUpdateResponder(vmss.Response.Response) 3042 if err != nil { 3043 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsCreateOrUpdateFuture", "Result", vmss.Response.Response, "Failure responding to request") 3044 } 3045 } 3046 return 3047} 3048 3049// VirtualMachineScaleSetsDeallocateFuture an abstraction for monitoring and retrieving the results of a 3050// long-running operation. 3051type VirtualMachineScaleSetsDeallocateFuture struct { 3052 azure.Future 3053} 3054 3055// Result returns the result of the asynchronous operation. 3056// If the operation has not completed it will return an error. 3057func (future *VirtualMachineScaleSetsDeallocateFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 3058 var done bool 3059 done, err = future.DoneWithContext(context.Background(), client) 3060 if err != nil { 3061 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", future.Response(), "Polling failure") 3062 return 3063 } 3064 if !done { 3065 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeallocateFuture") 3066 return 3067 } 3068 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3069 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3070 osr, err = client.DeallocateResponder(osr.Response.Response) 3071 if err != nil { 3072 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeallocateFuture", "Result", osr.Response.Response, "Failure responding to request") 3073 } 3074 } 3075 return 3076} 3077 3078// VirtualMachineScaleSetsDeleteFuture an abstraction for monitoring and retrieving the results of a 3079// long-running operation. 3080type VirtualMachineScaleSetsDeleteFuture struct { 3081 azure.Future 3082} 3083 3084// Result returns the result of the asynchronous operation. 3085// If the operation has not completed it will return an error. 3086func (future *VirtualMachineScaleSetsDeleteFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 3087 var done bool 3088 done, err = future.DoneWithContext(context.Background(), client) 3089 if err != nil { 3090 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", future.Response(), "Polling failure") 3091 return 3092 } 3093 if !done { 3094 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteFuture") 3095 return 3096 } 3097 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3098 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3099 osr, err = client.DeleteResponder(osr.Response.Response) 3100 if err != nil { 3101 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") 3102 } 3103 } 3104 return 3105} 3106 3107// VirtualMachineScaleSetsDeleteInstancesFuture an abstraction for monitoring and retrieving the results of 3108// a long-running operation. 3109type VirtualMachineScaleSetsDeleteInstancesFuture struct { 3110 azure.Future 3111} 3112 3113// Result returns the result of the asynchronous operation. 3114// If the operation has not completed it will return an error. 3115func (future *VirtualMachineScaleSetsDeleteInstancesFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 3116 var done bool 3117 done, err = future.DoneWithContext(context.Background(), client) 3118 if err != nil { 3119 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", future.Response(), "Polling failure") 3120 return 3121 } 3122 if !done { 3123 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsDeleteInstancesFuture") 3124 return 3125 } 3126 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3127 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3128 osr, err = client.DeleteInstancesResponder(osr.Response.Response) 3129 if err != nil { 3130 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsDeleteInstancesFuture", "Result", osr.Response.Response, "Failure responding to request") 3131 } 3132 } 3133 return 3134} 3135 3136// VirtualMachineScaleSetSku describes an available virtual machine scale set sku. 3137type VirtualMachineScaleSetSku struct { 3138 // ResourceType - READ-ONLY; The type of resource the sku applies to. 3139 ResourceType *string `json:"resourceType,omitempty"` 3140 // Sku - READ-ONLY; The Sku. 3141 Sku *Sku `json:"sku,omitempty"` 3142 // Capacity - READ-ONLY; Specifies the number of virtual machines in the scale set. 3143 Capacity *VirtualMachineScaleSetSkuCapacity `json:"capacity,omitempty"` 3144} 3145 3146// VirtualMachineScaleSetSkuCapacity describes scaling information of a sku. 3147type VirtualMachineScaleSetSkuCapacity struct { 3148 // Minimum - READ-ONLY; The minimum capacity. 3149 Minimum *int64 `json:"minimum,omitempty"` 3150 // Maximum - READ-ONLY; The maximum capacity that can be set. 3151 Maximum *int64 `json:"maximum,omitempty"` 3152 // DefaultCapacity - READ-ONLY; The default capacity. 3153 DefaultCapacity *int64 `json:"defaultCapacity,omitempty"` 3154 // ScaleType - READ-ONLY; The scale type applicable to the sku. Possible values include: 'VirtualMachineScaleSetSkuScaleTypeAutomatic', 'VirtualMachineScaleSetSkuScaleTypeNone' 3155 ScaleType VirtualMachineScaleSetSkuScaleType `json:"scaleType,omitempty"` 3156} 3157 3158// VirtualMachineScaleSetsPowerOffFuture an abstraction for monitoring and retrieving the results of a 3159// long-running operation. 3160type VirtualMachineScaleSetsPowerOffFuture struct { 3161 azure.Future 3162} 3163 3164// Result returns the result of the asynchronous operation. 3165// If the operation has not completed it will return an error. 3166func (future *VirtualMachineScaleSetsPowerOffFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 3167 var done bool 3168 done, err = future.DoneWithContext(context.Background(), client) 3169 if err != nil { 3170 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", future.Response(), "Polling failure") 3171 return 3172 } 3173 if !done { 3174 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsPowerOffFuture") 3175 return 3176 } 3177 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3178 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3179 osr, err = client.PowerOffResponder(osr.Response.Response) 3180 if err != nil { 3181 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsPowerOffFuture", "Result", osr.Response.Response, "Failure responding to request") 3182 } 3183 } 3184 return 3185} 3186 3187// VirtualMachineScaleSetsReimageFuture an abstraction for monitoring and retrieving the results of a 3188// long-running operation. 3189type VirtualMachineScaleSetsReimageFuture struct { 3190 azure.Future 3191} 3192 3193// Result returns the result of the asynchronous operation. 3194// If the operation has not completed it will return an error. 3195func (future *VirtualMachineScaleSetsReimageFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 3196 var done bool 3197 done, err = future.DoneWithContext(context.Background(), client) 3198 if err != nil { 3199 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", future.Response(), "Polling failure") 3200 return 3201 } 3202 if !done { 3203 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsReimageFuture") 3204 return 3205 } 3206 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3207 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3208 osr, err = client.ReimageResponder(osr.Response.Response) 3209 if err != nil { 3210 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsReimageFuture", "Result", osr.Response.Response, "Failure responding to request") 3211 } 3212 } 3213 return 3214} 3215 3216// VirtualMachineScaleSetsRestartFuture an abstraction for monitoring and retrieving the results of a 3217// long-running operation. 3218type VirtualMachineScaleSetsRestartFuture struct { 3219 azure.Future 3220} 3221 3222// Result returns the result of the asynchronous operation. 3223// If the operation has not completed it will return an error. 3224func (future *VirtualMachineScaleSetsRestartFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 3225 var done bool 3226 done, err = future.DoneWithContext(context.Background(), client) 3227 if err != nil { 3228 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", future.Response(), "Polling failure") 3229 return 3230 } 3231 if !done { 3232 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsRestartFuture") 3233 return 3234 } 3235 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3236 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3237 osr, err = client.RestartResponder(osr.Response.Response) 3238 if err != nil { 3239 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsRestartFuture", "Result", osr.Response.Response, "Failure responding to request") 3240 } 3241 } 3242 return 3243} 3244 3245// VirtualMachineScaleSetsStartFuture an abstraction for monitoring and retrieving the results of a 3246// long-running operation. 3247type VirtualMachineScaleSetsStartFuture struct { 3248 azure.Future 3249} 3250 3251// Result returns the result of the asynchronous operation. 3252// If the operation has not completed it will return an error. 3253func (future *VirtualMachineScaleSetsStartFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 3254 var done bool 3255 done, err = future.DoneWithContext(context.Background(), client) 3256 if err != nil { 3257 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", future.Response(), "Polling failure") 3258 return 3259 } 3260 if !done { 3261 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsStartFuture") 3262 return 3263 } 3264 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3265 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3266 osr, err = client.StartResponder(osr.Response.Response) 3267 if err != nil { 3268 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsStartFuture", "Result", osr.Response.Response, "Failure responding to request") 3269 } 3270 } 3271 return 3272} 3273 3274// VirtualMachineScaleSetStorageProfile describes a virtual machine scale set storage profile. 3275type VirtualMachineScaleSetStorageProfile struct { 3276 // ImageReference - The image reference. 3277 ImageReference *ImageReference `json:"imageReference,omitempty"` 3278 // OsDisk - The OS disk. 3279 OsDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"` 3280} 3281 3282// VirtualMachineScaleSetsUpdateInstancesFuture an abstraction for monitoring and retrieving the results of 3283// a long-running operation. 3284type VirtualMachineScaleSetsUpdateInstancesFuture struct { 3285 azure.Future 3286} 3287 3288// Result returns the result of the asynchronous operation. 3289// If the operation has not completed it will return an error. 3290func (future *VirtualMachineScaleSetsUpdateInstancesFuture) Result(client VirtualMachineScaleSetsClient) (osr OperationStatusResponse, err error) { 3291 var done bool 3292 done, err = future.DoneWithContext(context.Background(), client) 3293 if err != nil { 3294 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", future.Response(), "Polling failure") 3295 return 3296 } 3297 if !done { 3298 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetsUpdateInstancesFuture") 3299 return 3300 } 3301 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3302 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3303 osr, err = client.UpdateInstancesResponder(osr.Response.Response) 3304 if err != nil { 3305 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsUpdateInstancesFuture", "Result", osr.Response.Response, "Failure responding to request") 3306 } 3307 } 3308 return 3309} 3310 3311// VirtualMachineScaleSetVM describes a virtual machine scale set virtual machine. 3312type VirtualMachineScaleSetVM struct { 3313 autorest.Response `json:"-"` 3314 // InstanceID - READ-ONLY; The virtual machine instance ID. 3315 InstanceID *string `json:"instanceId,omitempty"` 3316 // Sku - READ-ONLY; The virtual machine SKU. 3317 Sku *Sku `json:"sku,omitempty"` 3318 *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"` 3319 // 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**. 3320 Plan *Plan `json:"plan,omitempty"` 3321 // Resources - READ-ONLY; The virtual machine child extension resources. 3322 Resources *[]VirtualMachineExtension `json:"resources,omitempty"` 3323 // ID - READ-ONLY; Resource Id 3324 ID *string `json:"id,omitempty"` 3325 // Name - READ-ONLY; Resource name 3326 Name *string `json:"name,omitempty"` 3327 // Type - READ-ONLY; Resource type 3328 Type *string `json:"type,omitempty"` 3329 // Location - Resource location 3330 Location *string `json:"location,omitempty"` 3331 // Tags - Resource tags 3332 Tags map[string]*string `json:"tags"` 3333} 3334 3335// MarshalJSON is the custom marshaler for VirtualMachineScaleSetVM. 3336func (vmssv VirtualMachineScaleSetVM) MarshalJSON() ([]byte, error) { 3337 objectMap := make(map[string]interface{}) 3338 if vmssv.VirtualMachineScaleSetVMProperties != nil { 3339 objectMap["properties"] = vmssv.VirtualMachineScaleSetVMProperties 3340 } 3341 if vmssv.Plan != nil { 3342 objectMap["plan"] = vmssv.Plan 3343 } 3344 if vmssv.Location != nil { 3345 objectMap["location"] = vmssv.Location 3346 } 3347 if vmssv.Tags != nil { 3348 objectMap["tags"] = vmssv.Tags 3349 } 3350 return json.Marshal(objectMap) 3351} 3352 3353// UnmarshalJSON is the custom unmarshaler for VirtualMachineScaleSetVM struct. 3354func (vmssv *VirtualMachineScaleSetVM) UnmarshalJSON(body []byte) error { 3355 var m map[string]*json.RawMessage 3356 err := json.Unmarshal(body, &m) 3357 if err != nil { 3358 return err 3359 } 3360 for k, v := range m { 3361 switch k { 3362 case "instanceId": 3363 if v != nil { 3364 var instanceID string 3365 err = json.Unmarshal(*v, &instanceID) 3366 if err != nil { 3367 return err 3368 } 3369 vmssv.InstanceID = &instanceID 3370 } 3371 case "sku": 3372 if v != nil { 3373 var sku Sku 3374 err = json.Unmarshal(*v, &sku) 3375 if err != nil { 3376 return err 3377 } 3378 vmssv.Sku = &sku 3379 } 3380 case "properties": 3381 if v != nil { 3382 var virtualMachineScaleSetVMProperties VirtualMachineScaleSetVMProperties 3383 err = json.Unmarshal(*v, &virtualMachineScaleSetVMProperties) 3384 if err != nil { 3385 return err 3386 } 3387 vmssv.VirtualMachineScaleSetVMProperties = &virtualMachineScaleSetVMProperties 3388 } 3389 case "plan": 3390 if v != nil { 3391 var plan Plan 3392 err = json.Unmarshal(*v, &plan) 3393 if err != nil { 3394 return err 3395 } 3396 vmssv.Plan = &plan 3397 } 3398 case "resources": 3399 if v != nil { 3400 var resources []VirtualMachineExtension 3401 err = json.Unmarshal(*v, &resources) 3402 if err != nil { 3403 return err 3404 } 3405 vmssv.Resources = &resources 3406 } 3407 case "id": 3408 if v != nil { 3409 var ID string 3410 err = json.Unmarshal(*v, &ID) 3411 if err != nil { 3412 return err 3413 } 3414 vmssv.ID = &ID 3415 } 3416 case "name": 3417 if v != nil { 3418 var name string 3419 err = json.Unmarshal(*v, &name) 3420 if err != nil { 3421 return err 3422 } 3423 vmssv.Name = &name 3424 } 3425 case "type": 3426 if v != nil { 3427 var typeVar string 3428 err = json.Unmarshal(*v, &typeVar) 3429 if err != nil { 3430 return err 3431 } 3432 vmssv.Type = &typeVar 3433 } 3434 case "location": 3435 if v != nil { 3436 var location string 3437 err = json.Unmarshal(*v, &location) 3438 if err != nil { 3439 return err 3440 } 3441 vmssv.Location = &location 3442 } 3443 case "tags": 3444 if v != nil { 3445 var tags map[string]*string 3446 err = json.Unmarshal(*v, &tags) 3447 if err != nil { 3448 return err 3449 } 3450 vmssv.Tags = tags 3451 } 3452 } 3453 } 3454 3455 return nil 3456} 3457 3458// VirtualMachineScaleSetVMExtensionsSummary extensions summary for virtual machines of a virtual machine 3459// scale set. 3460type VirtualMachineScaleSetVMExtensionsSummary struct { 3461 // Name - READ-ONLY; The extension name. 3462 Name *string `json:"name,omitempty"` 3463 // StatusesSummary - READ-ONLY; The extensions information. 3464 StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` 3465} 3466 3467// VirtualMachineScaleSetVMInstanceIDs specifies a list of virtual machine instance IDs from the VM scale 3468// set. 3469type VirtualMachineScaleSetVMInstanceIDs struct { 3470 // 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. 3471 InstanceIds *[]string `json:"instanceIds,omitempty"` 3472} 3473 3474// VirtualMachineScaleSetVMInstanceRequiredIDs specifies a list of virtual machine instance IDs from the VM 3475// scale set. 3476type VirtualMachineScaleSetVMInstanceRequiredIDs struct { 3477 // InstanceIds - The virtual machine scale set instance ids. 3478 InstanceIds *[]string `json:"instanceIds,omitempty"` 3479} 3480 3481// VirtualMachineScaleSetVMInstanceView the instance view of a virtual machine scale set VM. 3482type VirtualMachineScaleSetVMInstanceView struct { 3483 autorest.Response `json:"-"` 3484 // PlatformUpdateDomain - The Update Domain count. 3485 PlatformUpdateDomain *int32 `json:"platformUpdateDomain,omitempty"` 3486 // PlatformFaultDomain - The Fault Domain count. 3487 PlatformFaultDomain *int32 `json:"platformFaultDomain,omitempty"` 3488 // RdpThumbPrint - The Remote desktop certificate thumbprint. 3489 RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` 3490 // VMAgent - The VM Agent running on the virtual machine. 3491 VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` 3492 // Disks - The disks information. 3493 Disks *[]DiskInstanceView `json:"disks,omitempty"` 3494 // Extensions - The extensions information. 3495 Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` 3496 // BootDiagnostics - Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. 3497 BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` 3498 // Statuses - The resource status information. 3499 Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` 3500} 3501 3502// VirtualMachineScaleSetVMListResult the List Virtual Machine Scale Set VMs operation response. 3503type VirtualMachineScaleSetVMListResult struct { 3504 autorest.Response `json:"-"` 3505 // Value - The list of virtual machine scale sets VMs. 3506 Value *[]VirtualMachineScaleSetVM `json:"value,omitempty"` 3507 // NextLink - The URI to fetch the next page of virtual machine scale sets VMs. Call ListNext() with this to fetch the next page of virtual machine scale sets VMs. 3508 NextLink *string `json:"nextLink,omitempty"` 3509} 3510 3511// VirtualMachineScaleSetVMListResultIterator provides access to a complete listing of 3512// VirtualMachineScaleSetVM values. 3513type VirtualMachineScaleSetVMListResultIterator struct { 3514 i int 3515 page VirtualMachineScaleSetVMListResultPage 3516} 3517 3518// NextWithContext advances to the next value. If there was an error making 3519// the request the iterator does not advance and the error is returned. 3520func (iter *VirtualMachineScaleSetVMListResultIterator) NextWithContext(ctx context.Context) (err error) { 3521 if tracing.IsEnabled() { 3522 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMListResultIterator.NextWithContext") 3523 defer func() { 3524 sc := -1 3525 if iter.Response().Response.Response != nil { 3526 sc = iter.Response().Response.Response.StatusCode 3527 } 3528 tracing.EndSpan(ctx, sc, err) 3529 }() 3530 } 3531 iter.i++ 3532 if iter.i < len(iter.page.Values()) { 3533 return nil 3534 } 3535 err = iter.page.NextWithContext(ctx) 3536 if err != nil { 3537 iter.i-- 3538 return err 3539 } 3540 iter.i = 0 3541 return nil 3542} 3543 3544// Next advances to the next value. If there was an error making 3545// the request the iterator does not advance and the error is returned. 3546// Deprecated: Use NextWithContext() instead. 3547func (iter *VirtualMachineScaleSetVMListResultIterator) Next() error { 3548 return iter.NextWithContext(context.Background()) 3549} 3550 3551// NotDone returns true if the enumeration should be started or is not yet complete. 3552func (iter VirtualMachineScaleSetVMListResultIterator) NotDone() bool { 3553 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3554} 3555 3556// Response returns the raw server response from the last page request. 3557func (iter VirtualMachineScaleSetVMListResultIterator) Response() VirtualMachineScaleSetVMListResult { 3558 return iter.page.Response() 3559} 3560 3561// Value returns the current value or a zero-initialized value if the 3562// iterator has advanced beyond the end of the collection. 3563func (iter VirtualMachineScaleSetVMListResultIterator) Value() VirtualMachineScaleSetVM { 3564 if !iter.page.NotDone() { 3565 return VirtualMachineScaleSetVM{} 3566 } 3567 return iter.page.Values()[iter.i] 3568} 3569 3570// Creates a new instance of the VirtualMachineScaleSetVMListResultIterator type. 3571func NewVirtualMachineScaleSetVMListResultIterator(page VirtualMachineScaleSetVMListResultPage) VirtualMachineScaleSetVMListResultIterator { 3572 return VirtualMachineScaleSetVMListResultIterator{page: page} 3573} 3574 3575// IsEmpty returns true if the ListResult contains no values. 3576func (vmssvlr VirtualMachineScaleSetVMListResult) IsEmpty() bool { 3577 return vmssvlr.Value == nil || len(*vmssvlr.Value) == 0 3578} 3579 3580// virtualMachineScaleSetVMListResultPreparer prepares a request to retrieve the next set of results. 3581// It returns nil if no more results exist. 3582func (vmssvlr VirtualMachineScaleSetVMListResult) virtualMachineScaleSetVMListResultPreparer(ctx context.Context) (*http.Request, error) { 3583 if vmssvlr.NextLink == nil || len(to.String(vmssvlr.NextLink)) < 1 { 3584 return nil, nil 3585 } 3586 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3587 autorest.AsJSON(), 3588 autorest.AsGet(), 3589 autorest.WithBaseURL(to.String(vmssvlr.NextLink))) 3590} 3591 3592// VirtualMachineScaleSetVMListResultPage contains a page of VirtualMachineScaleSetVM values. 3593type VirtualMachineScaleSetVMListResultPage struct { 3594 fn func(context.Context, VirtualMachineScaleSetVMListResult) (VirtualMachineScaleSetVMListResult, error) 3595 vmssvlr VirtualMachineScaleSetVMListResult 3596} 3597 3598// NextWithContext advances to the next page of values. If there was an error making 3599// the request the page does not advance and the error is returned. 3600func (page *VirtualMachineScaleSetVMListResultPage) NextWithContext(ctx context.Context) (err error) { 3601 if tracing.IsEnabled() { 3602 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineScaleSetVMListResultPage.NextWithContext") 3603 defer func() { 3604 sc := -1 3605 if page.Response().Response.Response != nil { 3606 sc = page.Response().Response.Response.StatusCode 3607 } 3608 tracing.EndSpan(ctx, sc, err) 3609 }() 3610 } 3611 next, err := page.fn(ctx, page.vmssvlr) 3612 if err != nil { 3613 return err 3614 } 3615 page.vmssvlr = next 3616 return nil 3617} 3618 3619// Next advances to the next page of values. If there was an error making 3620// the request the page does not advance and the error is returned. 3621// Deprecated: Use NextWithContext() instead. 3622func (page *VirtualMachineScaleSetVMListResultPage) Next() error { 3623 return page.NextWithContext(context.Background()) 3624} 3625 3626// NotDone returns true if the page enumeration should be started or is not yet complete. 3627func (page VirtualMachineScaleSetVMListResultPage) NotDone() bool { 3628 return !page.vmssvlr.IsEmpty() 3629} 3630 3631// Response returns the raw server response from the last page request. 3632func (page VirtualMachineScaleSetVMListResultPage) Response() VirtualMachineScaleSetVMListResult { 3633 return page.vmssvlr 3634} 3635 3636// Values returns the slice of values for the current page or nil if there are no values. 3637func (page VirtualMachineScaleSetVMListResultPage) Values() []VirtualMachineScaleSetVM { 3638 if page.vmssvlr.IsEmpty() { 3639 return nil 3640 } 3641 return *page.vmssvlr.Value 3642} 3643 3644// Creates a new instance of the VirtualMachineScaleSetVMListResultPage type. 3645func NewVirtualMachineScaleSetVMListResultPage(getNextPage func(context.Context, VirtualMachineScaleSetVMListResult) (VirtualMachineScaleSetVMListResult, error)) VirtualMachineScaleSetVMListResultPage { 3646 return VirtualMachineScaleSetVMListResultPage{fn: getNextPage} 3647} 3648 3649// VirtualMachineScaleSetVMProfile describes a virtual machine scale set virtual machine profile. 3650type VirtualMachineScaleSetVMProfile struct { 3651 // OsProfile - The virtual machine scale set OS profile. 3652 OsProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"` 3653 // StorageProfile - The virtual machine scale set storage profile. 3654 StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"` 3655 // NetworkProfile - The virtual machine scale set network profile. 3656 NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"` 3657 // ExtensionProfile - The virtual machine scale set extension profile. 3658 ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` 3659} 3660 3661// VirtualMachineScaleSetVMProperties describes the properties of a virtual machine scale set virtual 3662// machine. 3663type VirtualMachineScaleSetVMProperties struct { 3664 // LatestModelApplied - READ-ONLY; Specifies whether the latest model has been applied to the virtual machine. 3665 LatestModelApplied *bool `json:"latestModelApplied,omitempty"` 3666 // InstanceView - READ-ONLY; The virtual machine instance view. 3667 InstanceView *VirtualMachineScaleSetVMInstanceView `json:"instanceView,omitempty"` 3668 // HardwareProfile - Specifies the hardware settings for the virtual machine. 3669 HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` 3670 // StorageProfile - Specifies the storage settings for the virtual machine disks. 3671 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 3672 // OsProfile - Specifies the operating system settings for the virtual machine. 3673 OsProfile *OSProfile `json:"osProfile,omitempty"` 3674 // NetworkProfile - Specifies the network interfaces of the virtual machine. 3675 NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` 3676 // DiagnosticsProfile - Specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. 3677 DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` 3678 // AvailabilitySet - Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. 3679 AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` 3680 // ProvisioningState - The provisioning state, which only appears in the response. 3681 ProvisioningState *string `json:"provisioningState,omitempty"` 3682 // 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 3683 LicenseType *string `json:"licenseType,omitempty"` 3684} 3685 3686// VirtualMachineScaleSetVMsDeallocateFuture an abstraction for monitoring and retrieving the results of a 3687// long-running operation. 3688type VirtualMachineScaleSetVMsDeallocateFuture struct { 3689 azure.Future 3690} 3691 3692// Result returns the result of the asynchronous operation. 3693// If the operation has not completed it will return an error. 3694func (future *VirtualMachineScaleSetVMsDeallocateFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 3695 var done bool 3696 done, err = future.DoneWithContext(context.Background(), client) 3697 if err != nil { 3698 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", future.Response(), "Polling failure") 3699 return 3700 } 3701 if !done { 3702 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeallocateFuture") 3703 return 3704 } 3705 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3706 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3707 osr, err = client.DeallocateResponder(osr.Response.Response) 3708 if err != nil { 3709 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeallocateFuture", "Result", osr.Response.Response, "Failure responding to request") 3710 } 3711 } 3712 return 3713} 3714 3715// VirtualMachineScaleSetVMsDeleteFuture an abstraction for monitoring and retrieving the results of a 3716// long-running operation. 3717type VirtualMachineScaleSetVMsDeleteFuture struct { 3718 azure.Future 3719} 3720 3721// Result returns the result of the asynchronous operation. 3722// If the operation has not completed it will return an error. 3723func (future *VirtualMachineScaleSetVMsDeleteFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 3724 var done bool 3725 done, err = future.DoneWithContext(context.Background(), client) 3726 if err != nil { 3727 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", future.Response(), "Polling failure") 3728 return 3729 } 3730 if !done { 3731 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsDeleteFuture") 3732 return 3733 } 3734 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3735 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3736 osr, err = client.DeleteResponder(osr.Response.Response) 3737 if err != nil { 3738 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") 3739 } 3740 } 3741 return 3742} 3743 3744// VirtualMachineScaleSetVMsPowerOffFuture an abstraction for monitoring and retrieving the results of a 3745// long-running operation. 3746type VirtualMachineScaleSetVMsPowerOffFuture struct { 3747 azure.Future 3748} 3749 3750// Result returns the result of the asynchronous operation. 3751// If the operation has not completed it will return an error. 3752func (future *VirtualMachineScaleSetVMsPowerOffFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 3753 var done bool 3754 done, err = future.DoneWithContext(context.Background(), client) 3755 if err != nil { 3756 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", future.Response(), "Polling failure") 3757 return 3758 } 3759 if !done { 3760 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsPowerOffFuture") 3761 return 3762 } 3763 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3764 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3765 osr, err = client.PowerOffResponder(osr.Response.Response) 3766 if err != nil { 3767 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsPowerOffFuture", "Result", osr.Response.Response, "Failure responding to request") 3768 } 3769 } 3770 return 3771} 3772 3773// VirtualMachineScaleSetVMsReimageFuture an abstraction for monitoring and retrieving the results of a 3774// long-running operation. 3775type VirtualMachineScaleSetVMsReimageFuture struct { 3776 azure.Future 3777} 3778 3779// Result returns the result of the asynchronous operation. 3780// If the operation has not completed it will return an error. 3781func (future *VirtualMachineScaleSetVMsReimageFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 3782 var done bool 3783 done, err = future.DoneWithContext(context.Background(), client) 3784 if err != nil { 3785 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", future.Response(), "Polling failure") 3786 return 3787 } 3788 if !done { 3789 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsReimageFuture") 3790 return 3791 } 3792 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3793 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3794 osr, err = client.ReimageResponder(osr.Response.Response) 3795 if err != nil { 3796 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsReimageFuture", "Result", osr.Response.Response, "Failure responding to request") 3797 } 3798 } 3799 return 3800} 3801 3802// VirtualMachineScaleSetVMsRestartFuture an abstraction for monitoring and retrieving the results of a 3803// long-running operation. 3804type VirtualMachineScaleSetVMsRestartFuture struct { 3805 azure.Future 3806} 3807 3808// Result returns the result of the asynchronous operation. 3809// If the operation has not completed it will return an error. 3810func (future *VirtualMachineScaleSetVMsRestartFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 3811 var done bool 3812 done, err = future.DoneWithContext(context.Background(), client) 3813 if err != nil { 3814 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", future.Response(), "Polling failure") 3815 return 3816 } 3817 if !done { 3818 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsRestartFuture") 3819 return 3820 } 3821 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3822 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3823 osr, err = client.RestartResponder(osr.Response.Response) 3824 if err != nil { 3825 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsRestartFuture", "Result", osr.Response.Response, "Failure responding to request") 3826 } 3827 } 3828 return 3829} 3830 3831// VirtualMachineScaleSetVMsStartFuture an abstraction for monitoring and retrieving the results of a 3832// long-running operation. 3833type VirtualMachineScaleSetVMsStartFuture struct { 3834 azure.Future 3835} 3836 3837// Result returns the result of the asynchronous operation. 3838// If the operation has not completed it will return an error. 3839func (future *VirtualMachineScaleSetVMsStartFuture) Result(client VirtualMachineScaleSetVMsClient) (osr OperationStatusResponse, err error) { 3840 var done bool 3841 done, err = future.DoneWithContext(context.Background(), client) 3842 if err != nil { 3843 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", future.Response(), "Polling failure") 3844 return 3845 } 3846 if !done { 3847 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachineScaleSetVMsStartFuture") 3848 return 3849 } 3850 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3851 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3852 osr, err = client.StartResponder(osr.Response.Response) 3853 if err != nil { 3854 err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsStartFuture", "Result", osr.Response.Response, "Failure responding to request") 3855 } 3856 } 3857 return 3858} 3859 3860// VirtualMachinesCaptureFuture an abstraction for monitoring and retrieving the results of a long-running 3861// operation. 3862type VirtualMachinesCaptureFuture struct { 3863 azure.Future 3864} 3865 3866// Result returns the result of the asynchronous operation. 3867// If the operation has not completed it will return an error. 3868func (future *VirtualMachinesCaptureFuture) Result(client VirtualMachinesClient) (vmcr VirtualMachineCaptureResult, err error) { 3869 var done bool 3870 done, err = future.DoneWithContext(context.Background(), client) 3871 if err != nil { 3872 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", future.Response(), "Polling failure") 3873 return 3874 } 3875 if !done { 3876 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCaptureFuture") 3877 return 3878 } 3879 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3880 if vmcr.Response.Response, err = future.GetResult(sender); err == nil && vmcr.Response.Response.StatusCode != http.StatusNoContent { 3881 vmcr, err = client.CaptureResponder(vmcr.Response.Response) 3882 if err != nil { 3883 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCaptureFuture", "Result", vmcr.Response.Response, "Failure responding to request") 3884 } 3885 } 3886 return 3887} 3888 3889// VirtualMachinesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 3890// long-running operation. 3891type VirtualMachinesCreateOrUpdateFuture struct { 3892 azure.Future 3893} 3894 3895// Result returns the result of the asynchronous operation. 3896// If the operation has not completed it will return an error. 3897func (future *VirtualMachinesCreateOrUpdateFuture) Result(client VirtualMachinesClient) (VM VirtualMachine, err error) { 3898 var done bool 3899 done, err = future.DoneWithContext(context.Background(), client) 3900 if err != nil { 3901 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 3902 return 3903 } 3904 if !done { 3905 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesCreateOrUpdateFuture") 3906 return 3907 } 3908 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3909 if VM.Response.Response, err = future.GetResult(sender); err == nil && VM.Response.Response.StatusCode != http.StatusNoContent { 3910 VM, err = client.CreateOrUpdateResponder(VM.Response.Response) 3911 if err != nil { 3912 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesCreateOrUpdateFuture", "Result", VM.Response.Response, "Failure responding to request") 3913 } 3914 } 3915 return 3916} 3917 3918// VirtualMachinesDeallocateFuture an abstraction for monitoring and retrieving the results of a 3919// long-running operation. 3920type VirtualMachinesDeallocateFuture struct { 3921 azure.Future 3922} 3923 3924// Result returns the result of the asynchronous operation. 3925// If the operation has not completed it will return an error. 3926func (future *VirtualMachinesDeallocateFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 3927 var done bool 3928 done, err = future.DoneWithContext(context.Background(), client) 3929 if err != nil { 3930 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", future.Response(), "Polling failure") 3931 return 3932 } 3933 if !done { 3934 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeallocateFuture") 3935 return 3936 } 3937 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3938 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3939 osr, err = client.DeallocateResponder(osr.Response.Response) 3940 if err != nil { 3941 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeallocateFuture", "Result", osr.Response.Response, "Failure responding to request") 3942 } 3943 } 3944 return 3945} 3946 3947// VirtualMachinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 3948// operation. 3949type VirtualMachinesDeleteFuture struct { 3950 azure.Future 3951} 3952 3953// Result returns the result of the asynchronous operation. 3954// If the operation has not completed it will return an error. 3955func (future *VirtualMachinesDeleteFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 3956 var done bool 3957 done, err = future.DoneWithContext(context.Background(), client) 3958 if err != nil { 3959 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", future.Response(), "Polling failure") 3960 return 3961 } 3962 if !done { 3963 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesDeleteFuture") 3964 return 3965 } 3966 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3967 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 3968 osr, err = client.DeleteResponder(osr.Response.Response) 3969 if err != nil { 3970 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesDeleteFuture", "Result", osr.Response.Response, "Failure responding to request") 3971 } 3972 } 3973 return 3974} 3975 3976// VirtualMachineSize describes the properties of a VM size. 3977type VirtualMachineSize struct { 3978 // Name - The name of the virtual machine size. 3979 Name *string `json:"name,omitempty"` 3980 // NumberOfCores - The number of cores supported by the virtual machine size. 3981 NumberOfCores *int32 `json:"numberOfCores,omitempty"` 3982 // OsDiskSizeInMB - The OS disk size, in MB, allowed by the virtual machine size. 3983 OsDiskSizeInMB *int32 `json:"osDiskSizeInMB,omitempty"` 3984 // ResourceDiskSizeInMB - The resource disk size, in MB, allowed by the virtual machine size. 3985 ResourceDiskSizeInMB *int32 `json:"resourceDiskSizeInMB,omitempty"` 3986 // MemoryInMB - The amount of memory, in MB, supported by the virtual machine size. 3987 MemoryInMB *int32 `json:"memoryInMB,omitempty"` 3988 // MaxDataDiskCount - The maximum number of data disks that can be attached to the virtual machine size. 3989 MaxDataDiskCount *int32 `json:"maxDataDiskCount,omitempty"` 3990} 3991 3992// VirtualMachineSizeListResult the List Virtual Machine operation response. 3993type VirtualMachineSizeListResult struct { 3994 autorest.Response `json:"-"` 3995 // Value - The list of virtual machine sizes. 3996 Value *[]VirtualMachineSize `json:"value,omitempty"` 3997} 3998 3999// VirtualMachinesPowerOffFuture an abstraction for monitoring and retrieving the results of a long-running 4000// operation. 4001type VirtualMachinesPowerOffFuture struct { 4002 azure.Future 4003} 4004 4005// Result returns the result of the asynchronous operation. 4006// If the operation has not completed it will return an error. 4007func (future *VirtualMachinesPowerOffFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 4008 var done bool 4009 done, err = future.DoneWithContext(context.Background(), client) 4010 if err != nil { 4011 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", future.Response(), "Polling failure") 4012 return 4013 } 4014 if !done { 4015 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesPowerOffFuture") 4016 return 4017 } 4018 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4019 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 4020 osr, err = client.PowerOffResponder(osr.Response.Response) 4021 if err != nil { 4022 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesPowerOffFuture", "Result", osr.Response.Response, "Failure responding to request") 4023 } 4024 } 4025 return 4026} 4027 4028// VirtualMachinesRedeployFuture an abstraction for monitoring and retrieving the results of a long-running 4029// operation. 4030type VirtualMachinesRedeployFuture struct { 4031 azure.Future 4032} 4033 4034// Result returns the result of the asynchronous operation. 4035// If the operation has not completed it will return an error. 4036func (future *VirtualMachinesRedeployFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 4037 var done bool 4038 done, err = future.DoneWithContext(context.Background(), client) 4039 if err != nil { 4040 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", future.Response(), "Polling failure") 4041 return 4042 } 4043 if !done { 4044 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRedeployFuture") 4045 return 4046 } 4047 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4048 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 4049 osr, err = client.RedeployResponder(osr.Response.Response) 4050 if err != nil { 4051 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRedeployFuture", "Result", osr.Response.Response, "Failure responding to request") 4052 } 4053 } 4054 return 4055} 4056 4057// VirtualMachinesRestartFuture an abstraction for monitoring and retrieving the results of a long-running 4058// operation. 4059type VirtualMachinesRestartFuture struct { 4060 azure.Future 4061} 4062 4063// Result returns the result of the asynchronous operation. 4064// If the operation has not completed it will return an error. 4065func (future *VirtualMachinesRestartFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 4066 var done bool 4067 done, err = future.DoneWithContext(context.Background(), client) 4068 if err != nil { 4069 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", future.Response(), "Polling failure") 4070 return 4071 } 4072 if !done { 4073 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesRestartFuture") 4074 return 4075 } 4076 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4077 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 4078 osr, err = client.RestartResponder(osr.Response.Response) 4079 if err != nil { 4080 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesRestartFuture", "Result", osr.Response.Response, "Failure responding to request") 4081 } 4082 } 4083 return 4084} 4085 4086// VirtualMachinesStartFuture an abstraction for monitoring and retrieving the results of a long-running 4087// operation. 4088type VirtualMachinesStartFuture struct { 4089 azure.Future 4090} 4091 4092// Result returns the result of the asynchronous operation. 4093// If the operation has not completed it will return an error. 4094func (future *VirtualMachinesStartFuture) Result(client VirtualMachinesClient) (osr OperationStatusResponse, err error) { 4095 var done bool 4096 done, err = future.DoneWithContext(context.Background(), client) 4097 if err != nil { 4098 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", future.Response(), "Polling failure") 4099 return 4100 } 4101 if !done { 4102 err = azure.NewAsyncOpIncompleteError("compute.VirtualMachinesStartFuture") 4103 return 4104 } 4105 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4106 if osr.Response.Response, err = future.GetResult(sender); err == nil && osr.Response.Response.StatusCode != http.StatusNoContent { 4107 osr, err = client.StartResponder(osr.Response.Response) 4108 if err != nil { 4109 err = autorest.NewErrorWithError(err, "compute.VirtualMachinesStartFuture", "Result", osr.Response.Response, "Failure responding to request") 4110 } 4111 } 4112 return 4113} 4114 4115// VirtualMachineStatusCodeCount the status code and count of the virtual machine scale set instance view 4116// status summary. 4117type VirtualMachineStatusCodeCount struct { 4118 // Code - READ-ONLY; The instance view status code. 4119 Code *string `json:"code,omitempty"` 4120 // Count - READ-ONLY; The number of instances having a particular status code. 4121 Count *int32 `json:"count,omitempty"` 4122} 4123 4124// WindowsConfiguration specifies Windows operating system settings on the virtual machine. 4125type WindowsConfiguration struct { 4126 // 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. 4127 ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` 4128 // EnableAutomaticUpdates - Indicates whether virtual machine is enabled for automatic updates. 4129 EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` 4130 // TimeZone - Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time" 4131 TimeZone *string `json:"timeZone,omitempty"` 4132 // AdditionalUnattendContent - Specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. 4133 AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` 4134 // WinRM - Specifies the Windows Remote Management listeners. This enables remote Windows PowerShell. 4135 WinRM *WinRMConfiguration `json:"winRM,omitempty"` 4136} 4137 4138// WinRMConfiguration describes Windows Remote Management configuration of the VM 4139type WinRMConfiguration struct { 4140 // Listeners - The list of Windows Remote Management listeners 4141 Listeners *[]WinRMListener `json:"listeners,omitempty"` 4142} 4143 4144// WinRMListener describes Protocol and thumbprint of Windows Remote Management listener 4145type WinRMListener struct { 4146 // Protocol - Specifies the protocol of listener. <br><br> Possible values are: <br>**http** <br><br> **https**. Possible values include: 'HTTP', 'HTTPS' 4147 Protocol ProtocolTypes `json:"protocol,omitempty"` 4148 // 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>} 4149 CertificateURL *string `json:"certificateUrl,omitempty"` 4150} 4151