1package vmwarecloudsimple 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 "github.com/gofrs/uuid" 29 "net/http" 30) 31 32// The package's fully qualified name. 33const fqdn = "github.com/Azure/azure-sdk-for-go/services/vmwarecloudsimple/mgmt/2019-04-01/vmwarecloudsimple" 34 35// AvailableOperation resource provider available operation model 36type AvailableOperation struct { 37 // Display - The list of operations 38 Display *AvailableOperationDisplay `json:"display,omitempty"` 39 // IsDataAction - Indicating whether the operation is a data action or not 40 IsDataAction *bool `json:"isDataAction,omitempty"` 41 // Name - {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} 42 Name *string `json:"name,omitempty"` 43 // Origin - The origin of operation. Possible values include: 'User', 'System', 'Usersystem' 44 Origin OperationOrigin `json:"origin,omitempty"` 45 // AvailableOperationDisplayPropertyServiceSpecification - The list of operation properties 46 *AvailableOperationDisplayPropertyServiceSpecification `json:"properties,omitempty"` 47} 48 49// MarshalJSON is the custom marshaler for AvailableOperation. 50func (ao AvailableOperation) MarshalJSON() ([]byte, error) { 51 objectMap := make(map[string]interface{}) 52 if ao.Display != nil { 53 objectMap["display"] = ao.Display 54 } 55 if ao.IsDataAction != nil { 56 objectMap["isDataAction"] = ao.IsDataAction 57 } 58 if ao.Name != nil { 59 objectMap["name"] = ao.Name 60 } 61 if ao.Origin != "" { 62 objectMap["origin"] = ao.Origin 63 } 64 if ao.AvailableOperationDisplayPropertyServiceSpecification != nil { 65 objectMap["properties"] = ao.AvailableOperationDisplayPropertyServiceSpecification 66 } 67 return json.Marshal(objectMap) 68} 69 70// UnmarshalJSON is the custom unmarshaler for AvailableOperation struct. 71func (ao *AvailableOperation) UnmarshalJSON(body []byte) error { 72 var m map[string]*json.RawMessage 73 err := json.Unmarshal(body, &m) 74 if err != nil { 75 return err 76 } 77 for k, v := range m { 78 switch k { 79 case "display": 80 if v != nil { 81 var display AvailableOperationDisplay 82 err = json.Unmarshal(*v, &display) 83 if err != nil { 84 return err 85 } 86 ao.Display = &display 87 } 88 case "isDataAction": 89 if v != nil { 90 var isDataAction bool 91 err = json.Unmarshal(*v, &isDataAction) 92 if err != nil { 93 return err 94 } 95 ao.IsDataAction = &isDataAction 96 } 97 case "name": 98 if v != nil { 99 var name string 100 err = json.Unmarshal(*v, &name) 101 if err != nil { 102 return err 103 } 104 ao.Name = &name 105 } 106 case "origin": 107 if v != nil { 108 var origin OperationOrigin 109 err = json.Unmarshal(*v, &origin) 110 if err != nil { 111 return err 112 } 113 ao.Origin = origin 114 } 115 case "properties": 116 if v != nil { 117 var availableOperationDisplayPropertyServiceSpecification AvailableOperationDisplayPropertyServiceSpecification 118 err = json.Unmarshal(*v, &availableOperationDisplayPropertyServiceSpecification) 119 if err != nil { 120 return err 121 } 122 ao.AvailableOperationDisplayPropertyServiceSpecification = &availableOperationDisplayPropertyServiceSpecification 123 } 124 } 125 } 126 127 return nil 128} 129 130// AvailableOperationDisplay resource provider available operation display model 131type AvailableOperationDisplay struct { 132 // Description - Description of the operation for display purposes 133 Description *string `json:"description,omitempty"` 134 // Operation - Name of the operation for display purposes 135 Operation *string `json:"operation,omitempty"` 136 // Provider - Name of the provider for display purposes 137 Provider *string `json:"provider,omitempty"` 138 // Resource - Name of the resource type for display purposes 139 Resource *string `json:"resource,omitempty"` 140} 141 142// AvailableOperationDisplayPropertyServiceSpecification available operation display property service 143// specification model 144type AvailableOperationDisplayPropertyServiceSpecification struct { 145 // ServiceSpecification - The list of specification's service metrics 146 ServiceSpecification *AvailableOperationDisplayPropertyServiceSpecificationMetricsList `json:"serviceSpecification,omitempty"` 147} 148 149// AvailableOperationDisplayPropertyServiceSpecificationMetricsItem available operation display property 150// service specification metrics item 151type AvailableOperationDisplayPropertyServiceSpecificationMetricsItem struct { 152 // AggregationType - Metric's aggregation type for e.g. (Average, Total). Possible values include: 'Average', 'Total' 153 AggregationType AggregationType `json:"aggregationType,omitempty"` 154 // DisplayDescription - Metric's description 155 DisplayDescription *string `json:"displayDescription,omitempty"` 156 // DisplayName - Human readable metric's name 157 DisplayName *string `json:"displayName,omitempty"` 158 // Name - Metric's name/id 159 Name *string `json:"name,omitempty"` 160 // Unit - Metric's unit 161 Unit *string `json:"unit,omitempty"` 162} 163 164// AvailableOperationDisplayPropertyServiceSpecificationMetricsList list of available operation display 165// property service specification metrics 166type AvailableOperationDisplayPropertyServiceSpecificationMetricsList struct { 167 // MetricSpecifications - Metric specifications of operation 168 MetricSpecifications *[]AvailableOperationDisplayPropertyServiceSpecificationMetricsItem `json:"metricSpecifications,omitempty"` 169} 170 171// AvailableOperationsListResponse list of available operations 172type AvailableOperationsListResponse struct { 173 autorest.Response `json:"-"` 174 // NextLink - Link for next list of available operations 175 NextLink *string `json:"nextLink,omitempty"` 176 // Value - Returns a list of available operations 177 Value *[]AvailableOperation `json:"value,omitempty"` 178} 179 180// AvailableOperationsListResponseIterator provides access to a complete listing of AvailableOperation 181// values. 182type AvailableOperationsListResponseIterator struct { 183 i int 184 page AvailableOperationsListResponsePage 185} 186 187// NextWithContext advances to the next value. If there was an error making 188// the request the iterator does not advance and the error is returned. 189func (iter *AvailableOperationsListResponseIterator) NextWithContext(ctx context.Context) (err error) { 190 if tracing.IsEnabled() { 191 ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsListResponseIterator.NextWithContext") 192 defer func() { 193 sc := -1 194 if iter.Response().Response.Response != nil { 195 sc = iter.Response().Response.Response.StatusCode 196 } 197 tracing.EndSpan(ctx, sc, err) 198 }() 199 } 200 iter.i++ 201 if iter.i < len(iter.page.Values()) { 202 return nil 203 } 204 err = iter.page.NextWithContext(ctx) 205 if err != nil { 206 iter.i-- 207 return err 208 } 209 iter.i = 0 210 return nil 211} 212 213// Next advances to the next value. If there was an error making 214// the request the iterator does not advance and the error is returned. 215// Deprecated: Use NextWithContext() instead. 216func (iter *AvailableOperationsListResponseIterator) Next() error { 217 return iter.NextWithContext(context.Background()) 218} 219 220// NotDone returns true if the enumeration should be started or is not yet complete. 221func (iter AvailableOperationsListResponseIterator) NotDone() bool { 222 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 223} 224 225// Response returns the raw server response from the last page request. 226func (iter AvailableOperationsListResponseIterator) Response() AvailableOperationsListResponse { 227 return iter.page.Response() 228} 229 230// Value returns the current value or a zero-initialized value if the 231// iterator has advanced beyond the end of the collection. 232func (iter AvailableOperationsListResponseIterator) Value() AvailableOperation { 233 if !iter.page.NotDone() { 234 return AvailableOperation{} 235 } 236 return iter.page.Values()[iter.i] 237} 238 239// Creates a new instance of the AvailableOperationsListResponseIterator type. 240func NewAvailableOperationsListResponseIterator(page AvailableOperationsListResponsePage) AvailableOperationsListResponseIterator { 241 return AvailableOperationsListResponseIterator{page: page} 242} 243 244// IsEmpty returns true if the ListResult contains no values. 245func (aolr AvailableOperationsListResponse) IsEmpty() bool { 246 return aolr.Value == nil || len(*aolr.Value) == 0 247} 248 249// hasNextLink returns true if the NextLink is not empty. 250func (aolr AvailableOperationsListResponse) hasNextLink() bool { 251 return aolr.NextLink != nil && len(*aolr.NextLink) != 0 252} 253 254// availableOperationsListResponsePreparer prepares a request to retrieve the next set of results. 255// It returns nil if no more results exist. 256func (aolr AvailableOperationsListResponse) availableOperationsListResponsePreparer(ctx context.Context) (*http.Request, error) { 257 if !aolr.hasNextLink() { 258 return nil, nil 259 } 260 return autorest.Prepare((&http.Request{}).WithContext(ctx), 261 autorest.AsJSON(), 262 autorest.AsGet(), 263 autorest.WithBaseURL(to.String(aolr.NextLink))) 264} 265 266// AvailableOperationsListResponsePage contains a page of AvailableOperation values. 267type AvailableOperationsListResponsePage struct { 268 fn func(context.Context, AvailableOperationsListResponse) (AvailableOperationsListResponse, error) 269 aolr AvailableOperationsListResponse 270} 271 272// NextWithContext advances to the next page of values. If there was an error making 273// the request the page does not advance and the error is returned. 274func (page *AvailableOperationsListResponsePage) NextWithContext(ctx context.Context) (err error) { 275 if tracing.IsEnabled() { 276 ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsListResponsePage.NextWithContext") 277 defer func() { 278 sc := -1 279 if page.Response().Response.Response != nil { 280 sc = page.Response().Response.Response.StatusCode 281 } 282 tracing.EndSpan(ctx, sc, err) 283 }() 284 } 285 for { 286 next, err := page.fn(ctx, page.aolr) 287 if err != nil { 288 return err 289 } 290 page.aolr = next 291 if !next.hasNextLink() || !next.IsEmpty() { 292 break 293 } 294 } 295 return nil 296} 297 298// Next advances to the next page of values. If there was an error making 299// the request the page does not advance and the error is returned. 300// Deprecated: Use NextWithContext() instead. 301func (page *AvailableOperationsListResponsePage) Next() error { 302 return page.NextWithContext(context.Background()) 303} 304 305// NotDone returns true if the page enumeration should be started or is not yet complete. 306func (page AvailableOperationsListResponsePage) NotDone() bool { 307 return !page.aolr.IsEmpty() 308} 309 310// Response returns the raw server response from the last page request. 311func (page AvailableOperationsListResponsePage) Response() AvailableOperationsListResponse { 312 return page.aolr 313} 314 315// Values returns the slice of values for the current page or nil if there are no values. 316func (page AvailableOperationsListResponsePage) Values() []AvailableOperation { 317 if page.aolr.IsEmpty() { 318 return nil 319 } 320 return *page.aolr.Value 321} 322 323// Creates a new instance of the AvailableOperationsListResponsePage type. 324func NewAvailableOperationsListResponsePage(cur AvailableOperationsListResponse, getNextPage func(context.Context, AvailableOperationsListResponse) (AvailableOperationsListResponse, error)) AvailableOperationsListResponsePage { 325 return AvailableOperationsListResponsePage{ 326 fn: getNextPage, 327 aolr: cur, 328 } 329} 330 331// CSRPError general error model 332type CSRPError struct { 333 // Error - Error's body 334 Error *CSRPErrorBody `json:"error,omitempty"` 335} 336 337// CSRPErrorBody error properties 338type CSRPErrorBody struct { 339 // Code - READ-ONLY; Error's code 340 Code *string `json:"code,omitempty"` 341 // Details - READ-ONLY; Error's details 342 Details *[]CSRPErrorBody `json:"details,omitempty"` 343 // Message - READ-ONLY; Error's message 344 Message *string `json:"message,omitempty"` 345 // Target - Error's target 346 Target *string `json:"target,omitempty"` 347} 348 349// MarshalJSON is the custom marshaler for CSRPErrorBody. 350func (ceb CSRPErrorBody) MarshalJSON() ([]byte, error) { 351 objectMap := make(map[string]interface{}) 352 if ceb.Target != nil { 353 objectMap["target"] = ceb.Target 354 } 355 return json.Marshal(objectMap) 356} 357 358// CustomizationHostName host name model 359type CustomizationHostName struct { 360 // Name - Hostname 361 Name *string `json:"name,omitempty"` 362 // Type - Type of host name. Possible values include: 'USERDEFINED', 'PREFIXBASED', 'FIXED', 'VIRTUALMACHINENAME', 'CUSTOMNAME' 363 Type Type `json:"type,omitempty"` 364} 365 366// CustomizationIdentity ... 367type CustomizationIdentity struct { 368 // Data - Windows Text Identity. Prepared data 369 Data *string `json:"data,omitempty"` 370 // HostName - Virtual machine host name settings 371 HostName *CustomizationHostName `json:"hostName,omitempty"` 372 // Type - Identity type. Possible values include: 'WINDOWSTEXT', 'WINDOWS', 'LINUX' 373 Type Type2 `json:"type,omitempty"` 374 // UserData - Windows Identity. User data customization 375 UserData *CustomizationIdentityUserData `json:"userData,omitempty"` 376} 377 378// CustomizationIdentityUserData windows Identity. User data customization 379type CustomizationIdentityUserData struct { 380 // IsPasswordPredefined - Is password predefined in customization policy 381 IsPasswordPredefined *bool `json:"isPasswordPredefined,omitempty"` 382} 383 384// CustomizationIPAddress ... 385type CustomizationIPAddress struct { 386 // Argument - Argument when Custom ip type is selected 387 Argument *string `json:"argument,omitempty"` 388 // IPAddress - Defined Ip Address when Fixed ip type is selected 389 IPAddress *string `json:"ipAddress,omitempty"` 390 // Type - Customization Specification ip type. Possible values include: 'Type1CUSTOM', 'Type1DHCPIP', 'Type1FIXEDIP', 'Type1USERDEFINED' 391 Type Type1 `json:"type,omitempty"` 392} 393 394// CustomizationIPSettings ... 395type CustomizationIPSettings struct { 396 // Gateway - The list of gateways 397 Gateway *[]string `json:"gateway,omitempty"` 398 // IP - Ip address customization settings 399 IP *CustomizationIPAddress `json:"ip,omitempty"` 400 // SubnetMask - Adapter subnet mask 401 SubnetMask *string `json:"subnetMask,omitempty"` 402} 403 404// CustomizationNicSetting ... 405type CustomizationNicSetting struct { 406 // Adapter - The list of adapters' settings 407 Adapter *CustomizationIPSettings `json:"adapter,omitempty"` 408 // MacAddress - NIC mac address 409 MacAddress *string `json:"macAddress,omitempty"` 410} 411 412// CustomizationPoliciesListResponse list of customization polices response model 413type CustomizationPoliciesListResponse struct { 414 autorest.Response `json:"-"` 415 // NextLink - Link for next list of the Customization policy 416 NextLink *string `json:"nextLink,omitempty"` 417 // Value - List of the customization policies 418 Value *[]CustomizationPolicy `json:"value,omitempty"` 419} 420 421// CustomizationPoliciesListResponseIterator provides access to a complete listing of CustomizationPolicy 422// values. 423type CustomizationPoliciesListResponseIterator struct { 424 i int 425 page CustomizationPoliciesListResponsePage 426} 427 428// NextWithContext advances to the next value. If there was an error making 429// the request the iterator does not advance and the error is returned. 430func (iter *CustomizationPoliciesListResponseIterator) NextWithContext(ctx context.Context) (err error) { 431 if tracing.IsEnabled() { 432 ctx = tracing.StartSpan(ctx, fqdn+"/CustomizationPoliciesListResponseIterator.NextWithContext") 433 defer func() { 434 sc := -1 435 if iter.Response().Response.Response != nil { 436 sc = iter.Response().Response.Response.StatusCode 437 } 438 tracing.EndSpan(ctx, sc, err) 439 }() 440 } 441 iter.i++ 442 if iter.i < len(iter.page.Values()) { 443 return nil 444 } 445 err = iter.page.NextWithContext(ctx) 446 if err != nil { 447 iter.i-- 448 return err 449 } 450 iter.i = 0 451 return nil 452} 453 454// Next advances to the next value. If there was an error making 455// the request the iterator does not advance and the error is returned. 456// Deprecated: Use NextWithContext() instead. 457func (iter *CustomizationPoliciesListResponseIterator) Next() error { 458 return iter.NextWithContext(context.Background()) 459} 460 461// NotDone returns true if the enumeration should be started or is not yet complete. 462func (iter CustomizationPoliciesListResponseIterator) NotDone() bool { 463 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 464} 465 466// Response returns the raw server response from the last page request. 467func (iter CustomizationPoliciesListResponseIterator) Response() CustomizationPoliciesListResponse { 468 return iter.page.Response() 469} 470 471// Value returns the current value or a zero-initialized value if the 472// iterator has advanced beyond the end of the collection. 473func (iter CustomizationPoliciesListResponseIterator) Value() CustomizationPolicy { 474 if !iter.page.NotDone() { 475 return CustomizationPolicy{} 476 } 477 return iter.page.Values()[iter.i] 478} 479 480// Creates a new instance of the CustomizationPoliciesListResponseIterator type. 481func NewCustomizationPoliciesListResponseIterator(page CustomizationPoliciesListResponsePage) CustomizationPoliciesListResponseIterator { 482 return CustomizationPoliciesListResponseIterator{page: page} 483} 484 485// IsEmpty returns true if the ListResult contains no values. 486func (cplr CustomizationPoliciesListResponse) IsEmpty() bool { 487 return cplr.Value == nil || len(*cplr.Value) == 0 488} 489 490// hasNextLink returns true if the NextLink is not empty. 491func (cplr CustomizationPoliciesListResponse) hasNextLink() bool { 492 return cplr.NextLink != nil && len(*cplr.NextLink) != 0 493} 494 495// customizationPoliciesListResponsePreparer prepares a request to retrieve the next set of results. 496// It returns nil if no more results exist. 497func (cplr CustomizationPoliciesListResponse) customizationPoliciesListResponsePreparer(ctx context.Context) (*http.Request, error) { 498 if !cplr.hasNextLink() { 499 return nil, nil 500 } 501 return autorest.Prepare((&http.Request{}).WithContext(ctx), 502 autorest.AsJSON(), 503 autorest.AsGet(), 504 autorest.WithBaseURL(to.String(cplr.NextLink))) 505} 506 507// CustomizationPoliciesListResponsePage contains a page of CustomizationPolicy values. 508type CustomizationPoliciesListResponsePage struct { 509 fn func(context.Context, CustomizationPoliciesListResponse) (CustomizationPoliciesListResponse, error) 510 cplr CustomizationPoliciesListResponse 511} 512 513// NextWithContext advances to the next page of values. If there was an error making 514// the request the page does not advance and the error is returned. 515func (page *CustomizationPoliciesListResponsePage) NextWithContext(ctx context.Context) (err error) { 516 if tracing.IsEnabled() { 517 ctx = tracing.StartSpan(ctx, fqdn+"/CustomizationPoliciesListResponsePage.NextWithContext") 518 defer func() { 519 sc := -1 520 if page.Response().Response.Response != nil { 521 sc = page.Response().Response.Response.StatusCode 522 } 523 tracing.EndSpan(ctx, sc, err) 524 }() 525 } 526 for { 527 next, err := page.fn(ctx, page.cplr) 528 if err != nil { 529 return err 530 } 531 page.cplr = next 532 if !next.hasNextLink() || !next.IsEmpty() { 533 break 534 } 535 } 536 return nil 537} 538 539// Next advances to the next page of values. If there was an error making 540// the request the page does not advance and the error is returned. 541// Deprecated: Use NextWithContext() instead. 542func (page *CustomizationPoliciesListResponsePage) Next() error { 543 return page.NextWithContext(context.Background()) 544} 545 546// NotDone returns true if the page enumeration should be started or is not yet complete. 547func (page CustomizationPoliciesListResponsePage) NotDone() bool { 548 return !page.cplr.IsEmpty() 549} 550 551// Response returns the raw server response from the last page request. 552func (page CustomizationPoliciesListResponsePage) Response() CustomizationPoliciesListResponse { 553 return page.cplr 554} 555 556// Values returns the slice of values for the current page or nil if there are no values. 557func (page CustomizationPoliciesListResponsePage) Values() []CustomizationPolicy { 558 if page.cplr.IsEmpty() { 559 return nil 560 } 561 return *page.cplr.Value 562} 563 564// Creates a new instance of the CustomizationPoliciesListResponsePage type. 565func NewCustomizationPoliciesListResponsePage(cur CustomizationPoliciesListResponse, getNextPage func(context.Context, CustomizationPoliciesListResponse) (CustomizationPoliciesListResponse, error)) CustomizationPoliciesListResponsePage { 566 return CustomizationPoliciesListResponsePage{ 567 fn: getNextPage, 568 cplr: cur, 569 } 570} 571 572// CustomizationPolicy the virtual machine customization policy 573type CustomizationPolicy struct { 574 autorest.Response `json:"-"` 575 // ID - Customization policy azure id 576 ID *string `json:"id,omitempty"` 577 // Location - Azure region 578 Location *string `json:"location,omitempty"` 579 // Name - READ-ONLY; Customization policy name 580 Name *string `json:"name,omitempty"` 581 // CustomizationPolicyProperties - Customization Policy properties 582 *CustomizationPolicyProperties `json:"properties,omitempty"` 583 // Type - READ-ONLY 584 Type *string `json:"type,omitempty"` 585} 586 587// MarshalJSON is the custom marshaler for CustomizationPolicy. 588func (cp CustomizationPolicy) MarshalJSON() ([]byte, error) { 589 objectMap := make(map[string]interface{}) 590 if cp.ID != nil { 591 objectMap["id"] = cp.ID 592 } 593 if cp.Location != nil { 594 objectMap["location"] = cp.Location 595 } 596 if cp.CustomizationPolicyProperties != nil { 597 objectMap["properties"] = cp.CustomizationPolicyProperties 598 } 599 return json.Marshal(objectMap) 600} 601 602// UnmarshalJSON is the custom unmarshaler for CustomizationPolicy struct. 603func (cp *CustomizationPolicy) UnmarshalJSON(body []byte) error { 604 var m map[string]*json.RawMessage 605 err := json.Unmarshal(body, &m) 606 if err != nil { 607 return err 608 } 609 for k, v := range m { 610 switch k { 611 case "id": 612 if v != nil { 613 var ID string 614 err = json.Unmarshal(*v, &ID) 615 if err != nil { 616 return err 617 } 618 cp.ID = &ID 619 } 620 case "location": 621 if v != nil { 622 var location string 623 err = json.Unmarshal(*v, &location) 624 if err != nil { 625 return err 626 } 627 cp.Location = &location 628 } 629 case "name": 630 if v != nil { 631 var name string 632 err = json.Unmarshal(*v, &name) 633 if err != nil { 634 return err 635 } 636 cp.Name = &name 637 } 638 case "properties": 639 if v != nil { 640 var customizationPolicyProperties CustomizationPolicyProperties 641 err = json.Unmarshal(*v, &customizationPolicyProperties) 642 if err != nil { 643 return err 644 } 645 cp.CustomizationPolicyProperties = &customizationPolicyProperties 646 } 647 case "type": 648 if v != nil { 649 var typeVar string 650 err = json.Unmarshal(*v, &typeVar) 651 if err != nil { 652 return err 653 } 654 cp.Type = &typeVar 655 } 656 } 657 } 658 659 return nil 660} 661 662// CustomizationPolicyProperties the properties of Customization policy 663type CustomizationPolicyProperties struct { 664 // Description - Policy description 665 Description *string `json:"description,omitempty"` 666 // PrivateCloudID - The Private cloud id 667 PrivateCloudID *string `json:"privateCloudId,omitempty"` 668 // Specification - Detailed customization policy specification 669 Specification *CustomizationSpecification `json:"specification,omitempty"` 670 // Type - The type of customization (Linux or Windows). Possible values include: 'Type3LINUX', 'Type3WINDOWS' 671 Type Type3 `json:"type,omitempty"` 672 // Version - Policy version 673 Version *string `json:"version,omitempty"` 674} 675 676// CustomizationSpecification the specification for Customization Policy 677type CustomizationSpecification struct { 678 // Identity - Customization Identity. It contains data about user and hostname 679 Identity *CustomizationIdentity `json:"identity,omitempty"` 680 // NicSettings - Network interface settings 681 NicSettings *[]CustomizationNicSetting `json:"nicSettings,omitempty"` 682} 683 684// DedicatedCloudNode dedicated cloud node model 685type DedicatedCloudNode struct { 686 autorest.Response `json:"-"` 687 // ID - READ-ONLY; /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/dedicatedCloudNodes/{dedicatedCloudNodeName} 688 ID *string `json:"id,omitempty"` 689 // Location - Azure region 690 Location *string `json:"location,omitempty"` 691 // Name - READ-ONLY; {dedicatedCloudNodeName} 692 Name *string `json:"name,omitempty"` 693 // DedicatedCloudNodeProperties - Dedicated Cloud Nodes properties 694 *DedicatedCloudNodeProperties `json:"properties,omitempty"` 695 // Sku - Dedicated Cloud Nodes SKU 696 Sku *Sku `json:"sku,omitempty"` 697 // Tags - Dedicated Cloud Nodes tags 698 Tags map[string]*string `json:"tags"` 699 // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} 700 Type *string `json:"type,omitempty"` 701} 702 703// MarshalJSON is the custom marshaler for DedicatedCloudNode. 704func (dcn DedicatedCloudNode) MarshalJSON() ([]byte, error) { 705 objectMap := make(map[string]interface{}) 706 if dcn.Location != nil { 707 objectMap["location"] = dcn.Location 708 } 709 if dcn.DedicatedCloudNodeProperties != nil { 710 objectMap["properties"] = dcn.DedicatedCloudNodeProperties 711 } 712 if dcn.Sku != nil { 713 objectMap["sku"] = dcn.Sku 714 } 715 if dcn.Tags != nil { 716 objectMap["tags"] = dcn.Tags 717 } 718 return json.Marshal(objectMap) 719} 720 721// UnmarshalJSON is the custom unmarshaler for DedicatedCloudNode struct. 722func (dcn *DedicatedCloudNode) UnmarshalJSON(body []byte) error { 723 var m map[string]*json.RawMessage 724 err := json.Unmarshal(body, &m) 725 if err != nil { 726 return err 727 } 728 for k, v := range m { 729 switch k { 730 case "id": 731 if v != nil { 732 var ID string 733 err = json.Unmarshal(*v, &ID) 734 if err != nil { 735 return err 736 } 737 dcn.ID = &ID 738 } 739 case "location": 740 if v != nil { 741 var location string 742 err = json.Unmarshal(*v, &location) 743 if err != nil { 744 return err 745 } 746 dcn.Location = &location 747 } 748 case "name": 749 if v != nil { 750 var name string 751 err = json.Unmarshal(*v, &name) 752 if err != nil { 753 return err 754 } 755 dcn.Name = &name 756 } 757 case "properties": 758 if v != nil { 759 var dedicatedCloudNodeProperties DedicatedCloudNodeProperties 760 err = json.Unmarshal(*v, &dedicatedCloudNodeProperties) 761 if err != nil { 762 return err 763 } 764 dcn.DedicatedCloudNodeProperties = &dedicatedCloudNodeProperties 765 } 766 case "sku": 767 if v != nil { 768 var sku Sku 769 err = json.Unmarshal(*v, &sku) 770 if err != nil { 771 return err 772 } 773 dcn.Sku = &sku 774 } 775 case "tags": 776 if v != nil { 777 var tags map[string]*string 778 err = json.Unmarshal(*v, &tags) 779 if err != nil { 780 return err 781 } 782 dcn.Tags = tags 783 } 784 case "type": 785 if v != nil { 786 var typeVar string 787 err = json.Unmarshal(*v, &typeVar) 788 if err != nil { 789 return err 790 } 791 dcn.Type = &typeVar 792 } 793 } 794 } 795 796 return nil 797} 798 799// DedicatedCloudNodeListResponse list of dedicated nodes response model 800type DedicatedCloudNodeListResponse struct { 801 autorest.Response `json:"-"` 802 // NextLink - Link for next list of DedicatedCloudNode 803 NextLink *string `json:"nextLink,omitempty"` 804 // Value - Results of the DedicatedCloudNode list 805 Value *[]DedicatedCloudNode `json:"value,omitempty"` 806} 807 808// DedicatedCloudNodeListResponseIterator provides access to a complete listing of DedicatedCloudNode 809// values. 810type DedicatedCloudNodeListResponseIterator struct { 811 i int 812 page DedicatedCloudNodeListResponsePage 813} 814 815// NextWithContext advances to the next value. If there was an error making 816// the request the iterator does not advance and the error is returned. 817func (iter *DedicatedCloudNodeListResponseIterator) NextWithContext(ctx context.Context) (err error) { 818 if tracing.IsEnabled() { 819 ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeListResponseIterator.NextWithContext") 820 defer func() { 821 sc := -1 822 if iter.Response().Response.Response != nil { 823 sc = iter.Response().Response.Response.StatusCode 824 } 825 tracing.EndSpan(ctx, sc, err) 826 }() 827 } 828 iter.i++ 829 if iter.i < len(iter.page.Values()) { 830 return nil 831 } 832 err = iter.page.NextWithContext(ctx) 833 if err != nil { 834 iter.i-- 835 return err 836 } 837 iter.i = 0 838 return nil 839} 840 841// Next advances to the next value. If there was an error making 842// the request the iterator does not advance and the error is returned. 843// Deprecated: Use NextWithContext() instead. 844func (iter *DedicatedCloudNodeListResponseIterator) Next() error { 845 return iter.NextWithContext(context.Background()) 846} 847 848// NotDone returns true if the enumeration should be started or is not yet complete. 849func (iter DedicatedCloudNodeListResponseIterator) NotDone() bool { 850 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 851} 852 853// Response returns the raw server response from the last page request. 854func (iter DedicatedCloudNodeListResponseIterator) Response() DedicatedCloudNodeListResponse { 855 return iter.page.Response() 856} 857 858// Value returns the current value or a zero-initialized value if the 859// iterator has advanced beyond the end of the collection. 860func (iter DedicatedCloudNodeListResponseIterator) Value() DedicatedCloudNode { 861 if !iter.page.NotDone() { 862 return DedicatedCloudNode{} 863 } 864 return iter.page.Values()[iter.i] 865} 866 867// Creates a new instance of the DedicatedCloudNodeListResponseIterator type. 868func NewDedicatedCloudNodeListResponseIterator(page DedicatedCloudNodeListResponsePage) DedicatedCloudNodeListResponseIterator { 869 return DedicatedCloudNodeListResponseIterator{page: page} 870} 871 872// IsEmpty returns true if the ListResult contains no values. 873func (dcnlr DedicatedCloudNodeListResponse) IsEmpty() bool { 874 return dcnlr.Value == nil || len(*dcnlr.Value) == 0 875} 876 877// hasNextLink returns true if the NextLink is not empty. 878func (dcnlr DedicatedCloudNodeListResponse) hasNextLink() bool { 879 return dcnlr.NextLink != nil && len(*dcnlr.NextLink) != 0 880} 881 882// dedicatedCloudNodeListResponsePreparer prepares a request to retrieve the next set of results. 883// It returns nil if no more results exist. 884func (dcnlr DedicatedCloudNodeListResponse) dedicatedCloudNodeListResponsePreparer(ctx context.Context) (*http.Request, error) { 885 if !dcnlr.hasNextLink() { 886 return nil, nil 887 } 888 return autorest.Prepare((&http.Request{}).WithContext(ctx), 889 autorest.AsJSON(), 890 autorest.AsGet(), 891 autorest.WithBaseURL(to.String(dcnlr.NextLink))) 892} 893 894// DedicatedCloudNodeListResponsePage contains a page of DedicatedCloudNode values. 895type DedicatedCloudNodeListResponsePage struct { 896 fn func(context.Context, DedicatedCloudNodeListResponse) (DedicatedCloudNodeListResponse, error) 897 dcnlr DedicatedCloudNodeListResponse 898} 899 900// NextWithContext advances to the next page of values. If there was an error making 901// the request the page does not advance and the error is returned. 902func (page *DedicatedCloudNodeListResponsePage) NextWithContext(ctx context.Context) (err error) { 903 if tracing.IsEnabled() { 904 ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudNodeListResponsePage.NextWithContext") 905 defer func() { 906 sc := -1 907 if page.Response().Response.Response != nil { 908 sc = page.Response().Response.Response.StatusCode 909 } 910 tracing.EndSpan(ctx, sc, err) 911 }() 912 } 913 for { 914 next, err := page.fn(ctx, page.dcnlr) 915 if err != nil { 916 return err 917 } 918 page.dcnlr = next 919 if !next.hasNextLink() || !next.IsEmpty() { 920 break 921 } 922 } 923 return nil 924} 925 926// Next advances to the next page of values. If there was an error making 927// the request the page does not advance and the error is returned. 928// Deprecated: Use NextWithContext() instead. 929func (page *DedicatedCloudNodeListResponsePage) Next() error { 930 return page.NextWithContext(context.Background()) 931} 932 933// NotDone returns true if the page enumeration should be started or is not yet complete. 934func (page DedicatedCloudNodeListResponsePage) NotDone() bool { 935 return !page.dcnlr.IsEmpty() 936} 937 938// Response returns the raw server response from the last page request. 939func (page DedicatedCloudNodeListResponsePage) Response() DedicatedCloudNodeListResponse { 940 return page.dcnlr 941} 942 943// Values returns the slice of values for the current page or nil if there are no values. 944func (page DedicatedCloudNodeListResponsePage) Values() []DedicatedCloudNode { 945 if page.dcnlr.IsEmpty() { 946 return nil 947 } 948 return *page.dcnlr.Value 949} 950 951// Creates a new instance of the DedicatedCloudNodeListResponsePage type. 952func NewDedicatedCloudNodeListResponsePage(cur DedicatedCloudNodeListResponse, getNextPage func(context.Context, DedicatedCloudNodeListResponse) (DedicatedCloudNodeListResponse, error)) DedicatedCloudNodeListResponsePage { 953 return DedicatedCloudNodeListResponsePage{ 954 fn: getNextPage, 955 dcnlr: cur, 956 } 957} 958 959// DedicatedCloudNodeProperties properties of dedicated cloud node 960type DedicatedCloudNodeProperties struct { 961 // AvailabilityZoneID - Availability Zone id, e.g. "az1" 962 AvailabilityZoneID *string `json:"availabilityZoneId,omitempty"` 963 // AvailabilityZoneName - READ-ONLY; Availability Zone name, e.g. "Availability Zone 1" 964 AvailabilityZoneName *string `json:"availabilityZoneName,omitempty"` 965 // CloudRackName - READ-ONLY; VMWare Cloud Rack Name 966 CloudRackName *string `json:"cloudRackName,omitempty"` 967 // Created - READ-ONLY; date time the resource was created 968 Created interface{} `json:"created,omitempty"` 969 // NodesCount - count of nodes to create 970 NodesCount *int32 `json:"nodesCount,omitempty"` 971 // PlacementGroupID - Placement Group id, e.g. "n1" 972 PlacementGroupID *string `json:"placementGroupId,omitempty"` 973 // PlacementGroupName - READ-ONLY; Placement Name, e.g. "Placement Group 1" 974 PlacementGroupName *string `json:"placementGroupName,omitempty"` 975 // PrivateCloudID - READ-ONLY; Private Cloud Id 976 PrivateCloudID *string `json:"privateCloudId,omitempty"` 977 // PrivateCloudName - READ-ONLY; Resource Pool Name 978 PrivateCloudName *string `json:"privateCloudName,omitempty"` 979 // ProvisioningState - READ-ONLY; The provisioning status of the resource 980 ProvisioningState *string `json:"provisioningState,omitempty"` 981 // PurchaseID - purchase id 982 PurchaseID *uuid.UUID `json:"purchaseId,omitempty"` 983 // SkuDescription - Dedicated Cloud Nodes SKU's description 984 *SkuDescription `json:"skuDescription,omitempty"` 985 // Status - READ-ONLY; Node status, indicates is private cloud set up on this node or not. Possible values include: 'Unused', 'Used' 986 Status NodeStatus `json:"status,omitempty"` 987 // VmwareClusterName - READ-ONLY; VMWare Cluster Name 988 VmwareClusterName *string `json:"vmwareClusterName,omitempty"` 989} 990 991// MarshalJSON is the custom marshaler for DedicatedCloudNodeProperties. 992func (dcnp DedicatedCloudNodeProperties) MarshalJSON() ([]byte, error) { 993 objectMap := make(map[string]interface{}) 994 if dcnp.AvailabilityZoneID != nil { 995 objectMap["availabilityZoneId"] = dcnp.AvailabilityZoneID 996 } 997 if dcnp.NodesCount != nil { 998 objectMap["nodesCount"] = dcnp.NodesCount 999 } 1000 if dcnp.PlacementGroupID != nil { 1001 objectMap["placementGroupId"] = dcnp.PlacementGroupID 1002 } 1003 if dcnp.PurchaseID != nil { 1004 objectMap["purchaseId"] = dcnp.PurchaseID 1005 } 1006 if dcnp.SkuDescription != nil { 1007 objectMap["skuDescription"] = dcnp.SkuDescription 1008 } 1009 return json.Marshal(objectMap) 1010} 1011 1012// UnmarshalJSON is the custom unmarshaler for DedicatedCloudNodeProperties struct. 1013func (dcnp *DedicatedCloudNodeProperties) UnmarshalJSON(body []byte) error { 1014 var m map[string]*json.RawMessage 1015 err := json.Unmarshal(body, &m) 1016 if err != nil { 1017 return err 1018 } 1019 for k, v := range m { 1020 switch k { 1021 case "availabilityZoneId": 1022 if v != nil { 1023 var availabilityZoneID string 1024 err = json.Unmarshal(*v, &availabilityZoneID) 1025 if err != nil { 1026 return err 1027 } 1028 dcnp.AvailabilityZoneID = &availabilityZoneID 1029 } 1030 case "availabilityZoneName": 1031 if v != nil { 1032 var availabilityZoneName string 1033 err = json.Unmarshal(*v, &availabilityZoneName) 1034 if err != nil { 1035 return err 1036 } 1037 dcnp.AvailabilityZoneName = &availabilityZoneName 1038 } 1039 case "cloudRackName": 1040 if v != nil { 1041 var cloudRackName string 1042 err = json.Unmarshal(*v, &cloudRackName) 1043 if err != nil { 1044 return err 1045 } 1046 dcnp.CloudRackName = &cloudRackName 1047 } 1048 case "created": 1049 if v != nil { 1050 var created interface{} 1051 err = json.Unmarshal(*v, &created) 1052 if err != nil { 1053 return err 1054 } 1055 dcnp.Created = created 1056 } 1057 case "nodesCount": 1058 if v != nil { 1059 var nodesCount int32 1060 err = json.Unmarshal(*v, &nodesCount) 1061 if err != nil { 1062 return err 1063 } 1064 dcnp.NodesCount = &nodesCount 1065 } 1066 case "placementGroupId": 1067 if v != nil { 1068 var placementGroupID string 1069 err = json.Unmarshal(*v, &placementGroupID) 1070 if err != nil { 1071 return err 1072 } 1073 dcnp.PlacementGroupID = &placementGroupID 1074 } 1075 case "placementGroupName": 1076 if v != nil { 1077 var placementGroupName string 1078 err = json.Unmarshal(*v, &placementGroupName) 1079 if err != nil { 1080 return err 1081 } 1082 dcnp.PlacementGroupName = &placementGroupName 1083 } 1084 case "privateCloudId": 1085 if v != nil { 1086 var privateCloudID string 1087 err = json.Unmarshal(*v, &privateCloudID) 1088 if err != nil { 1089 return err 1090 } 1091 dcnp.PrivateCloudID = &privateCloudID 1092 } 1093 case "privateCloudName": 1094 if v != nil { 1095 var privateCloudName string 1096 err = json.Unmarshal(*v, &privateCloudName) 1097 if err != nil { 1098 return err 1099 } 1100 dcnp.PrivateCloudName = &privateCloudName 1101 } 1102 case "provisioningState": 1103 if v != nil { 1104 var provisioningState string 1105 err = json.Unmarshal(*v, &provisioningState) 1106 if err != nil { 1107 return err 1108 } 1109 dcnp.ProvisioningState = &provisioningState 1110 } 1111 case "purchaseId": 1112 if v != nil { 1113 var purchaseID uuid.UUID 1114 err = json.Unmarshal(*v, &purchaseID) 1115 if err != nil { 1116 return err 1117 } 1118 dcnp.PurchaseID = &purchaseID 1119 } 1120 case "skuDescription": 1121 if v != nil { 1122 var skuDescription SkuDescription 1123 err = json.Unmarshal(*v, &skuDescription) 1124 if err != nil { 1125 return err 1126 } 1127 dcnp.SkuDescription = &skuDescription 1128 } 1129 case "status": 1130 if v != nil { 1131 var status NodeStatus 1132 err = json.Unmarshal(*v, &status) 1133 if err != nil { 1134 return err 1135 } 1136 dcnp.Status = status 1137 } 1138 case "vmwareClusterName": 1139 if v != nil { 1140 var vmwareClusterName string 1141 err = json.Unmarshal(*v, &vmwareClusterName) 1142 if err != nil { 1143 return err 1144 } 1145 dcnp.VmwareClusterName = &vmwareClusterName 1146 } 1147 } 1148 } 1149 1150 return nil 1151} 1152 1153// DedicatedCloudNodesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1154// long-running operation. 1155type DedicatedCloudNodesCreateOrUpdateFuture struct { 1156 azure.FutureAPI 1157 // Result returns the result of the asynchronous operation. 1158 // If the operation has not completed it will return an error. 1159 Result func(DedicatedCloudNodesClient) (DedicatedCloudNode, error) 1160} 1161 1162// DedicatedCloudService dedicated cloud service model 1163type DedicatedCloudService struct { 1164 autorest.Response `json:"-"` 1165 // ID - READ-ONLY; /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/dedicatedCloudServices/{dedicatedCloudServiceName} 1166 ID *string `json:"id,omitempty"` 1167 // Location - Azure region 1168 Location *string `json:"location,omitempty"` 1169 // Name - READ-ONLY; {dedicatedCloudServiceName} 1170 Name *string `json:"name,omitempty"` 1171 // DedicatedCloudServiceProperties - The properties of Dedicated Node Service 1172 *DedicatedCloudServiceProperties `json:"properties,omitempty"` 1173 // Tags - The list of tags 1174 Tags map[string]*string `json:"tags"` 1175 // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} 1176 Type *string `json:"type,omitempty"` 1177} 1178 1179// MarshalJSON is the custom marshaler for DedicatedCloudService. 1180func (dcs DedicatedCloudService) MarshalJSON() ([]byte, error) { 1181 objectMap := make(map[string]interface{}) 1182 if dcs.Location != nil { 1183 objectMap["location"] = dcs.Location 1184 } 1185 if dcs.DedicatedCloudServiceProperties != nil { 1186 objectMap["properties"] = dcs.DedicatedCloudServiceProperties 1187 } 1188 if dcs.Tags != nil { 1189 objectMap["tags"] = dcs.Tags 1190 } 1191 return json.Marshal(objectMap) 1192} 1193 1194// UnmarshalJSON is the custom unmarshaler for DedicatedCloudService struct. 1195func (dcs *DedicatedCloudService) UnmarshalJSON(body []byte) error { 1196 var m map[string]*json.RawMessage 1197 err := json.Unmarshal(body, &m) 1198 if err != nil { 1199 return err 1200 } 1201 for k, v := range m { 1202 switch k { 1203 case "id": 1204 if v != nil { 1205 var ID string 1206 err = json.Unmarshal(*v, &ID) 1207 if err != nil { 1208 return err 1209 } 1210 dcs.ID = &ID 1211 } 1212 case "location": 1213 if v != nil { 1214 var location string 1215 err = json.Unmarshal(*v, &location) 1216 if err != nil { 1217 return err 1218 } 1219 dcs.Location = &location 1220 } 1221 case "name": 1222 if v != nil { 1223 var name string 1224 err = json.Unmarshal(*v, &name) 1225 if err != nil { 1226 return err 1227 } 1228 dcs.Name = &name 1229 } 1230 case "properties": 1231 if v != nil { 1232 var dedicatedCloudServiceProperties DedicatedCloudServiceProperties 1233 err = json.Unmarshal(*v, &dedicatedCloudServiceProperties) 1234 if err != nil { 1235 return err 1236 } 1237 dcs.DedicatedCloudServiceProperties = &dedicatedCloudServiceProperties 1238 } 1239 case "tags": 1240 if v != nil { 1241 var tags map[string]*string 1242 err = json.Unmarshal(*v, &tags) 1243 if err != nil { 1244 return err 1245 } 1246 dcs.Tags = tags 1247 } 1248 case "type": 1249 if v != nil { 1250 var typeVar string 1251 err = json.Unmarshal(*v, &typeVar) 1252 if err != nil { 1253 return err 1254 } 1255 dcs.Type = &typeVar 1256 } 1257 } 1258 } 1259 1260 return nil 1261} 1262 1263// DedicatedCloudServiceListResponse list of dedicated cloud services 1264type DedicatedCloudServiceListResponse struct { 1265 autorest.Response `json:"-"` 1266 // NextLink - Link for next list of DedicatedCloudNode 1267 NextLink *string `json:"nextLink,omitempty"` 1268 // Value - Results of the DedicatedCloudService list 1269 Value *[]DedicatedCloudService `json:"value,omitempty"` 1270} 1271 1272// DedicatedCloudServiceListResponseIterator provides access to a complete listing of DedicatedCloudService 1273// values. 1274type DedicatedCloudServiceListResponseIterator struct { 1275 i int 1276 page DedicatedCloudServiceListResponsePage 1277} 1278 1279// NextWithContext advances to the next value. If there was an error making 1280// the request the iterator does not advance and the error is returned. 1281func (iter *DedicatedCloudServiceListResponseIterator) NextWithContext(ctx context.Context) (err error) { 1282 if tracing.IsEnabled() { 1283 ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceListResponseIterator.NextWithContext") 1284 defer func() { 1285 sc := -1 1286 if iter.Response().Response.Response != nil { 1287 sc = iter.Response().Response.Response.StatusCode 1288 } 1289 tracing.EndSpan(ctx, sc, err) 1290 }() 1291 } 1292 iter.i++ 1293 if iter.i < len(iter.page.Values()) { 1294 return nil 1295 } 1296 err = iter.page.NextWithContext(ctx) 1297 if err != nil { 1298 iter.i-- 1299 return err 1300 } 1301 iter.i = 0 1302 return nil 1303} 1304 1305// Next advances to the next value. If there was an error making 1306// the request the iterator does not advance and the error is returned. 1307// Deprecated: Use NextWithContext() instead. 1308func (iter *DedicatedCloudServiceListResponseIterator) Next() error { 1309 return iter.NextWithContext(context.Background()) 1310} 1311 1312// NotDone returns true if the enumeration should be started or is not yet complete. 1313func (iter DedicatedCloudServiceListResponseIterator) NotDone() bool { 1314 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1315} 1316 1317// Response returns the raw server response from the last page request. 1318func (iter DedicatedCloudServiceListResponseIterator) Response() DedicatedCloudServiceListResponse { 1319 return iter.page.Response() 1320} 1321 1322// Value returns the current value or a zero-initialized value if the 1323// iterator has advanced beyond the end of the collection. 1324func (iter DedicatedCloudServiceListResponseIterator) Value() DedicatedCloudService { 1325 if !iter.page.NotDone() { 1326 return DedicatedCloudService{} 1327 } 1328 return iter.page.Values()[iter.i] 1329} 1330 1331// Creates a new instance of the DedicatedCloudServiceListResponseIterator type. 1332func NewDedicatedCloudServiceListResponseIterator(page DedicatedCloudServiceListResponsePage) DedicatedCloudServiceListResponseIterator { 1333 return DedicatedCloudServiceListResponseIterator{page: page} 1334} 1335 1336// IsEmpty returns true if the ListResult contains no values. 1337func (dcslr DedicatedCloudServiceListResponse) IsEmpty() bool { 1338 return dcslr.Value == nil || len(*dcslr.Value) == 0 1339} 1340 1341// hasNextLink returns true if the NextLink is not empty. 1342func (dcslr DedicatedCloudServiceListResponse) hasNextLink() bool { 1343 return dcslr.NextLink != nil && len(*dcslr.NextLink) != 0 1344} 1345 1346// dedicatedCloudServiceListResponsePreparer prepares a request to retrieve the next set of results. 1347// It returns nil if no more results exist. 1348func (dcslr DedicatedCloudServiceListResponse) dedicatedCloudServiceListResponsePreparer(ctx context.Context) (*http.Request, error) { 1349 if !dcslr.hasNextLink() { 1350 return nil, nil 1351 } 1352 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1353 autorest.AsJSON(), 1354 autorest.AsGet(), 1355 autorest.WithBaseURL(to.String(dcslr.NextLink))) 1356} 1357 1358// DedicatedCloudServiceListResponsePage contains a page of DedicatedCloudService values. 1359type DedicatedCloudServiceListResponsePage struct { 1360 fn func(context.Context, DedicatedCloudServiceListResponse) (DedicatedCloudServiceListResponse, error) 1361 dcslr DedicatedCloudServiceListResponse 1362} 1363 1364// NextWithContext advances to the next page of values. If there was an error making 1365// the request the page does not advance and the error is returned. 1366func (page *DedicatedCloudServiceListResponsePage) NextWithContext(ctx context.Context) (err error) { 1367 if tracing.IsEnabled() { 1368 ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedCloudServiceListResponsePage.NextWithContext") 1369 defer func() { 1370 sc := -1 1371 if page.Response().Response.Response != nil { 1372 sc = page.Response().Response.Response.StatusCode 1373 } 1374 tracing.EndSpan(ctx, sc, err) 1375 }() 1376 } 1377 for { 1378 next, err := page.fn(ctx, page.dcslr) 1379 if err != nil { 1380 return err 1381 } 1382 page.dcslr = next 1383 if !next.hasNextLink() || !next.IsEmpty() { 1384 break 1385 } 1386 } 1387 return nil 1388} 1389 1390// Next advances to the next page of values. If there was an error making 1391// the request the page does not advance and the error is returned. 1392// Deprecated: Use NextWithContext() instead. 1393func (page *DedicatedCloudServiceListResponsePage) Next() error { 1394 return page.NextWithContext(context.Background()) 1395} 1396 1397// NotDone returns true if the page enumeration should be started or is not yet complete. 1398func (page DedicatedCloudServiceListResponsePage) NotDone() bool { 1399 return !page.dcslr.IsEmpty() 1400} 1401 1402// Response returns the raw server response from the last page request. 1403func (page DedicatedCloudServiceListResponsePage) Response() DedicatedCloudServiceListResponse { 1404 return page.dcslr 1405} 1406 1407// Values returns the slice of values for the current page or nil if there are no values. 1408func (page DedicatedCloudServiceListResponsePage) Values() []DedicatedCloudService { 1409 if page.dcslr.IsEmpty() { 1410 return nil 1411 } 1412 return *page.dcslr.Value 1413} 1414 1415// Creates a new instance of the DedicatedCloudServiceListResponsePage type. 1416func NewDedicatedCloudServiceListResponsePage(cur DedicatedCloudServiceListResponse, getNextPage func(context.Context, DedicatedCloudServiceListResponse) (DedicatedCloudServiceListResponse, error)) DedicatedCloudServiceListResponsePage { 1417 return DedicatedCloudServiceListResponsePage{ 1418 fn: getNextPage, 1419 dcslr: cur, 1420 } 1421} 1422 1423// DedicatedCloudServiceProperties properties of dedicated cloud service 1424type DedicatedCloudServiceProperties struct { 1425 // GatewaySubnet - gateway Subnet for the account. It will collect the subnet address and always treat it as /28 1426 GatewaySubnet *string `json:"gatewaySubnet,omitempty"` 1427 // IsAccountOnboarded - READ-ONLY; indicates whether account onboarded or not in a given region. Possible values include: 'NotOnBoarded', 'OnBoarded', 'OnBoardingFailed', 'OnBoarding' 1428 IsAccountOnboarded OnboardingStatus `json:"isAccountOnboarded,omitempty"` 1429 // Nodes - READ-ONLY; total nodes purchased 1430 Nodes *int32 `json:"nodes,omitempty"` 1431 // ServiceURL - READ-ONLY; link to a service management web portal 1432 ServiceURL *string `json:"serviceURL,omitempty"` 1433} 1434 1435// MarshalJSON is the custom marshaler for DedicatedCloudServiceProperties. 1436func (dcsp DedicatedCloudServiceProperties) MarshalJSON() ([]byte, error) { 1437 objectMap := make(map[string]interface{}) 1438 if dcsp.GatewaySubnet != nil { 1439 objectMap["gatewaySubnet"] = dcsp.GatewaySubnet 1440 } 1441 return json.Marshal(objectMap) 1442} 1443 1444// DedicatedCloudServicesDeleteFuture an abstraction for monitoring and retrieving the results of a 1445// long-running operation. 1446type DedicatedCloudServicesDeleteFuture struct { 1447 azure.FutureAPI 1448 // Result returns the result of the asynchronous operation. 1449 // If the operation has not completed it will return an error. 1450 Result func(DedicatedCloudServicesClient) (autorest.Response, error) 1451} 1452 1453// GuestOSCustomization guest OS Customization properties 1454type GuestOSCustomization struct { 1455 // DNSServers - List of dns servers to use 1456 DNSServers *[]string `json:"dnsServers,omitempty"` 1457 // HostName - Virtual Machine hostname 1458 HostName *string `json:"hostName,omitempty"` 1459 // Password - Password for login 1460 Password *string `json:"password,omitempty"` 1461 // PolicyID - id of customization policy 1462 PolicyID *string `json:"policyId,omitempty"` 1463 // Username - Username for login 1464 Username *string `json:"username,omitempty"` 1465} 1466 1467// GuestOSNICCustomization guest OS nic customization 1468type GuestOSNICCustomization struct { 1469 // Allocation - IP address allocation method. Possible values include: 'Static', 'Dynamic' 1470 Allocation Allocation `json:"allocation,omitempty"` 1471 // DNSServers - List of dns servers to use 1472 DNSServers *[]string `json:"dnsServers,omitempty"` 1473 // Gateway - Gateway addresses assigned to nic 1474 Gateway *[]string `json:"gateway,omitempty"` 1475 // IPAddress - Static ip address for nic 1476 IPAddress *string `json:"ipAddress,omitempty"` 1477 // Mask - Network mask for nic 1478 Mask *string `json:"mask,omitempty"` 1479 // PrimaryWinsServer - primary WINS server for Windows 1480 PrimaryWinsServer *string `json:"primaryWinsServer,omitempty"` 1481 // SecondaryWinsServer - secondary WINS server for Windows 1482 SecondaryWinsServer *string `json:"secondaryWinsServer,omitempty"` 1483} 1484 1485// OperationError operation error model 1486type OperationError struct { 1487 // Code - Error's code 1488 Code *string `json:"code,omitempty"` 1489 // Message - Error's message 1490 Message *string `json:"message,omitempty"` 1491} 1492 1493// OperationResource operation status response 1494type OperationResource struct { 1495 autorest.Response `json:"-"` 1496 // EndTime - READ-ONLY; End time of the operation 1497 EndTime *date.Time `json:"endTime,omitempty"` 1498 // Error - Error Message if operation failed 1499 Error *OperationError `json:"error,omitempty"` 1500 // ID - READ-ONLY; Operation Id 1501 ID *string `json:"id,omitempty"` 1502 // Name - READ-ONLY; Operation ID 1503 Name *string `json:"name,omitempty"` 1504 // StartTime - READ-ONLY; Start time of the operation 1505 StartTime *date.Time `json:"startTime,omitempty"` 1506 // Status - READ-ONLY; Operation status 1507 Status *string `json:"status,omitempty"` 1508} 1509 1510// MarshalJSON is the custom marshaler for OperationResource. 1511func (or OperationResource) MarshalJSON() ([]byte, error) { 1512 objectMap := make(map[string]interface{}) 1513 if or.Error != nil { 1514 objectMap["error"] = or.Error 1515 } 1516 return json.Marshal(objectMap) 1517} 1518 1519// PatchPayload general patch payload modal 1520type PatchPayload struct { 1521 // Tags - The tags key:value pairs 1522 Tags map[string]*string `json:"tags"` 1523} 1524 1525// MarshalJSON is the custom marshaler for PatchPayload. 1526func (pp PatchPayload) MarshalJSON() ([]byte, error) { 1527 objectMap := make(map[string]interface{}) 1528 if pp.Tags != nil { 1529 objectMap["tags"] = pp.Tags 1530 } 1531 return json.Marshal(objectMap) 1532} 1533 1534// PrivateCloud private cloud model 1535type PrivateCloud struct { 1536 autorest.Response `json:"-"` 1537 // ID - Azure Id, e.g. "/subscriptions/4da99247-a172-4ed6-8ae9-ebed2d12f839/providers/Microsoft.VMwareCloudSimple/privateClouds/cloud123" 1538 ID *string `json:"id,omitempty"` 1539 // Location - Location where private cloud created, e.g "westus" 1540 Location *string `json:"location,omitempty"` 1541 // Name - Private cloud name 1542 Name *string `json:"name,omitempty"` 1543 // PrivateCloudProperties - Private cloud properties 1544 *PrivateCloudProperties `json:"properties,omitempty"` 1545 // Type - Azure Resource type. Possible values include: 'MicrosoftVMwareCloudSimpleprivateClouds' 1546 Type PrivateCloudResourceType `json:"type,omitempty"` 1547} 1548 1549// MarshalJSON is the custom marshaler for PrivateCloud. 1550func (pc PrivateCloud) MarshalJSON() ([]byte, error) { 1551 objectMap := make(map[string]interface{}) 1552 if pc.ID != nil { 1553 objectMap["id"] = pc.ID 1554 } 1555 if pc.Location != nil { 1556 objectMap["location"] = pc.Location 1557 } 1558 if pc.Name != nil { 1559 objectMap["name"] = pc.Name 1560 } 1561 if pc.PrivateCloudProperties != nil { 1562 objectMap["properties"] = pc.PrivateCloudProperties 1563 } 1564 if pc.Type != "" { 1565 objectMap["type"] = pc.Type 1566 } 1567 return json.Marshal(objectMap) 1568} 1569 1570// UnmarshalJSON is the custom unmarshaler for PrivateCloud struct. 1571func (pc *PrivateCloud) UnmarshalJSON(body []byte) error { 1572 var m map[string]*json.RawMessage 1573 err := json.Unmarshal(body, &m) 1574 if err != nil { 1575 return err 1576 } 1577 for k, v := range m { 1578 switch k { 1579 case "id": 1580 if v != nil { 1581 var ID string 1582 err = json.Unmarshal(*v, &ID) 1583 if err != nil { 1584 return err 1585 } 1586 pc.ID = &ID 1587 } 1588 case "location": 1589 if v != nil { 1590 var location string 1591 err = json.Unmarshal(*v, &location) 1592 if err != nil { 1593 return err 1594 } 1595 pc.Location = &location 1596 } 1597 case "name": 1598 if v != nil { 1599 var name string 1600 err = json.Unmarshal(*v, &name) 1601 if err != nil { 1602 return err 1603 } 1604 pc.Name = &name 1605 } 1606 case "properties": 1607 if v != nil { 1608 var privateCloudProperties PrivateCloudProperties 1609 err = json.Unmarshal(*v, &privateCloudProperties) 1610 if err != nil { 1611 return err 1612 } 1613 pc.PrivateCloudProperties = &privateCloudProperties 1614 } 1615 case "type": 1616 if v != nil { 1617 var typeVar PrivateCloudResourceType 1618 err = json.Unmarshal(*v, &typeVar) 1619 if err != nil { 1620 return err 1621 } 1622 pc.Type = typeVar 1623 } 1624 } 1625 } 1626 1627 return nil 1628} 1629 1630// PrivateCloudList list of private clouds 1631type PrivateCloudList struct { 1632 autorest.Response `json:"-"` 1633 // NextLink - Link for next list of Private Clouds 1634 NextLink *string `json:"nextLink,omitempty"` 1635 // Value - the list of private clouds 1636 Value *[]PrivateCloud `json:"value,omitempty"` 1637} 1638 1639// PrivateCloudListIterator provides access to a complete listing of PrivateCloud values. 1640type PrivateCloudListIterator struct { 1641 i int 1642 page PrivateCloudListPage 1643} 1644 1645// NextWithContext advances to the next value. If there was an error making 1646// the request the iterator does not advance and the error is returned. 1647func (iter *PrivateCloudListIterator) NextWithContext(ctx context.Context) (err error) { 1648 if tracing.IsEnabled() { 1649 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateCloudListIterator.NextWithContext") 1650 defer func() { 1651 sc := -1 1652 if iter.Response().Response.Response != nil { 1653 sc = iter.Response().Response.Response.StatusCode 1654 } 1655 tracing.EndSpan(ctx, sc, err) 1656 }() 1657 } 1658 iter.i++ 1659 if iter.i < len(iter.page.Values()) { 1660 return nil 1661 } 1662 err = iter.page.NextWithContext(ctx) 1663 if err != nil { 1664 iter.i-- 1665 return err 1666 } 1667 iter.i = 0 1668 return nil 1669} 1670 1671// Next advances to the next value. If there was an error making 1672// the request the iterator does not advance and the error is returned. 1673// Deprecated: Use NextWithContext() instead. 1674func (iter *PrivateCloudListIterator) Next() error { 1675 return iter.NextWithContext(context.Background()) 1676} 1677 1678// NotDone returns true if the enumeration should be started or is not yet complete. 1679func (iter PrivateCloudListIterator) NotDone() bool { 1680 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1681} 1682 1683// Response returns the raw server response from the last page request. 1684func (iter PrivateCloudListIterator) Response() PrivateCloudList { 1685 return iter.page.Response() 1686} 1687 1688// Value returns the current value or a zero-initialized value if the 1689// iterator has advanced beyond the end of the collection. 1690func (iter PrivateCloudListIterator) Value() PrivateCloud { 1691 if !iter.page.NotDone() { 1692 return PrivateCloud{} 1693 } 1694 return iter.page.Values()[iter.i] 1695} 1696 1697// Creates a new instance of the PrivateCloudListIterator type. 1698func NewPrivateCloudListIterator(page PrivateCloudListPage) PrivateCloudListIterator { 1699 return PrivateCloudListIterator{page: page} 1700} 1701 1702// IsEmpty returns true if the ListResult contains no values. 1703func (pcl PrivateCloudList) IsEmpty() bool { 1704 return pcl.Value == nil || len(*pcl.Value) == 0 1705} 1706 1707// hasNextLink returns true if the NextLink is not empty. 1708func (pcl PrivateCloudList) hasNextLink() bool { 1709 return pcl.NextLink != nil && len(*pcl.NextLink) != 0 1710} 1711 1712// privateCloudListPreparer prepares a request to retrieve the next set of results. 1713// It returns nil if no more results exist. 1714func (pcl PrivateCloudList) privateCloudListPreparer(ctx context.Context) (*http.Request, error) { 1715 if !pcl.hasNextLink() { 1716 return nil, nil 1717 } 1718 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1719 autorest.AsJSON(), 1720 autorest.AsGet(), 1721 autorest.WithBaseURL(to.String(pcl.NextLink))) 1722} 1723 1724// PrivateCloudListPage contains a page of PrivateCloud values. 1725type PrivateCloudListPage struct { 1726 fn func(context.Context, PrivateCloudList) (PrivateCloudList, error) 1727 pcl PrivateCloudList 1728} 1729 1730// NextWithContext advances to the next page of values. If there was an error making 1731// the request the page does not advance and the error is returned. 1732func (page *PrivateCloudListPage) NextWithContext(ctx context.Context) (err error) { 1733 if tracing.IsEnabled() { 1734 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateCloudListPage.NextWithContext") 1735 defer func() { 1736 sc := -1 1737 if page.Response().Response.Response != nil { 1738 sc = page.Response().Response.Response.StatusCode 1739 } 1740 tracing.EndSpan(ctx, sc, err) 1741 }() 1742 } 1743 for { 1744 next, err := page.fn(ctx, page.pcl) 1745 if err != nil { 1746 return err 1747 } 1748 page.pcl = next 1749 if !next.hasNextLink() || !next.IsEmpty() { 1750 break 1751 } 1752 } 1753 return nil 1754} 1755 1756// Next advances to the next page of values. If there was an error making 1757// the request the page does not advance and the error is returned. 1758// Deprecated: Use NextWithContext() instead. 1759func (page *PrivateCloudListPage) Next() error { 1760 return page.NextWithContext(context.Background()) 1761} 1762 1763// NotDone returns true if the page enumeration should be started or is not yet complete. 1764func (page PrivateCloudListPage) NotDone() bool { 1765 return !page.pcl.IsEmpty() 1766} 1767 1768// Response returns the raw server response from the last page request. 1769func (page PrivateCloudListPage) Response() PrivateCloudList { 1770 return page.pcl 1771} 1772 1773// Values returns the slice of values for the current page or nil if there are no values. 1774func (page PrivateCloudListPage) Values() []PrivateCloud { 1775 if page.pcl.IsEmpty() { 1776 return nil 1777 } 1778 return *page.pcl.Value 1779} 1780 1781// Creates a new instance of the PrivateCloudListPage type. 1782func NewPrivateCloudListPage(cur PrivateCloudList, getNextPage func(context.Context, PrivateCloudList) (PrivateCloudList, error)) PrivateCloudListPage { 1783 return PrivateCloudListPage{ 1784 fn: getNextPage, 1785 pcl: cur, 1786 } 1787} 1788 1789// PrivateCloudProperties properties of private 1790type PrivateCloudProperties struct { 1791 // AvailabilityZoneID - Availability Zone id, e.g. "az1" 1792 AvailabilityZoneID *string `json:"availabilityZoneId,omitempty"` 1793 // AvailabilityZoneName - Availability Zone name, e.g. "Availability Zone 1" 1794 AvailabilityZoneName *string `json:"availabilityZoneName,omitempty"` 1795 // ClustersNumber - Number of clusters 1796 ClustersNumber *int32 `json:"clustersNumber,omitempty"` 1797 // CreatedBy - User's emails who created cloud 1798 CreatedBy *string `json:"createdBy,omitempty"` 1799 // CreatedOn - When private cloud was created 1800 CreatedOn *date.Time `json:"createdOn,omitempty"` 1801 // DNSServers - Array of DNS servers 1802 DNSServers *[]string `json:"dnsServers,omitempty"` 1803 // Expires - Expiration date of PC 1804 Expires *string `json:"expires,omitempty"` 1805 // NsxType - Nsx Type, e.g. "Advanced" 1806 NsxType *string `json:"nsxType,omitempty"` 1807 // PlacementGroupID - Placement Group id, e.g. "n1" 1808 PlacementGroupID *string `json:"placementGroupId,omitempty"` 1809 // PlacementGroupName - Placement Group name 1810 PlacementGroupName *string `json:"placementGroupName,omitempty"` 1811 // PrivateCloudID - Id of a private cloud 1812 PrivateCloudID *uuid.UUID `json:"privateCloudId,omitempty"` 1813 // ResourcePools - The list of Resource Pools 1814 ResourcePools *[]ResourcePool `json:"resourcePools,omitempty"` 1815 // State - Private Cloud state, e.g. "operational" 1816 State *string `json:"state,omitempty"` 1817 // TotalCPUCores - Number of cores 1818 TotalCPUCores *int32 `json:"totalCpuCores,omitempty"` 1819 // TotalNodes - Number of nodes 1820 TotalNodes *int32 `json:"totalNodes,omitempty"` 1821 // TotalRAM - Memory size 1822 TotalRAM *int32 `json:"totalRam,omitempty"` 1823 // TotalStorage - Disk space in TB 1824 TotalStorage *float64 `json:"totalStorage,omitempty"` 1825 // Type - Virtualization type e.g. "vSphere" 1826 Type *string `json:"type,omitempty"` 1827 // VSphereVersion - e.g. "6.5u2" 1828 VSphereVersion *string `json:"vSphereVersion,omitempty"` 1829 // VcenterFqdn - FQDN for vcenter access 1830 VcenterFqdn *string `json:"vcenterFqdn,omitempty"` 1831 // VcenterRefid - Vcenter ip address 1832 VcenterRefid *string `json:"vcenterRefid,omitempty"` 1833 // VirtualMachineTemplates - The list of Virtual Machine Templates 1834 VirtualMachineTemplates *[]VirtualMachineTemplate `json:"virtualMachineTemplates,omitempty"` 1835 // VirtualNetworks - The list of Virtual Networks 1836 VirtualNetworks *[]VirtualNetwork `json:"virtualNetworks,omitempty"` 1837 // VrOpsEnabled - Is Vrops enabled/disabled 1838 VrOpsEnabled *bool `json:"vrOpsEnabled,omitempty"` 1839} 1840 1841// ResourcePool resource pool model 1842type ResourcePool struct { 1843 autorest.Response `json:"-"` 1844 // ID - resource pool id (privateCloudId:vsphereId) 1845 ID *string `json:"id,omitempty"` 1846 // Location - READ-ONLY; Azure region 1847 Location *string `json:"location,omitempty"` 1848 // Name - READ-ONLY; {ResourcePoolName} 1849 Name *string `json:"name,omitempty"` 1850 // PrivateCloudID - READ-ONLY; The Private Cloud Id 1851 PrivateCloudID *string `json:"privateCloudId,omitempty"` 1852 // ResourcePoolProperties - Resource pool properties 1853 *ResourcePoolProperties `json:"properties,omitempty"` 1854 // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} 1855 Type *string `json:"type,omitempty"` 1856} 1857 1858// MarshalJSON is the custom marshaler for ResourcePool. 1859func (rp ResourcePool) MarshalJSON() ([]byte, error) { 1860 objectMap := make(map[string]interface{}) 1861 if rp.ID != nil { 1862 objectMap["id"] = rp.ID 1863 } 1864 if rp.ResourcePoolProperties != nil { 1865 objectMap["properties"] = rp.ResourcePoolProperties 1866 } 1867 return json.Marshal(objectMap) 1868} 1869 1870// UnmarshalJSON is the custom unmarshaler for ResourcePool struct. 1871func (rp *ResourcePool) UnmarshalJSON(body []byte) error { 1872 var m map[string]*json.RawMessage 1873 err := json.Unmarshal(body, &m) 1874 if err != nil { 1875 return err 1876 } 1877 for k, v := range m { 1878 switch k { 1879 case "id": 1880 if v != nil { 1881 var ID string 1882 err = json.Unmarshal(*v, &ID) 1883 if err != nil { 1884 return err 1885 } 1886 rp.ID = &ID 1887 } 1888 case "location": 1889 if v != nil { 1890 var location string 1891 err = json.Unmarshal(*v, &location) 1892 if err != nil { 1893 return err 1894 } 1895 rp.Location = &location 1896 } 1897 case "name": 1898 if v != nil { 1899 var name string 1900 err = json.Unmarshal(*v, &name) 1901 if err != nil { 1902 return err 1903 } 1904 rp.Name = &name 1905 } 1906 case "privateCloudId": 1907 if v != nil { 1908 var privateCloudID string 1909 err = json.Unmarshal(*v, &privateCloudID) 1910 if err != nil { 1911 return err 1912 } 1913 rp.PrivateCloudID = &privateCloudID 1914 } 1915 case "properties": 1916 if v != nil { 1917 var resourcePoolProperties ResourcePoolProperties 1918 err = json.Unmarshal(*v, &resourcePoolProperties) 1919 if err != nil { 1920 return err 1921 } 1922 rp.ResourcePoolProperties = &resourcePoolProperties 1923 } 1924 case "type": 1925 if v != nil { 1926 var typeVar string 1927 err = json.Unmarshal(*v, &typeVar) 1928 if err != nil { 1929 return err 1930 } 1931 rp.Type = &typeVar 1932 } 1933 } 1934 } 1935 1936 return nil 1937} 1938 1939// ResourcePoolProperties properties of resource pool 1940type ResourcePoolProperties struct { 1941 // FullName - READ-ONLY; Hierarchical resource pool name 1942 FullName *string `json:"fullName,omitempty"` 1943} 1944 1945// ResourcePoolsListResponse list of resource pools response model 1946type ResourcePoolsListResponse struct { 1947 autorest.Response `json:"-"` 1948 // NextLink - Link for next list of ResourcePoolsList 1949 NextLink *string `json:"nextLink,omitempty"` 1950 // Value - Results of the Resource pools list 1951 Value *[]ResourcePool `json:"value,omitempty"` 1952} 1953 1954// ResourcePoolsListResponseIterator provides access to a complete listing of ResourcePool values. 1955type ResourcePoolsListResponseIterator struct { 1956 i int 1957 page ResourcePoolsListResponsePage 1958} 1959 1960// NextWithContext advances to the next value. If there was an error making 1961// the request the iterator does not advance and the error is returned. 1962func (iter *ResourcePoolsListResponseIterator) NextWithContext(ctx context.Context) (err error) { 1963 if tracing.IsEnabled() { 1964 ctx = tracing.StartSpan(ctx, fqdn+"/ResourcePoolsListResponseIterator.NextWithContext") 1965 defer func() { 1966 sc := -1 1967 if iter.Response().Response.Response != nil { 1968 sc = iter.Response().Response.Response.StatusCode 1969 } 1970 tracing.EndSpan(ctx, sc, err) 1971 }() 1972 } 1973 iter.i++ 1974 if iter.i < len(iter.page.Values()) { 1975 return nil 1976 } 1977 err = iter.page.NextWithContext(ctx) 1978 if err != nil { 1979 iter.i-- 1980 return err 1981 } 1982 iter.i = 0 1983 return nil 1984} 1985 1986// Next advances to the next value. If there was an error making 1987// the request the iterator does not advance and the error is returned. 1988// Deprecated: Use NextWithContext() instead. 1989func (iter *ResourcePoolsListResponseIterator) Next() error { 1990 return iter.NextWithContext(context.Background()) 1991} 1992 1993// NotDone returns true if the enumeration should be started or is not yet complete. 1994func (iter ResourcePoolsListResponseIterator) NotDone() bool { 1995 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1996} 1997 1998// Response returns the raw server response from the last page request. 1999func (iter ResourcePoolsListResponseIterator) Response() ResourcePoolsListResponse { 2000 return iter.page.Response() 2001} 2002 2003// Value returns the current value or a zero-initialized value if the 2004// iterator has advanced beyond the end of the collection. 2005func (iter ResourcePoolsListResponseIterator) Value() ResourcePool { 2006 if !iter.page.NotDone() { 2007 return ResourcePool{} 2008 } 2009 return iter.page.Values()[iter.i] 2010} 2011 2012// Creates a new instance of the ResourcePoolsListResponseIterator type. 2013func NewResourcePoolsListResponseIterator(page ResourcePoolsListResponsePage) ResourcePoolsListResponseIterator { 2014 return ResourcePoolsListResponseIterator{page: page} 2015} 2016 2017// IsEmpty returns true if the ListResult contains no values. 2018func (rplr ResourcePoolsListResponse) IsEmpty() bool { 2019 return rplr.Value == nil || len(*rplr.Value) == 0 2020} 2021 2022// hasNextLink returns true if the NextLink is not empty. 2023func (rplr ResourcePoolsListResponse) hasNextLink() bool { 2024 return rplr.NextLink != nil && len(*rplr.NextLink) != 0 2025} 2026 2027// resourcePoolsListResponsePreparer prepares a request to retrieve the next set of results. 2028// It returns nil if no more results exist. 2029func (rplr ResourcePoolsListResponse) resourcePoolsListResponsePreparer(ctx context.Context) (*http.Request, error) { 2030 if !rplr.hasNextLink() { 2031 return nil, nil 2032 } 2033 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2034 autorest.AsJSON(), 2035 autorest.AsGet(), 2036 autorest.WithBaseURL(to.String(rplr.NextLink))) 2037} 2038 2039// ResourcePoolsListResponsePage contains a page of ResourcePool values. 2040type ResourcePoolsListResponsePage struct { 2041 fn func(context.Context, ResourcePoolsListResponse) (ResourcePoolsListResponse, error) 2042 rplr ResourcePoolsListResponse 2043} 2044 2045// NextWithContext advances to the next page of values. If there was an error making 2046// the request the page does not advance and the error is returned. 2047func (page *ResourcePoolsListResponsePage) NextWithContext(ctx context.Context) (err error) { 2048 if tracing.IsEnabled() { 2049 ctx = tracing.StartSpan(ctx, fqdn+"/ResourcePoolsListResponsePage.NextWithContext") 2050 defer func() { 2051 sc := -1 2052 if page.Response().Response.Response != nil { 2053 sc = page.Response().Response.Response.StatusCode 2054 } 2055 tracing.EndSpan(ctx, sc, err) 2056 }() 2057 } 2058 for { 2059 next, err := page.fn(ctx, page.rplr) 2060 if err != nil { 2061 return err 2062 } 2063 page.rplr = next 2064 if !next.hasNextLink() || !next.IsEmpty() { 2065 break 2066 } 2067 } 2068 return nil 2069} 2070 2071// Next advances to the next page of values. If there was an error making 2072// the request the page does not advance and the error is returned. 2073// Deprecated: Use NextWithContext() instead. 2074func (page *ResourcePoolsListResponsePage) Next() error { 2075 return page.NextWithContext(context.Background()) 2076} 2077 2078// NotDone returns true if the page enumeration should be started or is not yet complete. 2079func (page ResourcePoolsListResponsePage) NotDone() bool { 2080 return !page.rplr.IsEmpty() 2081} 2082 2083// Response returns the raw server response from the last page request. 2084func (page ResourcePoolsListResponsePage) Response() ResourcePoolsListResponse { 2085 return page.rplr 2086} 2087 2088// Values returns the slice of values for the current page or nil if there are no values. 2089func (page ResourcePoolsListResponsePage) Values() []ResourcePool { 2090 if page.rplr.IsEmpty() { 2091 return nil 2092 } 2093 return *page.rplr.Value 2094} 2095 2096// Creates a new instance of the ResourcePoolsListResponsePage type. 2097func NewResourcePoolsListResponsePage(cur ResourcePoolsListResponse, getNextPage func(context.Context, ResourcePoolsListResponse) (ResourcePoolsListResponse, error)) ResourcePoolsListResponsePage { 2098 return ResourcePoolsListResponsePage{ 2099 fn: getNextPage, 2100 rplr: cur, 2101 } 2102} 2103 2104// Sku the purchase SKU for CloudSimple paid resources 2105type Sku struct { 2106 // Capacity - The capacity of the SKU 2107 Capacity *string `json:"capacity,omitempty"` 2108 // Description - dedicatedCloudNode example: 8 x Ten-Core Intel® Xeon® Processor E5-2640 v4 2.40GHz 25MB Cache (90W); 12 x 64GB PC4-19200 2400MHz DDR4 ECC Registered DIMM, ... 2109 Description *string `json:"description,omitempty"` 2110 // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here 2111 Family *string `json:"family,omitempty"` 2112 // Name - The name of the SKU for VMWare CloudSimple Node 2113 Name *string `json:"name,omitempty"` 2114 // Tier - The tier of the SKU 2115 Tier *string `json:"tier,omitempty"` 2116} 2117 2118// SkuAvailability SKU availability model 2119type SkuAvailability struct { 2120 // DedicatedAvailabilityZoneID - CloudSimple Availability Zone id 2121 DedicatedAvailabilityZoneID *string `json:"dedicatedAvailabilityZoneId,omitempty"` 2122 // DedicatedAvailabilityZoneName - CloudSimple Availability Zone Name 2123 DedicatedAvailabilityZoneName *string `json:"dedicatedAvailabilityZoneName,omitempty"` 2124 // DedicatedPlacementGroupID - CloudSimple Placement Group Id 2125 DedicatedPlacementGroupID *string `json:"dedicatedPlacementGroupId,omitempty"` 2126 // DedicatedPlacementGroupName - CloudSimple Placement Group name 2127 DedicatedPlacementGroupName *string `json:"dedicatedPlacementGroupName,omitempty"` 2128 // Limit - indicates how many resources of a given SKU is available in a AZ->PG 2129 Limit *int32 `json:"limit,omitempty"` 2130 // ResourceType - resource type e.g. DedicatedCloudNodes 2131 ResourceType *string `json:"resourceType,omitempty"` 2132 // SkuID - sku id 2133 SkuID *string `json:"skuId,omitempty"` 2134 // SkuName - sku name 2135 SkuName *string `json:"skuName,omitempty"` 2136} 2137 2138// SkuAvailabilityListResponse list of SKU availabilities 2139type SkuAvailabilityListResponse struct { 2140 autorest.Response `json:"-"` 2141 // NextLink - Link for next list of DedicatedCloudNode 2142 NextLink *string `json:"nextLink,omitempty"` 2143 // Value - Results of the DedicatedPlacementGroupSkuAvailability list 2144 Value *[]SkuAvailability `json:"value,omitempty"` 2145} 2146 2147// SkuAvailabilityListResponseIterator provides access to a complete listing of SkuAvailability values. 2148type SkuAvailabilityListResponseIterator struct { 2149 i int 2150 page SkuAvailabilityListResponsePage 2151} 2152 2153// NextWithContext advances to the next value. If there was an error making 2154// the request the iterator does not advance and the error is returned. 2155func (iter *SkuAvailabilityListResponseIterator) NextWithContext(ctx context.Context) (err error) { 2156 if tracing.IsEnabled() { 2157 ctx = tracing.StartSpan(ctx, fqdn+"/SkuAvailabilityListResponseIterator.NextWithContext") 2158 defer func() { 2159 sc := -1 2160 if iter.Response().Response.Response != nil { 2161 sc = iter.Response().Response.Response.StatusCode 2162 } 2163 tracing.EndSpan(ctx, sc, err) 2164 }() 2165 } 2166 iter.i++ 2167 if iter.i < len(iter.page.Values()) { 2168 return nil 2169 } 2170 err = iter.page.NextWithContext(ctx) 2171 if err != nil { 2172 iter.i-- 2173 return err 2174 } 2175 iter.i = 0 2176 return nil 2177} 2178 2179// Next advances to the next value. If there was an error making 2180// the request the iterator does not advance and the error is returned. 2181// Deprecated: Use NextWithContext() instead. 2182func (iter *SkuAvailabilityListResponseIterator) Next() error { 2183 return iter.NextWithContext(context.Background()) 2184} 2185 2186// NotDone returns true if the enumeration should be started or is not yet complete. 2187func (iter SkuAvailabilityListResponseIterator) NotDone() bool { 2188 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2189} 2190 2191// Response returns the raw server response from the last page request. 2192func (iter SkuAvailabilityListResponseIterator) Response() SkuAvailabilityListResponse { 2193 return iter.page.Response() 2194} 2195 2196// Value returns the current value or a zero-initialized value if the 2197// iterator has advanced beyond the end of the collection. 2198func (iter SkuAvailabilityListResponseIterator) Value() SkuAvailability { 2199 if !iter.page.NotDone() { 2200 return SkuAvailability{} 2201 } 2202 return iter.page.Values()[iter.i] 2203} 2204 2205// Creates a new instance of the SkuAvailabilityListResponseIterator type. 2206func NewSkuAvailabilityListResponseIterator(page SkuAvailabilityListResponsePage) SkuAvailabilityListResponseIterator { 2207 return SkuAvailabilityListResponseIterator{page: page} 2208} 2209 2210// IsEmpty returns true if the ListResult contains no values. 2211func (salr SkuAvailabilityListResponse) IsEmpty() bool { 2212 return salr.Value == nil || len(*salr.Value) == 0 2213} 2214 2215// hasNextLink returns true if the NextLink is not empty. 2216func (salr SkuAvailabilityListResponse) hasNextLink() bool { 2217 return salr.NextLink != nil && len(*salr.NextLink) != 0 2218} 2219 2220// skuAvailabilityListResponsePreparer prepares a request to retrieve the next set of results. 2221// It returns nil if no more results exist. 2222func (salr SkuAvailabilityListResponse) skuAvailabilityListResponsePreparer(ctx context.Context) (*http.Request, error) { 2223 if !salr.hasNextLink() { 2224 return nil, nil 2225 } 2226 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2227 autorest.AsJSON(), 2228 autorest.AsGet(), 2229 autorest.WithBaseURL(to.String(salr.NextLink))) 2230} 2231 2232// SkuAvailabilityListResponsePage contains a page of SkuAvailability values. 2233type SkuAvailabilityListResponsePage struct { 2234 fn func(context.Context, SkuAvailabilityListResponse) (SkuAvailabilityListResponse, error) 2235 salr SkuAvailabilityListResponse 2236} 2237 2238// NextWithContext advances to the next page of values. If there was an error making 2239// the request the page does not advance and the error is returned. 2240func (page *SkuAvailabilityListResponsePage) NextWithContext(ctx context.Context) (err error) { 2241 if tracing.IsEnabled() { 2242 ctx = tracing.StartSpan(ctx, fqdn+"/SkuAvailabilityListResponsePage.NextWithContext") 2243 defer func() { 2244 sc := -1 2245 if page.Response().Response.Response != nil { 2246 sc = page.Response().Response.Response.StatusCode 2247 } 2248 tracing.EndSpan(ctx, sc, err) 2249 }() 2250 } 2251 for { 2252 next, err := page.fn(ctx, page.salr) 2253 if err != nil { 2254 return err 2255 } 2256 page.salr = next 2257 if !next.hasNextLink() || !next.IsEmpty() { 2258 break 2259 } 2260 } 2261 return nil 2262} 2263 2264// Next advances to the next page of values. If there was an error making 2265// the request the page does not advance and the error is returned. 2266// Deprecated: Use NextWithContext() instead. 2267func (page *SkuAvailabilityListResponsePage) Next() error { 2268 return page.NextWithContext(context.Background()) 2269} 2270 2271// NotDone returns true if the page enumeration should be started or is not yet complete. 2272func (page SkuAvailabilityListResponsePage) NotDone() bool { 2273 return !page.salr.IsEmpty() 2274} 2275 2276// Response returns the raw server response from the last page request. 2277func (page SkuAvailabilityListResponsePage) Response() SkuAvailabilityListResponse { 2278 return page.salr 2279} 2280 2281// Values returns the slice of values for the current page or nil if there are no values. 2282func (page SkuAvailabilityListResponsePage) Values() []SkuAvailability { 2283 if page.salr.IsEmpty() { 2284 return nil 2285 } 2286 return *page.salr.Value 2287} 2288 2289// Creates a new instance of the SkuAvailabilityListResponsePage type. 2290func NewSkuAvailabilityListResponsePage(cur SkuAvailabilityListResponse, getNextPage func(context.Context, SkuAvailabilityListResponse) (SkuAvailabilityListResponse, error)) SkuAvailabilityListResponsePage { 2291 return SkuAvailabilityListResponsePage{ 2292 fn: getNextPage, 2293 salr: cur, 2294 } 2295} 2296 2297// SkuDescription the purchase SKU for CloudSimple paid resources 2298type SkuDescription struct { 2299 // ID - SKU's id 2300 ID *string `json:"id,omitempty"` 2301 // Name - SKU's name 2302 Name *string `json:"name,omitempty"` 2303} 2304 2305// Usage usage model 2306type Usage struct { 2307 // CurrentValue - The current usage value 2308 CurrentValue *int32 `json:"currentValue,omitempty"` 2309 // Limit - limit of a given sku in a region for a subscription. The maximum permitted value for the usage quota. If there is no limit, this value will be -1 2310 Limit *int32 `json:"limit,omitempty"` 2311 // Name - Usage name value and localized name 2312 Name *UsageName `json:"name,omitempty"` 2313 // Unit - The usages' unit. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond' 2314 Unit UsageCount `json:"unit,omitempty"` 2315} 2316 2317// UsageListResponse list of usages 2318type UsageListResponse struct { 2319 autorest.Response `json:"-"` 2320 // NextLink - Link for next list of DedicatedCloudNode 2321 NextLink *string `json:"nextLink,omitempty"` 2322 // Value - READ-ONLY; The list of usages 2323 Value *[]Usage `json:"value,omitempty"` 2324} 2325 2326// MarshalJSON is the custom marshaler for UsageListResponse. 2327func (ulr UsageListResponse) MarshalJSON() ([]byte, error) { 2328 objectMap := make(map[string]interface{}) 2329 if ulr.NextLink != nil { 2330 objectMap["nextLink"] = ulr.NextLink 2331 } 2332 return json.Marshal(objectMap) 2333} 2334 2335// UsageListResponseIterator provides access to a complete listing of Usage values. 2336type UsageListResponseIterator struct { 2337 i int 2338 page UsageListResponsePage 2339} 2340 2341// NextWithContext advances to the next value. If there was an error making 2342// the request the iterator does not advance and the error is returned. 2343func (iter *UsageListResponseIterator) NextWithContext(ctx context.Context) (err error) { 2344 if tracing.IsEnabled() { 2345 ctx = tracing.StartSpan(ctx, fqdn+"/UsageListResponseIterator.NextWithContext") 2346 defer func() { 2347 sc := -1 2348 if iter.Response().Response.Response != nil { 2349 sc = iter.Response().Response.Response.StatusCode 2350 } 2351 tracing.EndSpan(ctx, sc, err) 2352 }() 2353 } 2354 iter.i++ 2355 if iter.i < len(iter.page.Values()) { 2356 return nil 2357 } 2358 err = iter.page.NextWithContext(ctx) 2359 if err != nil { 2360 iter.i-- 2361 return err 2362 } 2363 iter.i = 0 2364 return nil 2365} 2366 2367// Next advances to the next value. If there was an error making 2368// the request the iterator does not advance and the error is returned. 2369// Deprecated: Use NextWithContext() instead. 2370func (iter *UsageListResponseIterator) Next() error { 2371 return iter.NextWithContext(context.Background()) 2372} 2373 2374// NotDone returns true if the enumeration should be started or is not yet complete. 2375func (iter UsageListResponseIterator) NotDone() bool { 2376 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2377} 2378 2379// Response returns the raw server response from the last page request. 2380func (iter UsageListResponseIterator) Response() UsageListResponse { 2381 return iter.page.Response() 2382} 2383 2384// Value returns the current value or a zero-initialized value if the 2385// iterator has advanced beyond the end of the collection. 2386func (iter UsageListResponseIterator) Value() Usage { 2387 if !iter.page.NotDone() { 2388 return Usage{} 2389 } 2390 return iter.page.Values()[iter.i] 2391} 2392 2393// Creates a new instance of the UsageListResponseIterator type. 2394func NewUsageListResponseIterator(page UsageListResponsePage) UsageListResponseIterator { 2395 return UsageListResponseIterator{page: page} 2396} 2397 2398// IsEmpty returns true if the ListResult contains no values. 2399func (ulr UsageListResponse) IsEmpty() bool { 2400 return ulr.Value == nil || len(*ulr.Value) == 0 2401} 2402 2403// hasNextLink returns true if the NextLink is not empty. 2404func (ulr UsageListResponse) hasNextLink() bool { 2405 return ulr.NextLink != nil && len(*ulr.NextLink) != 0 2406} 2407 2408// usageListResponsePreparer prepares a request to retrieve the next set of results. 2409// It returns nil if no more results exist. 2410func (ulr UsageListResponse) usageListResponsePreparer(ctx context.Context) (*http.Request, error) { 2411 if !ulr.hasNextLink() { 2412 return nil, nil 2413 } 2414 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2415 autorest.AsJSON(), 2416 autorest.AsGet(), 2417 autorest.WithBaseURL(to.String(ulr.NextLink))) 2418} 2419 2420// UsageListResponsePage contains a page of Usage values. 2421type UsageListResponsePage struct { 2422 fn func(context.Context, UsageListResponse) (UsageListResponse, error) 2423 ulr UsageListResponse 2424} 2425 2426// NextWithContext advances to the next page of values. If there was an error making 2427// the request the page does not advance and the error is returned. 2428func (page *UsageListResponsePage) NextWithContext(ctx context.Context) (err error) { 2429 if tracing.IsEnabled() { 2430 ctx = tracing.StartSpan(ctx, fqdn+"/UsageListResponsePage.NextWithContext") 2431 defer func() { 2432 sc := -1 2433 if page.Response().Response.Response != nil { 2434 sc = page.Response().Response.Response.StatusCode 2435 } 2436 tracing.EndSpan(ctx, sc, err) 2437 }() 2438 } 2439 for { 2440 next, err := page.fn(ctx, page.ulr) 2441 if err != nil { 2442 return err 2443 } 2444 page.ulr = next 2445 if !next.hasNextLink() || !next.IsEmpty() { 2446 break 2447 } 2448 } 2449 return nil 2450} 2451 2452// Next advances to the next page of values. If there was an error making 2453// the request the page does not advance and the error is returned. 2454// Deprecated: Use NextWithContext() instead. 2455func (page *UsageListResponsePage) Next() error { 2456 return page.NextWithContext(context.Background()) 2457} 2458 2459// NotDone returns true if the page enumeration should be started or is not yet complete. 2460func (page UsageListResponsePage) NotDone() bool { 2461 return !page.ulr.IsEmpty() 2462} 2463 2464// Response returns the raw server response from the last page request. 2465func (page UsageListResponsePage) Response() UsageListResponse { 2466 return page.ulr 2467} 2468 2469// Values returns the slice of values for the current page or nil if there are no values. 2470func (page UsageListResponsePage) Values() []Usage { 2471 if page.ulr.IsEmpty() { 2472 return nil 2473 } 2474 return *page.ulr.Value 2475} 2476 2477// Creates a new instance of the UsageListResponsePage type. 2478func NewUsageListResponsePage(cur UsageListResponse, getNextPage func(context.Context, UsageListResponse) (UsageListResponse, error)) UsageListResponsePage { 2479 return UsageListResponsePage{ 2480 fn: getNextPage, 2481 ulr: cur, 2482 } 2483} 2484 2485// UsageName user name model 2486type UsageName struct { 2487 // LocalizedValue - e.g. "Virtual Machines" 2488 LocalizedValue *string `json:"localizedValue,omitempty"` 2489 // Value - resource type or resource type sku name, e.g. virtualMachines 2490 Value *string `json:"value,omitempty"` 2491} 2492 2493// VirtualDisk virtual disk model 2494type VirtualDisk struct { 2495 // ControllerID - Disk's Controller id 2496 ControllerID *string `json:"controllerId,omitempty"` 2497 // IndependenceMode - Disk's independence mode type. Possible values include: 'Persistent', 'IndependentPersistent', 'IndependentNonpersistent' 2498 IndependenceMode DiskIndependenceMode `json:"independenceMode,omitempty"` 2499 // TotalSize - Disk's total size 2500 TotalSize *int32 `json:"totalSize,omitempty"` 2501 // VirtualDiskID - Disk's id 2502 VirtualDiskID *string `json:"virtualDiskId,omitempty"` 2503 // VirtualDiskName - READ-ONLY; Disk's display name 2504 VirtualDiskName *string `json:"virtualDiskName,omitempty"` 2505} 2506 2507// MarshalJSON is the custom marshaler for VirtualDisk. 2508func (vd VirtualDisk) MarshalJSON() ([]byte, error) { 2509 objectMap := make(map[string]interface{}) 2510 if vd.ControllerID != nil { 2511 objectMap["controllerId"] = vd.ControllerID 2512 } 2513 if vd.IndependenceMode != "" { 2514 objectMap["independenceMode"] = vd.IndependenceMode 2515 } 2516 if vd.TotalSize != nil { 2517 objectMap["totalSize"] = vd.TotalSize 2518 } 2519 if vd.VirtualDiskID != nil { 2520 objectMap["virtualDiskId"] = vd.VirtualDiskID 2521 } 2522 return json.Marshal(objectMap) 2523} 2524 2525// VirtualDiskController virtual disk controller model 2526type VirtualDiskController struct { 2527 // ID - READ-ONLY; Controller's id 2528 ID *string `json:"id,omitempty"` 2529 // Name - READ-ONLY; The display name of Controller 2530 Name *string `json:"name,omitempty"` 2531 // SubType - READ-ONLY; dik controller subtype (VMWARE_PARAVIRTUAL, BUS_PARALLEL, LSI_PARALLEL, LSI_SAS) 2532 SubType *string `json:"subType,omitempty"` 2533 // Type - READ-ONLY; disk controller type (SCSI) 2534 Type *string `json:"type,omitempty"` 2535} 2536 2537// VirtualMachine virtual machine model 2538type VirtualMachine struct { 2539 autorest.Response `json:"-"` 2540 // ID - READ-ONLY; /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/virtualMachines/{virtualMachineName} 2541 ID *string `json:"id,omitempty"` 2542 // Location - Azure region 2543 Location *string `json:"location,omitempty"` 2544 // Name - READ-ONLY; {virtualMachineName} 2545 Name *string `json:"name,omitempty"` 2546 // VirtualMachineProperties - Virtual machine properties 2547 *VirtualMachineProperties `json:"properties,omitempty"` 2548 // Tags - The list of tags 2549 Tags map[string]*string `json:"tags"` 2550 // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} 2551 Type *string `json:"type,omitempty"` 2552} 2553 2554// MarshalJSON is the custom marshaler for VirtualMachine. 2555func (VM VirtualMachine) MarshalJSON() ([]byte, error) { 2556 objectMap := make(map[string]interface{}) 2557 if VM.Location != nil { 2558 objectMap["location"] = VM.Location 2559 } 2560 if VM.VirtualMachineProperties != nil { 2561 objectMap["properties"] = VM.VirtualMachineProperties 2562 } 2563 if VM.Tags != nil { 2564 objectMap["tags"] = VM.Tags 2565 } 2566 return json.Marshal(objectMap) 2567} 2568 2569// UnmarshalJSON is the custom unmarshaler for VirtualMachine struct. 2570func (VM *VirtualMachine) UnmarshalJSON(body []byte) error { 2571 var m map[string]*json.RawMessage 2572 err := json.Unmarshal(body, &m) 2573 if err != nil { 2574 return err 2575 } 2576 for k, v := range m { 2577 switch k { 2578 case "id": 2579 if v != nil { 2580 var ID string 2581 err = json.Unmarshal(*v, &ID) 2582 if err != nil { 2583 return err 2584 } 2585 VM.ID = &ID 2586 } 2587 case "location": 2588 if v != nil { 2589 var location string 2590 err = json.Unmarshal(*v, &location) 2591 if err != nil { 2592 return err 2593 } 2594 VM.Location = &location 2595 } 2596 case "name": 2597 if v != nil { 2598 var name string 2599 err = json.Unmarshal(*v, &name) 2600 if err != nil { 2601 return err 2602 } 2603 VM.Name = &name 2604 } 2605 case "properties": 2606 if v != nil { 2607 var virtualMachineProperties VirtualMachineProperties 2608 err = json.Unmarshal(*v, &virtualMachineProperties) 2609 if err != nil { 2610 return err 2611 } 2612 VM.VirtualMachineProperties = &virtualMachineProperties 2613 } 2614 case "tags": 2615 if v != nil { 2616 var tags map[string]*string 2617 err = json.Unmarshal(*v, &tags) 2618 if err != nil { 2619 return err 2620 } 2621 VM.Tags = tags 2622 } 2623 case "type": 2624 if v != nil { 2625 var typeVar string 2626 err = json.Unmarshal(*v, &typeVar) 2627 if err != nil { 2628 return err 2629 } 2630 VM.Type = &typeVar 2631 } 2632 } 2633 } 2634 2635 return nil 2636} 2637 2638// VirtualMachineListResponse list of virtual machines 2639type VirtualMachineListResponse struct { 2640 autorest.Response `json:"-"` 2641 // NextLink - Link for next list of VirtualMachines 2642 NextLink *string `json:"nextLink,omitempty"` 2643 // Value - Results of the VirtualMachine list 2644 Value *[]VirtualMachine `json:"value,omitempty"` 2645} 2646 2647// VirtualMachineListResponseIterator provides access to a complete listing of VirtualMachine values. 2648type VirtualMachineListResponseIterator struct { 2649 i int 2650 page VirtualMachineListResponsePage 2651} 2652 2653// NextWithContext advances to the next value. If there was an error making 2654// the request the iterator does not advance and the error is returned. 2655func (iter *VirtualMachineListResponseIterator) NextWithContext(ctx context.Context) (err error) { 2656 if tracing.IsEnabled() { 2657 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineListResponseIterator.NextWithContext") 2658 defer func() { 2659 sc := -1 2660 if iter.Response().Response.Response != nil { 2661 sc = iter.Response().Response.Response.StatusCode 2662 } 2663 tracing.EndSpan(ctx, sc, err) 2664 }() 2665 } 2666 iter.i++ 2667 if iter.i < len(iter.page.Values()) { 2668 return nil 2669 } 2670 err = iter.page.NextWithContext(ctx) 2671 if err != nil { 2672 iter.i-- 2673 return err 2674 } 2675 iter.i = 0 2676 return nil 2677} 2678 2679// Next advances to the next value. If there was an error making 2680// the request the iterator does not advance and the error is returned. 2681// Deprecated: Use NextWithContext() instead. 2682func (iter *VirtualMachineListResponseIterator) Next() error { 2683 return iter.NextWithContext(context.Background()) 2684} 2685 2686// NotDone returns true if the enumeration should be started or is not yet complete. 2687func (iter VirtualMachineListResponseIterator) NotDone() bool { 2688 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2689} 2690 2691// Response returns the raw server response from the last page request. 2692func (iter VirtualMachineListResponseIterator) Response() VirtualMachineListResponse { 2693 return iter.page.Response() 2694} 2695 2696// Value returns the current value or a zero-initialized value if the 2697// iterator has advanced beyond the end of the collection. 2698func (iter VirtualMachineListResponseIterator) Value() VirtualMachine { 2699 if !iter.page.NotDone() { 2700 return VirtualMachine{} 2701 } 2702 return iter.page.Values()[iter.i] 2703} 2704 2705// Creates a new instance of the VirtualMachineListResponseIterator type. 2706func NewVirtualMachineListResponseIterator(page VirtualMachineListResponsePage) VirtualMachineListResponseIterator { 2707 return VirtualMachineListResponseIterator{page: page} 2708} 2709 2710// IsEmpty returns true if the ListResult contains no values. 2711func (vmlr VirtualMachineListResponse) IsEmpty() bool { 2712 return vmlr.Value == nil || len(*vmlr.Value) == 0 2713} 2714 2715// hasNextLink returns true if the NextLink is not empty. 2716func (vmlr VirtualMachineListResponse) hasNextLink() bool { 2717 return vmlr.NextLink != nil && len(*vmlr.NextLink) != 0 2718} 2719 2720// virtualMachineListResponsePreparer prepares a request to retrieve the next set of results. 2721// It returns nil if no more results exist. 2722func (vmlr VirtualMachineListResponse) virtualMachineListResponsePreparer(ctx context.Context) (*http.Request, error) { 2723 if !vmlr.hasNextLink() { 2724 return nil, nil 2725 } 2726 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2727 autorest.AsJSON(), 2728 autorest.AsGet(), 2729 autorest.WithBaseURL(to.String(vmlr.NextLink))) 2730} 2731 2732// VirtualMachineListResponsePage contains a page of VirtualMachine values. 2733type VirtualMachineListResponsePage struct { 2734 fn func(context.Context, VirtualMachineListResponse) (VirtualMachineListResponse, error) 2735 vmlr VirtualMachineListResponse 2736} 2737 2738// NextWithContext advances to the next page of values. If there was an error making 2739// the request the page does not advance and the error is returned. 2740func (page *VirtualMachineListResponsePage) NextWithContext(ctx context.Context) (err error) { 2741 if tracing.IsEnabled() { 2742 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineListResponsePage.NextWithContext") 2743 defer func() { 2744 sc := -1 2745 if page.Response().Response.Response != nil { 2746 sc = page.Response().Response.Response.StatusCode 2747 } 2748 tracing.EndSpan(ctx, sc, err) 2749 }() 2750 } 2751 for { 2752 next, err := page.fn(ctx, page.vmlr) 2753 if err != nil { 2754 return err 2755 } 2756 page.vmlr = next 2757 if !next.hasNextLink() || !next.IsEmpty() { 2758 break 2759 } 2760 } 2761 return nil 2762} 2763 2764// Next advances to the next page of values. If there was an error making 2765// the request the page does not advance and the error is returned. 2766// Deprecated: Use NextWithContext() instead. 2767func (page *VirtualMachineListResponsePage) Next() error { 2768 return page.NextWithContext(context.Background()) 2769} 2770 2771// NotDone returns true if the page enumeration should be started or is not yet complete. 2772func (page VirtualMachineListResponsePage) NotDone() bool { 2773 return !page.vmlr.IsEmpty() 2774} 2775 2776// Response returns the raw server response from the last page request. 2777func (page VirtualMachineListResponsePage) Response() VirtualMachineListResponse { 2778 return page.vmlr 2779} 2780 2781// Values returns the slice of values for the current page or nil if there are no values. 2782func (page VirtualMachineListResponsePage) Values() []VirtualMachine { 2783 if page.vmlr.IsEmpty() { 2784 return nil 2785 } 2786 return *page.vmlr.Value 2787} 2788 2789// Creates a new instance of the VirtualMachineListResponsePage type. 2790func NewVirtualMachineListResponsePage(cur VirtualMachineListResponse, getNextPage func(context.Context, VirtualMachineListResponse) (VirtualMachineListResponse, error)) VirtualMachineListResponsePage { 2791 return VirtualMachineListResponsePage{ 2792 fn: getNextPage, 2793 vmlr: cur, 2794 } 2795} 2796 2797// VirtualMachineProperties properties of virtual machine 2798type VirtualMachineProperties struct { 2799 // AmountOfRAM - The amount of memory 2800 AmountOfRAM *int32 `json:"amountOfRam,omitempty"` 2801 // Controllers - READ-ONLY; The list of Virtual Disks' Controllers 2802 Controllers *[]VirtualDiskController `json:"controllers,omitempty"` 2803 // Customization - Virtual machine properties 2804 Customization *GuestOSCustomization `json:"customization,omitempty"` 2805 // Disks - The list of Virtual Disks 2806 Disks *[]VirtualDisk `json:"disks,omitempty"` 2807 // Dnsname - READ-ONLY; The DNS name of Virtual Machine in VCenter 2808 Dnsname *string `json:"dnsname,omitempty"` 2809 // ExposeToGuestVM - Expose Guest OS or not 2810 ExposeToGuestVM *bool `json:"exposeToGuestVM,omitempty"` 2811 // Folder - READ-ONLY; The path to virtual machine folder in VCenter 2812 Folder *string `json:"folder,omitempty"` 2813 // GuestOS - READ-ONLY; The name of Guest OS 2814 GuestOS *string `json:"guestOS,omitempty"` 2815 // GuestOSType - READ-ONLY; The Guest OS type. Possible values include: 'Linux', 'Windows', 'Other' 2816 GuestOSType GuestOSType `json:"guestOSType,omitempty"` 2817 // Nics - The list of Virtual NICs 2818 Nics *[]VirtualNic `json:"nics,omitempty"` 2819 // NumberOfCores - The number of CPU cores 2820 NumberOfCores *int32 `json:"numberOfCores,omitempty"` 2821 // Password - Password for login. Deprecated - use customization property 2822 Password *string `json:"password,omitempty"` 2823 // PrivateCloudID - Private Cloud Id 2824 PrivateCloudID *string `json:"privateCloudId,omitempty"` 2825 // ProvisioningState - READ-ONLY; The provisioning status of the resource 2826 ProvisioningState *string `json:"provisioningState,omitempty"` 2827 // PublicIP - READ-ONLY; The public ip of Virtual Machine 2828 PublicIP *string `json:"publicIP,omitempty"` 2829 // ResourcePool - Virtual Machines Resource Pool 2830 ResourcePool *ResourcePool `json:"resourcePool,omitempty"` 2831 // Status - READ-ONLY; The status of Virtual machine. Possible values include: 'Running', 'Suspended', 'Poweredoff', 'Updating', 'Deallocating', 'Deleting' 2832 Status VirtualMachineStatus `json:"status,omitempty"` 2833 // TemplateID - Virtual Machine Template Id 2834 TemplateID *string `json:"templateId,omitempty"` 2835 // Username - Username for login. Deprecated - use customization property 2836 Username *string `json:"username,omitempty"` 2837 // VSphereNetworks - The list of Virtual VSphere Networks 2838 VSphereNetworks *[]string `json:"vSphereNetworks,omitempty"` 2839 // VMID - READ-ONLY; The internal id of Virtual Machine in VCenter 2840 VMID *string `json:"vmId,omitempty"` 2841 // Vmwaretools - READ-ONLY; VMware tools version 2842 Vmwaretools *string `json:"vmwaretools,omitempty"` 2843} 2844 2845// MarshalJSON is the custom marshaler for VirtualMachineProperties. 2846func (vmp VirtualMachineProperties) MarshalJSON() ([]byte, error) { 2847 objectMap := make(map[string]interface{}) 2848 if vmp.AmountOfRAM != nil { 2849 objectMap["amountOfRam"] = vmp.AmountOfRAM 2850 } 2851 if vmp.Customization != nil { 2852 objectMap["customization"] = vmp.Customization 2853 } 2854 if vmp.Disks != nil { 2855 objectMap["disks"] = vmp.Disks 2856 } 2857 if vmp.ExposeToGuestVM != nil { 2858 objectMap["exposeToGuestVM"] = vmp.ExposeToGuestVM 2859 } 2860 if vmp.Nics != nil { 2861 objectMap["nics"] = vmp.Nics 2862 } 2863 if vmp.NumberOfCores != nil { 2864 objectMap["numberOfCores"] = vmp.NumberOfCores 2865 } 2866 if vmp.Password != nil { 2867 objectMap["password"] = vmp.Password 2868 } 2869 if vmp.PrivateCloudID != nil { 2870 objectMap["privateCloudId"] = vmp.PrivateCloudID 2871 } 2872 if vmp.ResourcePool != nil { 2873 objectMap["resourcePool"] = vmp.ResourcePool 2874 } 2875 if vmp.TemplateID != nil { 2876 objectMap["templateId"] = vmp.TemplateID 2877 } 2878 if vmp.Username != nil { 2879 objectMap["username"] = vmp.Username 2880 } 2881 if vmp.VSphereNetworks != nil { 2882 objectMap["vSphereNetworks"] = vmp.VSphereNetworks 2883 } 2884 return json.Marshal(objectMap) 2885} 2886 2887// VirtualMachinesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 2888// long-running operation. 2889type VirtualMachinesCreateOrUpdateFuture struct { 2890 azure.FutureAPI 2891 // Result returns the result of the asynchronous operation. 2892 // If the operation has not completed it will return an error. 2893 Result func(VirtualMachinesClient) (VirtualMachine, error) 2894} 2895 2896// VirtualMachinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 2897// operation. 2898type VirtualMachinesDeleteFuture struct { 2899 azure.FutureAPI 2900 // Result returns the result of the asynchronous operation. 2901 // If the operation has not completed it will return an error. 2902 Result func(VirtualMachinesClient) (autorest.Response, error) 2903} 2904 2905// VirtualMachinesStartFuture an abstraction for monitoring and retrieving the results of a long-running 2906// operation. 2907type VirtualMachinesStartFuture struct { 2908 azure.FutureAPI 2909 // Result returns the result of the asynchronous operation. 2910 // If the operation has not completed it will return an error. 2911 Result func(VirtualMachinesClient) (autorest.Response, error) 2912} 2913 2914// VirtualMachinesStopFuture an abstraction for monitoring and retrieving the results of a long-running 2915// operation. 2916type VirtualMachinesStopFuture struct { 2917 azure.FutureAPI 2918 // Result returns the result of the asynchronous operation. 2919 // If the operation has not completed it will return an error. 2920 Result func(VirtualMachinesClient) (autorest.Response, error) 2921} 2922 2923// VirtualMachineStopMode list of virtual machine stop modes 2924type VirtualMachineStopMode struct { 2925 // Mode - mode indicates a type of stop operation - reboot, suspend, shutdown or power-off. Possible values include: 'Reboot', 'Suspend', 'Shutdown', 'Poweroff' 2926 Mode StopMode `json:"mode,omitempty"` 2927} 2928 2929// VirtualMachinesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2930// operation. 2931type VirtualMachinesUpdateFuture struct { 2932 azure.FutureAPI 2933 // Result returns the result of the asynchronous operation. 2934 // If the operation has not completed it will return an error. 2935 Result func(VirtualMachinesClient) (VirtualMachine, error) 2936} 2937 2938// VirtualMachineTemplate virtual machine template model 2939type VirtualMachineTemplate struct { 2940 autorest.Response `json:"-"` 2941 // ID - READ-ONLY; virtual machine template id (privateCloudId:vsphereId) 2942 ID *string `json:"id,omitempty"` 2943 // Location - Azure region 2944 Location *string `json:"location,omitempty"` 2945 // Name - READ-ONLY; {virtualMachineTemplateName} 2946 Name *string `json:"name,omitempty"` 2947 // VirtualMachineTemplateProperties - The Virtual Machine Template properties 2948 *VirtualMachineTemplateProperties `json:"properties,omitempty"` 2949 // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} 2950 Type *string `json:"type,omitempty"` 2951} 2952 2953// MarshalJSON is the custom marshaler for VirtualMachineTemplate. 2954func (vmt VirtualMachineTemplate) MarshalJSON() ([]byte, error) { 2955 objectMap := make(map[string]interface{}) 2956 if vmt.Location != nil { 2957 objectMap["location"] = vmt.Location 2958 } 2959 if vmt.VirtualMachineTemplateProperties != nil { 2960 objectMap["properties"] = vmt.VirtualMachineTemplateProperties 2961 } 2962 return json.Marshal(objectMap) 2963} 2964 2965// UnmarshalJSON is the custom unmarshaler for VirtualMachineTemplate struct. 2966func (vmt *VirtualMachineTemplate) UnmarshalJSON(body []byte) error { 2967 var m map[string]*json.RawMessage 2968 err := json.Unmarshal(body, &m) 2969 if err != nil { 2970 return err 2971 } 2972 for k, v := range m { 2973 switch k { 2974 case "id": 2975 if v != nil { 2976 var ID string 2977 err = json.Unmarshal(*v, &ID) 2978 if err != nil { 2979 return err 2980 } 2981 vmt.ID = &ID 2982 } 2983 case "location": 2984 if v != nil { 2985 var location string 2986 err = json.Unmarshal(*v, &location) 2987 if err != nil { 2988 return err 2989 } 2990 vmt.Location = &location 2991 } 2992 case "name": 2993 if v != nil { 2994 var name string 2995 err = json.Unmarshal(*v, &name) 2996 if err != nil { 2997 return err 2998 } 2999 vmt.Name = &name 3000 } 3001 case "properties": 3002 if v != nil { 3003 var virtualMachineTemplateProperties VirtualMachineTemplateProperties 3004 err = json.Unmarshal(*v, &virtualMachineTemplateProperties) 3005 if err != nil { 3006 return err 3007 } 3008 vmt.VirtualMachineTemplateProperties = &virtualMachineTemplateProperties 3009 } 3010 case "type": 3011 if v != nil { 3012 var typeVar string 3013 err = json.Unmarshal(*v, &typeVar) 3014 if err != nil { 3015 return err 3016 } 3017 vmt.Type = &typeVar 3018 } 3019 } 3020 } 3021 3022 return nil 3023} 3024 3025// VirtualMachineTemplateListResponse list of virtual machine templates 3026type VirtualMachineTemplateListResponse struct { 3027 autorest.Response `json:"-"` 3028 // NextLink - Link for next list of VirtualMachineTemplate 3029 NextLink *string `json:"nextLink,omitempty"` 3030 // Value - Results of the VM template list 3031 Value *[]VirtualMachineTemplate `json:"value,omitempty"` 3032} 3033 3034// VirtualMachineTemplateListResponseIterator provides access to a complete listing of 3035// VirtualMachineTemplate values. 3036type VirtualMachineTemplateListResponseIterator struct { 3037 i int 3038 page VirtualMachineTemplateListResponsePage 3039} 3040 3041// NextWithContext advances to the next value. If there was an error making 3042// the request the iterator does not advance and the error is returned. 3043func (iter *VirtualMachineTemplateListResponseIterator) NextWithContext(ctx context.Context) (err error) { 3044 if tracing.IsEnabled() { 3045 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineTemplateListResponseIterator.NextWithContext") 3046 defer func() { 3047 sc := -1 3048 if iter.Response().Response.Response != nil { 3049 sc = iter.Response().Response.Response.StatusCode 3050 } 3051 tracing.EndSpan(ctx, sc, err) 3052 }() 3053 } 3054 iter.i++ 3055 if iter.i < len(iter.page.Values()) { 3056 return nil 3057 } 3058 err = iter.page.NextWithContext(ctx) 3059 if err != nil { 3060 iter.i-- 3061 return err 3062 } 3063 iter.i = 0 3064 return nil 3065} 3066 3067// Next advances to the next value. If there was an error making 3068// the request the iterator does not advance and the error is returned. 3069// Deprecated: Use NextWithContext() instead. 3070func (iter *VirtualMachineTemplateListResponseIterator) Next() error { 3071 return iter.NextWithContext(context.Background()) 3072} 3073 3074// NotDone returns true if the enumeration should be started or is not yet complete. 3075func (iter VirtualMachineTemplateListResponseIterator) NotDone() bool { 3076 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3077} 3078 3079// Response returns the raw server response from the last page request. 3080func (iter VirtualMachineTemplateListResponseIterator) Response() VirtualMachineTemplateListResponse { 3081 return iter.page.Response() 3082} 3083 3084// Value returns the current value or a zero-initialized value if the 3085// iterator has advanced beyond the end of the collection. 3086func (iter VirtualMachineTemplateListResponseIterator) Value() VirtualMachineTemplate { 3087 if !iter.page.NotDone() { 3088 return VirtualMachineTemplate{} 3089 } 3090 return iter.page.Values()[iter.i] 3091} 3092 3093// Creates a new instance of the VirtualMachineTemplateListResponseIterator type. 3094func NewVirtualMachineTemplateListResponseIterator(page VirtualMachineTemplateListResponsePage) VirtualMachineTemplateListResponseIterator { 3095 return VirtualMachineTemplateListResponseIterator{page: page} 3096} 3097 3098// IsEmpty returns true if the ListResult contains no values. 3099func (vmtlr VirtualMachineTemplateListResponse) IsEmpty() bool { 3100 return vmtlr.Value == nil || len(*vmtlr.Value) == 0 3101} 3102 3103// hasNextLink returns true if the NextLink is not empty. 3104func (vmtlr VirtualMachineTemplateListResponse) hasNextLink() bool { 3105 return vmtlr.NextLink != nil && len(*vmtlr.NextLink) != 0 3106} 3107 3108// virtualMachineTemplateListResponsePreparer prepares a request to retrieve the next set of results. 3109// It returns nil if no more results exist. 3110func (vmtlr VirtualMachineTemplateListResponse) virtualMachineTemplateListResponsePreparer(ctx context.Context) (*http.Request, error) { 3111 if !vmtlr.hasNextLink() { 3112 return nil, nil 3113 } 3114 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3115 autorest.AsJSON(), 3116 autorest.AsGet(), 3117 autorest.WithBaseURL(to.String(vmtlr.NextLink))) 3118} 3119 3120// VirtualMachineTemplateListResponsePage contains a page of VirtualMachineTemplate values. 3121type VirtualMachineTemplateListResponsePage struct { 3122 fn func(context.Context, VirtualMachineTemplateListResponse) (VirtualMachineTemplateListResponse, error) 3123 vmtlr VirtualMachineTemplateListResponse 3124} 3125 3126// NextWithContext advances to the next page of values. If there was an error making 3127// the request the page does not advance and the error is returned. 3128func (page *VirtualMachineTemplateListResponsePage) NextWithContext(ctx context.Context) (err error) { 3129 if tracing.IsEnabled() { 3130 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineTemplateListResponsePage.NextWithContext") 3131 defer func() { 3132 sc := -1 3133 if page.Response().Response.Response != nil { 3134 sc = page.Response().Response.Response.StatusCode 3135 } 3136 tracing.EndSpan(ctx, sc, err) 3137 }() 3138 } 3139 for { 3140 next, err := page.fn(ctx, page.vmtlr) 3141 if err != nil { 3142 return err 3143 } 3144 page.vmtlr = next 3145 if !next.hasNextLink() || !next.IsEmpty() { 3146 break 3147 } 3148 } 3149 return nil 3150} 3151 3152// Next advances to the next page of values. If there was an error making 3153// the request the page does not advance and the error is returned. 3154// Deprecated: Use NextWithContext() instead. 3155func (page *VirtualMachineTemplateListResponsePage) Next() error { 3156 return page.NextWithContext(context.Background()) 3157} 3158 3159// NotDone returns true if the page enumeration should be started or is not yet complete. 3160func (page VirtualMachineTemplateListResponsePage) NotDone() bool { 3161 return !page.vmtlr.IsEmpty() 3162} 3163 3164// Response returns the raw server response from the last page request. 3165func (page VirtualMachineTemplateListResponsePage) Response() VirtualMachineTemplateListResponse { 3166 return page.vmtlr 3167} 3168 3169// Values returns the slice of values for the current page or nil if there are no values. 3170func (page VirtualMachineTemplateListResponsePage) Values() []VirtualMachineTemplate { 3171 if page.vmtlr.IsEmpty() { 3172 return nil 3173 } 3174 return *page.vmtlr.Value 3175} 3176 3177// Creates a new instance of the VirtualMachineTemplateListResponsePage type. 3178func NewVirtualMachineTemplateListResponsePage(cur VirtualMachineTemplateListResponse, getNextPage func(context.Context, VirtualMachineTemplateListResponse) (VirtualMachineTemplateListResponse, error)) VirtualMachineTemplateListResponsePage { 3179 return VirtualMachineTemplateListResponsePage{ 3180 fn: getNextPage, 3181 vmtlr: cur, 3182 } 3183} 3184 3185// VirtualMachineTemplateProperties properties of virtual machine template 3186type VirtualMachineTemplateProperties struct { 3187 // AmountOfRAM - The amount of memory 3188 AmountOfRAM *int32 `json:"amountOfRam,omitempty"` 3189 // Controllers - The list of Virtual Disk Controllers 3190 Controllers *[]VirtualDiskController `json:"controllers,omitempty"` 3191 // Description - The description of Virtual Machine Template 3192 Description *string `json:"description,omitempty"` 3193 // Disks - The list of Virtual Disks 3194 Disks *[]VirtualDisk `json:"disks,omitempty"` 3195 // ExposeToGuestVM - Expose Guest OS or not 3196 ExposeToGuestVM *bool `json:"exposeToGuestVM,omitempty"` 3197 // GuestOS - READ-ONLY; The Guest OS 3198 GuestOS *string `json:"guestOS,omitempty"` 3199 // GuestOSType - READ-ONLY; The Guest OS types 3200 GuestOSType *string `json:"guestOSType,omitempty"` 3201 // Nics - The list of Virtual NICs 3202 Nics *[]VirtualNic `json:"nics,omitempty"` 3203 // NumberOfCores - The number of CPU cores 3204 NumberOfCores *int32 `json:"numberOfCores,omitempty"` 3205 // Path - path to folder 3206 Path *string `json:"path,omitempty"` 3207 // PrivateCloudID - The Private Cloud Id 3208 PrivateCloudID *string `json:"privateCloudId,omitempty"` 3209 // VSphereNetworks - The list of VSphere networks 3210 VSphereNetworks *[]string `json:"vSphereNetworks,omitempty"` 3211 // VSphereTags - The tags from VSphere 3212 VSphereTags *[]string `json:"vSphereTags,omitempty"` 3213 // Vmwaretools - READ-ONLY; The VMware tools version 3214 Vmwaretools *string `json:"vmwaretools,omitempty"` 3215} 3216 3217// MarshalJSON is the custom marshaler for VirtualMachineTemplateProperties. 3218func (vmtp VirtualMachineTemplateProperties) MarshalJSON() ([]byte, error) { 3219 objectMap := make(map[string]interface{}) 3220 if vmtp.AmountOfRAM != nil { 3221 objectMap["amountOfRam"] = vmtp.AmountOfRAM 3222 } 3223 if vmtp.Controllers != nil { 3224 objectMap["controllers"] = vmtp.Controllers 3225 } 3226 if vmtp.Description != nil { 3227 objectMap["description"] = vmtp.Description 3228 } 3229 if vmtp.Disks != nil { 3230 objectMap["disks"] = vmtp.Disks 3231 } 3232 if vmtp.ExposeToGuestVM != nil { 3233 objectMap["exposeToGuestVM"] = vmtp.ExposeToGuestVM 3234 } 3235 if vmtp.Nics != nil { 3236 objectMap["nics"] = vmtp.Nics 3237 } 3238 if vmtp.NumberOfCores != nil { 3239 objectMap["numberOfCores"] = vmtp.NumberOfCores 3240 } 3241 if vmtp.Path != nil { 3242 objectMap["path"] = vmtp.Path 3243 } 3244 if vmtp.PrivateCloudID != nil { 3245 objectMap["privateCloudId"] = vmtp.PrivateCloudID 3246 } 3247 if vmtp.VSphereNetworks != nil { 3248 objectMap["vSphereNetworks"] = vmtp.VSphereNetworks 3249 } 3250 if vmtp.VSphereTags != nil { 3251 objectMap["vSphereTags"] = vmtp.VSphereTags 3252 } 3253 return json.Marshal(objectMap) 3254} 3255 3256// VirtualNetwork virtual network model 3257type VirtualNetwork struct { 3258 autorest.Response `json:"-"` 3259 // Assignable - READ-ONLY; can be used in vm creation/deletion 3260 Assignable *bool `json:"assignable,omitempty"` 3261 // ID - virtual network id (privateCloudId:vsphereId) 3262 ID *string `json:"id,omitempty"` 3263 // Location - READ-ONLY; Azure region 3264 Location *string `json:"location,omitempty"` 3265 // Name - READ-ONLY; {VirtualNetworkName} 3266 Name *string `json:"name,omitempty"` 3267 // VirtualNetworkProperties - Virtual Network properties 3268 *VirtualNetworkProperties `json:"properties,omitempty"` 3269 // Type - READ-ONLY; {resourceProviderNamespace}/{resourceType} 3270 Type *string `json:"type,omitempty"` 3271} 3272 3273// MarshalJSON is the custom marshaler for VirtualNetwork. 3274func (vn VirtualNetwork) MarshalJSON() ([]byte, error) { 3275 objectMap := make(map[string]interface{}) 3276 if vn.ID != nil { 3277 objectMap["id"] = vn.ID 3278 } 3279 if vn.VirtualNetworkProperties != nil { 3280 objectMap["properties"] = vn.VirtualNetworkProperties 3281 } 3282 return json.Marshal(objectMap) 3283} 3284 3285// UnmarshalJSON is the custom unmarshaler for VirtualNetwork struct. 3286func (vn *VirtualNetwork) UnmarshalJSON(body []byte) error { 3287 var m map[string]*json.RawMessage 3288 err := json.Unmarshal(body, &m) 3289 if err != nil { 3290 return err 3291 } 3292 for k, v := range m { 3293 switch k { 3294 case "assignable": 3295 if v != nil { 3296 var assignable bool 3297 err = json.Unmarshal(*v, &assignable) 3298 if err != nil { 3299 return err 3300 } 3301 vn.Assignable = &assignable 3302 } 3303 case "id": 3304 if v != nil { 3305 var ID string 3306 err = json.Unmarshal(*v, &ID) 3307 if err != nil { 3308 return err 3309 } 3310 vn.ID = &ID 3311 } 3312 case "location": 3313 if v != nil { 3314 var location string 3315 err = json.Unmarshal(*v, &location) 3316 if err != nil { 3317 return err 3318 } 3319 vn.Location = &location 3320 } 3321 case "name": 3322 if v != nil { 3323 var name string 3324 err = json.Unmarshal(*v, &name) 3325 if err != nil { 3326 return err 3327 } 3328 vn.Name = &name 3329 } 3330 case "properties": 3331 if v != nil { 3332 var virtualNetworkProperties VirtualNetworkProperties 3333 err = json.Unmarshal(*v, &virtualNetworkProperties) 3334 if err != nil { 3335 return err 3336 } 3337 vn.VirtualNetworkProperties = &virtualNetworkProperties 3338 } 3339 case "type": 3340 if v != nil { 3341 var typeVar string 3342 err = json.Unmarshal(*v, &typeVar) 3343 if err != nil { 3344 return err 3345 } 3346 vn.Type = &typeVar 3347 } 3348 } 3349 } 3350 3351 return nil 3352} 3353 3354// VirtualNetworkListResponse list of virtual networks 3355type VirtualNetworkListResponse struct { 3356 autorest.Response `json:"-"` 3357 // NextLink - Link for next list of VirtualNetwork 3358 NextLink *string `json:"nextLink,omitempty"` 3359 // Value - Results of the VirtualNetwork list 3360 Value *[]VirtualNetwork `json:"value,omitempty"` 3361} 3362 3363// VirtualNetworkListResponseIterator provides access to a complete listing of VirtualNetwork values. 3364type VirtualNetworkListResponseIterator struct { 3365 i int 3366 page VirtualNetworkListResponsePage 3367} 3368 3369// NextWithContext advances to the next value. If there was an error making 3370// the request the iterator does not advance and the error is returned. 3371func (iter *VirtualNetworkListResponseIterator) NextWithContext(ctx context.Context) (err error) { 3372 if tracing.IsEnabled() { 3373 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResponseIterator.NextWithContext") 3374 defer func() { 3375 sc := -1 3376 if iter.Response().Response.Response != nil { 3377 sc = iter.Response().Response.Response.StatusCode 3378 } 3379 tracing.EndSpan(ctx, sc, err) 3380 }() 3381 } 3382 iter.i++ 3383 if iter.i < len(iter.page.Values()) { 3384 return nil 3385 } 3386 err = iter.page.NextWithContext(ctx) 3387 if err != nil { 3388 iter.i-- 3389 return err 3390 } 3391 iter.i = 0 3392 return nil 3393} 3394 3395// Next advances to the next value. If there was an error making 3396// the request the iterator does not advance and the error is returned. 3397// Deprecated: Use NextWithContext() instead. 3398func (iter *VirtualNetworkListResponseIterator) Next() error { 3399 return iter.NextWithContext(context.Background()) 3400} 3401 3402// NotDone returns true if the enumeration should be started or is not yet complete. 3403func (iter VirtualNetworkListResponseIterator) NotDone() bool { 3404 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3405} 3406 3407// Response returns the raw server response from the last page request. 3408func (iter VirtualNetworkListResponseIterator) Response() VirtualNetworkListResponse { 3409 return iter.page.Response() 3410} 3411 3412// Value returns the current value or a zero-initialized value if the 3413// iterator has advanced beyond the end of the collection. 3414func (iter VirtualNetworkListResponseIterator) Value() VirtualNetwork { 3415 if !iter.page.NotDone() { 3416 return VirtualNetwork{} 3417 } 3418 return iter.page.Values()[iter.i] 3419} 3420 3421// Creates a new instance of the VirtualNetworkListResponseIterator type. 3422func NewVirtualNetworkListResponseIterator(page VirtualNetworkListResponsePage) VirtualNetworkListResponseIterator { 3423 return VirtualNetworkListResponseIterator{page: page} 3424} 3425 3426// IsEmpty returns true if the ListResult contains no values. 3427func (vnlr VirtualNetworkListResponse) IsEmpty() bool { 3428 return vnlr.Value == nil || len(*vnlr.Value) == 0 3429} 3430 3431// hasNextLink returns true if the NextLink is not empty. 3432func (vnlr VirtualNetworkListResponse) hasNextLink() bool { 3433 return vnlr.NextLink != nil && len(*vnlr.NextLink) != 0 3434} 3435 3436// virtualNetworkListResponsePreparer prepares a request to retrieve the next set of results. 3437// It returns nil if no more results exist. 3438func (vnlr VirtualNetworkListResponse) virtualNetworkListResponsePreparer(ctx context.Context) (*http.Request, error) { 3439 if !vnlr.hasNextLink() { 3440 return nil, nil 3441 } 3442 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3443 autorest.AsJSON(), 3444 autorest.AsGet(), 3445 autorest.WithBaseURL(to.String(vnlr.NextLink))) 3446} 3447 3448// VirtualNetworkListResponsePage contains a page of VirtualNetwork values. 3449type VirtualNetworkListResponsePage struct { 3450 fn func(context.Context, VirtualNetworkListResponse) (VirtualNetworkListResponse, error) 3451 vnlr VirtualNetworkListResponse 3452} 3453 3454// NextWithContext advances to the next page of values. If there was an error making 3455// the request the page does not advance and the error is returned. 3456func (page *VirtualNetworkListResponsePage) NextWithContext(ctx context.Context) (err error) { 3457 if tracing.IsEnabled() { 3458 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResponsePage.NextWithContext") 3459 defer func() { 3460 sc := -1 3461 if page.Response().Response.Response != nil { 3462 sc = page.Response().Response.Response.StatusCode 3463 } 3464 tracing.EndSpan(ctx, sc, err) 3465 }() 3466 } 3467 for { 3468 next, err := page.fn(ctx, page.vnlr) 3469 if err != nil { 3470 return err 3471 } 3472 page.vnlr = next 3473 if !next.hasNextLink() || !next.IsEmpty() { 3474 break 3475 } 3476 } 3477 return nil 3478} 3479 3480// Next advances to the next page of values. If there was an error making 3481// the request the page does not advance and the error is returned. 3482// Deprecated: Use NextWithContext() instead. 3483func (page *VirtualNetworkListResponsePage) Next() error { 3484 return page.NextWithContext(context.Background()) 3485} 3486 3487// NotDone returns true if the page enumeration should be started or is not yet complete. 3488func (page VirtualNetworkListResponsePage) NotDone() bool { 3489 return !page.vnlr.IsEmpty() 3490} 3491 3492// Response returns the raw server response from the last page request. 3493func (page VirtualNetworkListResponsePage) Response() VirtualNetworkListResponse { 3494 return page.vnlr 3495} 3496 3497// Values returns the slice of values for the current page or nil if there are no values. 3498func (page VirtualNetworkListResponsePage) Values() []VirtualNetwork { 3499 if page.vnlr.IsEmpty() { 3500 return nil 3501 } 3502 return *page.vnlr.Value 3503} 3504 3505// Creates a new instance of the VirtualNetworkListResponsePage type. 3506func NewVirtualNetworkListResponsePage(cur VirtualNetworkListResponse, getNextPage func(context.Context, VirtualNetworkListResponse) (VirtualNetworkListResponse, error)) VirtualNetworkListResponsePage { 3507 return VirtualNetworkListResponsePage{ 3508 fn: getNextPage, 3509 vnlr: cur, 3510 } 3511} 3512 3513// VirtualNetworkProperties properties of virtual network 3514type VirtualNetworkProperties struct { 3515 // PrivateCloudID - READ-ONLY; The Private Cloud id 3516 PrivateCloudID *string `json:"privateCloudId,omitempty"` 3517} 3518 3519// VirtualNic virtual NIC model 3520type VirtualNic struct { 3521 // Customization - guest OS customization for nic 3522 Customization *GuestOSNICCustomization `json:"customization,omitempty"` 3523 // IPAddresses - NIC ip address 3524 IPAddresses *[]string `json:"ipAddresses,omitempty"` 3525 // MacAddress - NIC MAC address 3526 MacAddress *string `json:"macAddress,omitempty"` 3527 // Network - Virtual Network 3528 Network *VirtualNetwork `json:"network,omitempty"` 3529 // NicType - NIC type. Possible values include: 'E1000', 'E1000E', 'PCNET32', 'VMXNET', 'VMXNET2', 'VMXNET3' 3530 NicType NICType `json:"nicType,omitempty"` 3531 // PowerOnBoot - Is NIC powered on/off on boot 3532 PowerOnBoot *bool `json:"powerOnBoot,omitempty"` 3533 // VirtualNicID - NIC id 3534 VirtualNicID *string `json:"virtualNicId,omitempty"` 3535 // VirtualNicName - READ-ONLY; NIC name 3536 VirtualNicName *string `json:"virtualNicName,omitempty"` 3537} 3538 3539// MarshalJSON is the custom marshaler for VirtualNic. 3540func (vn VirtualNic) MarshalJSON() ([]byte, error) { 3541 objectMap := make(map[string]interface{}) 3542 if vn.Customization != nil { 3543 objectMap["customization"] = vn.Customization 3544 } 3545 if vn.IPAddresses != nil { 3546 objectMap["ipAddresses"] = vn.IPAddresses 3547 } 3548 if vn.MacAddress != nil { 3549 objectMap["macAddress"] = vn.MacAddress 3550 } 3551 if vn.Network != nil { 3552 objectMap["network"] = vn.Network 3553 } 3554 if vn.NicType != "" { 3555 objectMap["nicType"] = vn.NicType 3556 } 3557 if vn.PowerOnBoot != nil { 3558 objectMap["powerOnBoot"] = vn.PowerOnBoot 3559 } 3560 if vn.VirtualNicID != nil { 3561 objectMap["virtualNicId"] = vn.VirtualNicID 3562 } 3563 return json.Marshal(objectMap) 3564} 3565