1package avs 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "github.com/Azure/go-autorest/autorest/to" 15 "github.com/Azure/go-autorest/tracing" 16 "net/http" 17) 18 19// The package's fully qualified name. 20const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/avs/mgmt/2020-07-17-preview/avs" 21 22// AdminCredentials administrative credentials for accessing vCenter and NSX-T 23type AdminCredentials struct { 24 autorest.Response `json:"-"` 25 // NsxtUsername - READ-ONLY; NSX-T Manager username 26 NsxtUsername *string `json:"nsxtUsername,omitempty"` 27 // NsxtPassword - READ-ONLY; NSX-T Manager password 28 NsxtPassword *string `json:"nsxtPassword,omitempty"` 29 // VcenterUsername - READ-ONLY; vCenter admin username 30 VcenterUsername *string `json:"vcenterUsername,omitempty"` 31 // VcenterPassword - READ-ONLY; vCenter admin password 32 VcenterPassword *string `json:"vcenterPassword,omitempty"` 33} 34 35// MarshalJSON is the custom marshaler for AdminCredentials. 36func (ac AdminCredentials) MarshalJSON() ([]byte, error) { 37 objectMap := make(map[string]interface{}) 38 return json.Marshal(objectMap) 39} 40 41// AuthorizationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 42// long-running operation. 43type AuthorizationsCreateOrUpdateFuture struct { 44 azure.FutureAPI 45 // Result returns the result of the asynchronous operation. 46 // If the operation has not completed it will return an error. 47 Result func(AuthorizationsClient) (ExpressRouteAuthorization, error) 48} 49 50// UnmarshalJSON is the custom unmarshaller for CreateFuture. 51func (future *AuthorizationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 52 var azFuture azure.Future 53 if err := json.Unmarshal(body, &azFuture); err != nil { 54 return err 55 } 56 future.FutureAPI = &azFuture 57 future.Result = future.result 58 return nil 59} 60 61// result is the default implementation for AuthorizationsCreateOrUpdateFuture.Result. 62func (future *AuthorizationsCreateOrUpdateFuture) result(client AuthorizationsClient) (era ExpressRouteAuthorization, err error) { 63 var done bool 64 done, err = future.DoneWithContext(context.Background(), client) 65 if err != nil { 66 err = autorest.NewErrorWithError(err, "avs.AuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 67 return 68 } 69 if !done { 70 era.Response.Response = future.Response() 71 err = azure.NewAsyncOpIncompleteError("avs.AuthorizationsCreateOrUpdateFuture") 72 return 73 } 74 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 75 if era.Response.Response, err = future.GetResult(sender); err == nil && era.Response.Response.StatusCode != http.StatusNoContent { 76 era, err = client.CreateOrUpdateResponder(era.Response.Response) 77 if err != nil { 78 err = autorest.NewErrorWithError(err, "avs.AuthorizationsCreateOrUpdateFuture", "Result", era.Response.Response, "Failure responding to request") 79 } 80 } 81 return 82} 83 84// AuthorizationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 85// operation. 86type AuthorizationsDeleteFuture struct { 87 azure.FutureAPI 88 // Result returns the result of the asynchronous operation. 89 // If the operation has not completed it will return an error. 90 Result func(AuthorizationsClient) (autorest.Response, error) 91} 92 93// UnmarshalJSON is the custom unmarshaller for CreateFuture. 94func (future *AuthorizationsDeleteFuture) UnmarshalJSON(body []byte) error { 95 var azFuture azure.Future 96 if err := json.Unmarshal(body, &azFuture); err != nil { 97 return err 98 } 99 future.FutureAPI = &azFuture 100 future.Result = future.result 101 return nil 102} 103 104// result is the default implementation for AuthorizationsDeleteFuture.Result. 105func (future *AuthorizationsDeleteFuture) result(client AuthorizationsClient) (ar autorest.Response, err error) { 106 var done bool 107 done, err = future.DoneWithContext(context.Background(), client) 108 if err != nil { 109 err = autorest.NewErrorWithError(err, "avs.AuthorizationsDeleteFuture", "Result", future.Response(), "Polling failure") 110 return 111 } 112 if !done { 113 ar.Response = future.Response() 114 err = azure.NewAsyncOpIncompleteError("avs.AuthorizationsDeleteFuture") 115 return 116 } 117 ar.Response = future.Response() 118 return 119} 120 121// Circuit an ExpressRoute Circuit 122type Circuit struct { 123 // PrimarySubnet - READ-ONLY; CIDR of primary subnet 124 PrimarySubnet *string `json:"primarySubnet,omitempty"` 125 // SecondarySubnet - READ-ONLY; CIDR of secondary subnet 126 SecondarySubnet *string `json:"secondarySubnet,omitempty"` 127 // ExpressRouteID - READ-ONLY; Identifier of the ExpressRoute Circuit (Microsoft Colo only) 128 ExpressRouteID *string `json:"expressRouteID,omitempty"` 129 // ExpressRoutePrivatePeeringID - READ-ONLY; ExpressRoute Circuit private peering identifier 130 ExpressRoutePrivatePeeringID *string `json:"expressRoutePrivatePeeringID,omitempty"` 131} 132 133// MarshalJSON is the custom marshaler for Circuit. 134func (c Circuit) MarshalJSON() ([]byte, error) { 135 objectMap := make(map[string]interface{}) 136 return json.Marshal(objectMap) 137} 138 139// CloudError API error response 140type CloudError struct { 141 // Error - An error returned by the API 142 Error *ErrorResponse `json:"error,omitempty"` 143} 144 145// Cluster a cluster resource 146type Cluster struct { 147 autorest.Response `json:"-"` 148 // Sku - The cluster SKU 149 Sku *Sku `json:"sku,omitempty"` 150 // ClusterProperties - The properties of a cluster resource 151 *ClusterProperties `json:"properties,omitempty"` 152 // ID - READ-ONLY; Resource ID. 153 ID *string `json:"id,omitempty"` 154 // Name - READ-ONLY; Resource name. 155 Name *string `json:"name,omitempty"` 156 // Type - READ-ONLY; Resource type. 157 Type *string `json:"type,omitempty"` 158} 159 160// MarshalJSON is the custom marshaler for Cluster. 161func (c Cluster) MarshalJSON() ([]byte, error) { 162 objectMap := make(map[string]interface{}) 163 if c.Sku != nil { 164 objectMap["sku"] = c.Sku 165 } 166 if c.ClusterProperties != nil { 167 objectMap["properties"] = c.ClusterProperties 168 } 169 return json.Marshal(objectMap) 170} 171 172// UnmarshalJSON is the custom unmarshaler for Cluster struct. 173func (c *Cluster) UnmarshalJSON(body []byte) error { 174 var m map[string]*json.RawMessage 175 err := json.Unmarshal(body, &m) 176 if err != nil { 177 return err 178 } 179 for k, v := range m { 180 switch k { 181 case "sku": 182 if v != nil { 183 var sku Sku 184 err = json.Unmarshal(*v, &sku) 185 if err != nil { 186 return err 187 } 188 c.Sku = &sku 189 } 190 case "properties": 191 if v != nil { 192 var clusterProperties ClusterProperties 193 err = json.Unmarshal(*v, &clusterProperties) 194 if err != nil { 195 return err 196 } 197 c.ClusterProperties = &clusterProperties 198 } 199 case "id": 200 if v != nil { 201 var ID string 202 err = json.Unmarshal(*v, &ID) 203 if err != nil { 204 return err 205 } 206 c.ID = &ID 207 } 208 case "name": 209 if v != nil { 210 var name string 211 err = json.Unmarshal(*v, &name) 212 if err != nil { 213 return err 214 } 215 c.Name = &name 216 } 217 case "type": 218 if v != nil { 219 var typeVar string 220 err = json.Unmarshal(*v, &typeVar) 221 if err != nil { 222 return err 223 } 224 c.Type = &typeVar 225 } 226 } 227 } 228 229 return nil 230} 231 232// ClusterList a paged list of clusters 233type ClusterList struct { 234 autorest.Response `json:"-"` 235 // Value - READ-ONLY; The items on a page 236 Value *[]Cluster `json:"value,omitempty"` 237 // NextLink - READ-ONLY; URL to get the next page if any 238 NextLink *string `json:"nextLink,omitempty"` 239} 240 241// MarshalJSON is the custom marshaler for ClusterList. 242func (cl ClusterList) MarshalJSON() ([]byte, error) { 243 objectMap := make(map[string]interface{}) 244 return json.Marshal(objectMap) 245} 246 247// ClusterListIterator provides access to a complete listing of Cluster values. 248type ClusterListIterator struct { 249 i int 250 page ClusterListPage 251} 252 253// NextWithContext advances to the next value. If there was an error making 254// the request the iterator does not advance and the error is returned. 255func (iter *ClusterListIterator) NextWithContext(ctx context.Context) (err error) { 256 if tracing.IsEnabled() { 257 ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListIterator.NextWithContext") 258 defer func() { 259 sc := -1 260 if iter.Response().Response.Response != nil { 261 sc = iter.Response().Response.Response.StatusCode 262 } 263 tracing.EndSpan(ctx, sc, err) 264 }() 265 } 266 iter.i++ 267 if iter.i < len(iter.page.Values()) { 268 return nil 269 } 270 err = iter.page.NextWithContext(ctx) 271 if err != nil { 272 iter.i-- 273 return err 274 } 275 iter.i = 0 276 return nil 277} 278 279// Next advances to the next value. If there was an error making 280// the request the iterator does not advance and the error is returned. 281// Deprecated: Use NextWithContext() instead. 282func (iter *ClusterListIterator) Next() error { 283 return iter.NextWithContext(context.Background()) 284} 285 286// NotDone returns true if the enumeration should be started or is not yet complete. 287func (iter ClusterListIterator) NotDone() bool { 288 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 289} 290 291// Response returns the raw server response from the last page request. 292func (iter ClusterListIterator) Response() ClusterList { 293 return iter.page.Response() 294} 295 296// Value returns the current value or a zero-initialized value if the 297// iterator has advanced beyond the end of the collection. 298func (iter ClusterListIterator) Value() Cluster { 299 if !iter.page.NotDone() { 300 return Cluster{} 301 } 302 return iter.page.Values()[iter.i] 303} 304 305// Creates a new instance of the ClusterListIterator type. 306func NewClusterListIterator(page ClusterListPage) ClusterListIterator { 307 return ClusterListIterator{page: page} 308} 309 310// IsEmpty returns true if the ListResult contains no values. 311func (cl ClusterList) IsEmpty() bool { 312 return cl.Value == nil || len(*cl.Value) == 0 313} 314 315// hasNextLink returns true if the NextLink is not empty. 316func (cl ClusterList) hasNextLink() bool { 317 return cl.NextLink != nil && len(*cl.NextLink) != 0 318} 319 320// clusterListPreparer prepares a request to retrieve the next set of results. 321// It returns nil if no more results exist. 322func (cl ClusterList) clusterListPreparer(ctx context.Context) (*http.Request, error) { 323 if !cl.hasNextLink() { 324 return nil, nil 325 } 326 return autorest.Prepare((&http.Request{}).WithContext(ctx), 327 autorest.AsJSON(), 328 autorest.AsGet(), 329 autorest.WithBaseURL(to.String(cl.NextLink))) 330} 331 332// ClusterListPage contains a page of Cluster values. 333type ClusterListPage struct { 334 fn func(context.Context, ClusterList) (ClusterList, error) 335 cl ClusterList 336} 337 338// NextWithContext advances to the next page of values. If there was an error making 339// the request the page does not advance and the error is returned. 340func (page *ClusterListPage) NextWithContext(ctx context.Context) (err error) { 341 if tracing.IsEnabled() { 342 ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListPage.NextWithContext") 343 defer func() { 344 sc := -1 345 if page.Response().Response.Response != nil { 346 sc = page.Response().Response.Response.StatusCode 347 } 348 tracing.EndSpan(ctx, sc, err) 349 }() 350 } 351 for { 352 next, err := page.fn(ctx, page.cl) 353 if err != nil { 354 return err 355 } 356 page.cl = next 357 if !next.hasNextLink() || !next.IsEmpty() { 358 break 359 } 360 } 361 return nil 362} 363 364// Next advances to the next page of values. If there was an error making 365// the request the page does not advance and the error is returned. 366// Deprecated: Use NextWithContext() instead. 367func (page *ClusterListPage) Next() error { 368 return page.NextWithContext(context.Background()) 369} 370 371// NotDone returns true if the page enumeration should be started or is not yet complete. 372func (page ClusterListPage) NotDone() bool { 373 return !page.cl.IsEmpty() 374} 375 376// Response returns the raw server response from the last page request. 377func (page ClusterListPage) Response() ClusterList { 378 return page.cl 379} 380 381// Values returns the slice of values for the current page or nil if there are no values. 382func (page ClusterListPage) Values() []Cluster { 383 if page.cl.IsEmpty() { 384 return nil 385 } 386 return *page.cl.Value 387} 388 389// Creates a new instance of the ClusterListPage type. 390func NewClusterListPage(cur ClusterList, getNextPage func(context.Context, ClusterList) (ClusterList, error)) ClusterListPage { 391 return ClusterListPage{ 392 fn: getNextPage, 393 cl: cur, 394 } 395} 396 397// ClusterProperties the properties of a cluster 398type ClusterProperties struct { 399 // ProvisioningState - READ-ONLY; The state of the cluster provisioning. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Deleting', 'Updating' 400 ProvisioningState ClusterProvisioningState `json:"provisioningState,omitempty"` 401 // ClusterSize - The cluster size 402 ClusterSize *int32 `json:"clusterSize,omitempty"` 403 // ClusterID - READ-ONLY; The identity 404 ClusterID *int32 `json:"clusterId,omitempty"` 405 // Hosts - READ-ONLY; The hosts 406 Hosts *[]string `json:"hosts,omitempty"` 407} 408 409// MarshalJSON is the custom marshaler for ClusterProperties. 410func (cp ClusterProperties) MarshalJSON() ([]byte, error) { 411 objectMap := make(map[string]interface{}) 412 if cp.ClusterSize != nil { 413 objectMap["clusterSize"] = cp.ClusterSize 414 } 415 return json.Marshal(objectMap) 416} 417 418// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 419// operation. 420type ClustersCreateOrUpdateFuture struct { 421 azure.FutureAPI 422 // Result returns the result of the asynchronous operation. 423 // If the operation has not completed it will return an error. 424 Result func(ClustersClient) (Cluster, error) 425} 426 427// UnmarshalJSON is the custom unmarshaller for CreateFuture. 428func (future *ClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 429 var azFuture azure.Future 430 if err := json.Unmarshal(body, &azFuture); err != nil { 431 return err 432 } 433 future.FutureAPI = &azFuture 434 future.Result = future.result 435 return nil 436} 437 438// result is the default implementation for ClustersCreateOrUpdateFuture.Result. 439func (future *ClustersCreateOrUpdateFuture) result(client ClustersClient) (c Cluster, err error) { 440 var done bool 441 done, err = future.DoneWithContext(context.Background(), client) 442 if err != nil { 443 err = autorest.NewErrorWithError(err, "avs.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 444 return 445 } 446 if !done { 447 c.Response.Response = future.Response() 448 err = azure.NewAsyncOpIncompleteError("avs.ClustersCreateOrUpdateFuture") 449 return 450 } 451 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 452 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { 453 c, err = client.CreateOrUpdateResponder(c.Response.Response) 454 if err != nil { 455 err = autorest.NewErrorWithError(err, "avs.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") 456 } 457 } 458 return 459} 460 461// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 462// operation. 463type ClustersDeleteFuture struct { 464 azure.FutureAPI 465 // Result returns the result of the asynchronous operation. 466 // If the operation has not completed it will return an error. 467 Result func(ClustersClient) (autorest.Response, error) 468} 469 470// UnmarshalJSON is the custom unmarshaller for CreateFuture. 471func (future *ClustersDeleteFuture) UnmarshalJSON(body []byte) error { 472 var azFuture azure.Future 473 if err := json.Unmarshal(body, &azFuture); err != nil { 474 return err 475 } 476 future.FutureAPI = &azFuture 477 future.Result = future.result 478 return nil 479} 480 481// result is the default implementation for ClustersDeleteFuture.Result. 482func (future *ClustersDeleteFuture) result(client ClustersClient) (ar autorest.Response, err error) { 483 var done bool 484 done, err = future.DoneWithContext(context.Background(), client) 485 if err != nil { 486 err = autorest.NewErrorWithError(err, "avs.ClustersDeleteFuture", "Result", future.Response(), "Polling failure") 487 return 488 } 489 if !done { 490 ar.Response = future.Response() 491 err = azure.NewAsyncOpIncompleteError("avs.ClustersDeleteFuture") 492 return 493 } 494 ar.Response = future.Response() 495 return 496} 497 498// ClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 499// operation. 500type ClustersUpdateFuture struct { 501 azure.FutureAPI 502 // Result returns the result of the asynchronous operation. 503 // If the operation has not completed it will return an error. 504 Result func(ClustersClient) (Cluster, error) 505} 506 507// UnmarshalJSON is the custom unmarshaller for CreateFuture. 508func (future *ClustersUpdateFuture) UnmarshalJSON(body []byte) error { 509 var azFuture azure.Future 510 if err := json.Unmarshal(body, &azFuture); err != nil { 511 return err 512 } 513 future.FutureAPI = &azFuture 514 future.Result = future.result 515 return nil 516} 517 518// result is the default implementation for ClustersUpdateFuture.Result. 519func (future *ClustersUpdateFuture) result(client ClustersClient) (c Cluster, err error) { 520 var done bool 521 done, err = future.DoneWithContext(context.Background(), client) 522 if err != nil { 523 err = autorest.NewErrorWithError(err, "avs.ClustersUpdateFuture", "Result", future.Response(), "Polling failure") 524 return 525 } 526 if !done { 527 c.Response.Response = future.Response() 528 err = azure.NewAsyncOpIncompleteError("avs.ClustersUpdateFuture") 529 return 530 } 531 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 532 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { 533 c, err = client.UpdateResponder(c.Response.Response) 534 if err != nil { 535 err = autorest.NewErrorWithError(err, "avs.ClustersUpdateFuture", "Result", c.Response.Response, "Failure responding to request") 536 } 537 } 538 return 539} 540 541// ClusterUpdate an update of a cluster resource 542type ClusterUpdate struct { 543 // ClusterUpdateProperties - The properties of a cluster resource that may be updated 544 *ClusterUpdateProperties `json:"properties,omitempty"` 545} 546 547// MarshalJSON is the custom marshaler for ClusterUpdate. 548func (cu ClusterUpdate) MarshalJSON() ([]byte, error) { 549 objectMap := make(map[string]interface{}) 550 if cu.ClusterUpdateProperties != nil { 551 objectMap["properties"] = cu.ClusterUpdateProperties 552 } 553 return json.Marshal(objectMap) 554} 555 556// UnmarshalJSON is the custom unmarshaler for ClusterUpdate struct. 557func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error { 558 var m map[string]*json.RawMessage 559 err := json.Unmarshal(body, &m) 560 if err != nil { 561 return err 562 } 563 for k, v := range m { 564 switch k { 565 case "properties": 566 if v != nil { 567 var clusterUpdateProperties ClusterUpdateProperties 568 err = json.Unmarshal(*v, &clusterUpdateProperties) 569 if err != nil { 570 return err 571 } 572 cu.ClusterUpdateProperties = &clusterUpdateProperties 573 } 574 } 575 } 576 577 return nil 578} 579 580// ClusterUpdateProperties the properties of a cluster that may be updated 581type ClusterUpdateProperties struct { 582 // ClusterSize - The cluster size 583 ClusterSize *int32 `json:"clusterSize,omitempty"` 584} 585 586// CommonClusterProperties the common properties of a cluster 587type CommonClusterProperties struct { 588 // ProvisioningState - READ-ONLY; The state of the cluster provisioning. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Deleting', 'Updating' 589 ProvisioningState ClusterProvisioningState `json:"provisioningState,omitempty"` 590 // ClusterSize - The cluster size 591 ClusterSize *int32 `json:"clusterSize,omitempty"` 592 // ClusterID - READ-ONLY; The identity 593 ClusterID *int32 `json:"clusterId,omitempty"` 594 // Hosts - READ-ONLY; The hosts 595 Hosts *[]string `json:"hosts,omitempty"` 596} 597 598// MarshalJSON is the custom marshaler for CommonClusterProperties. 599func (ccp CommonClusterProperties) MarshalJSON() ([]byte, error) { 600 objectMap := make(map[string]interface{}) 601 if ccp.ClusterSize != nil { 602 objectMap["clusterSize"] = ccp.ClusterSize 603 } 604 return json.Marshal(objectMap) 605} 606 607// Endpoints endpoint addresses 608type Endpoints struct { 609 // NsxtManager - READ-ONLY; Endpoint for the NSX-T Data Center manager 610 NsxtManager *string `json:"nsxtManager,omitempty"` 611 // Vcsa - READ-ONLY; Endpoint for Virtual Center Server Appliance 612 Vcsa *string `json:"vcsa,omitempty"` 613 // HcxCloudManager - READ-ONLY; Endpoint for the HCX Cloud Manager 614 HcxCloudManager *string `json:"hcxCloudManager,omitempty"` 615} 616 617// MarshalJSON is the custom marshaler for Endpoints. 618func (e Endpoints) MarshalJSON() ([]byte, error) { 619 objectMap := make(map[string]interface{}) 620 return json.Marshal(objectMap) 621} 622 623// ErrorAdditionalInfo the resource management error additional info. 624type ErrorAdditionalInfo struct { 625 // Type - READ-ONLY; The additional info type. 626 Type *string `json:"type,omitempty"` 627 // Info - READ-ONLY; The additional info. 628 Info interface{} `json:"info,omitempty"` 629} 630 631// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. 632func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { 633 objectMap := make(map[string]interface{}) 634 return json.Marshal(objectMap) 635} 636 637// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for 638// failed operations. (This also follows the OData error response format.) 639type ErrorResponse struct { 640 // Code - READ-ONLY; The error code. 641 Code *string `json:"code,omitempty"` 642 // Message - READ-ONLY; The error message. 643 Message *string `json:"message,omitempty"` 644 // Target - READ-ONLY; The error target. 645 Target *string `json:"target,omitempty"` 646 // Details - READ-ONLY; The error details. 647 Details *[]ErrorResponse `json:"details,omitempty"` 648 // AdditionalInfo - READ-ONLY; The error additional info. 649 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 650} 651 652// MarshalJSON is the custom marshaler for ErrorResponse. 653func (er ErrorResponse) MarshalJSON() ([]byte, error) { 654 objectMap := make(map[string]interface{}) 655 return json.Marshal(objectMap) 656} 657 658// ExpressRouteAuthorization expressRoute Circuit Authorization 659type ExpressRouteAuthorization struct { 660 autorest.Response `json:"-"` 661 // ExpressRouteAuthorizationProperties - READ-ONLY; The properties of an ExpressRoute Circuit Authorization resource 662 *ExpressRouteAuthorizationProperties `json:"properties,omitempty"` 663 // ID - READ-ONLY; Resource ID. 664 ID *string `json:"id,omitempty"` 665 // Name - READ-ONLY; Resource name. 666 Name *string `json:"name,omitempty"` 667 // Type - READ-ONLY; Resource type. 668 Type *string `json:"type,omitempty"` 669} 670 671// MarshalJSON is the custom marshaler for ExpressRouteAuthorization. 672func (era ExpressRouteAuthorization) MarshalJSON() ([]byte, error) { 673 objectMap := make(map[string]interface{}) 674 return json.Marshal(objectMap) 675} 676 677// UnmarshalJSON is the custom unmarshaler for ExpressRouteAuthorization struct. 678func (era *ExpressRouteAuthorization) UnmarshalJSON(body []byte) error { 679 var m map[string]*json.RawMessage 680 err := json.Unmarshal(body, &m) 681 if err != nil { 682 return err 683 } 684 for k, v := range m { 685 switch k { 686 case "properties": 687 if v != nil { 688 var expressRouteAuthorizationProperties ExpressRouteAuthorizationProperties 689 err = json.Unmarshal(*v, &expressRouteAuthorizationProperties) 690 if err != nil { 691 return err 692 } 693 era.ExpressRouteAuthorizationProperties = &expressRouteAuthorizationProperties 694 } 695 case "id": 696 if v != nil { 697 var ID string 698 err = json.Unmarshal(*v, &ID) 699 if err != nil { 700 return err 701 } 702 era.ID = &ID 703 } 704 case "name": 705 if v != nil { 706 var name string 707 err = json.Unmarshal(*v, &name) 708 if err != nil { 709 return err 710 } 711 era.Name = &name 712 } 713 case "type": 714 if v != nil { 715 var typeVar string 716 err = json.Unmarshal(*v, &typeVar) 717 if err != nil { 718 return err 719 } 720 era.Type = &typeVar 721 } 722 } 723 } 724 725 return nil 726} 727 728// ExpressRouteAuthorizationList a paged list of ExpressRoute Circuit Authorizations 729type ExpressRouteAuthorizationList struct { 730 autorest.Response `json:"-"` 731 // Value - READ-ONLY; The items on a page 732 Value *[]ExpressRouteAuthorization `json:"value,omitempty"` 733 // NextLink - READ-ONLY; URL to get the next page if any 734 NextLink *string `json:"nextLink,omitempty"` 735} 736 737// MarshalJSON is the custom marshaler for ExpressRouteAuthorizationList. 738func (eral ExpressRouteAuthorizationList) MarshalJSON() ([]byte, error) { 739 objectMap := make(map[string]interface{}) 740 return json.Marshal(objectMap) 741} 742 743// ExpressRouteAuthorizationListIterator provides access to a complete listing of ExpressRouteAuthorization 744// values. 745type ExpressRouteAuthorizationListIterator struct { 746 i int 747 page ExpressRouteAuthorizationListPage 748} 749 750// NextWithContext advances to the next value. If there was an error making 751// the request the iterator does not advance and the error is returned. 752func (iter *ExpressRouteAuthorizationListIterator) NextWithContext(ctx context.Context) (err error) { 753 if tracing.IsEnabled() { 754 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteAuthorizationListIterator.NextWithContext") 755 defer func() { 756 sc := -1 757 if iter.Response().Response.Response != nil { 758 sc = iter.Response().Response.Response.StatusCode 759 } 760 tracing.EndSpan(ctx, sc, err) 761 }() 762 } 763 iter.i++ 764 if iter.i < len(iter.page.Values()) { 765 return nil 766 } 767 err = iter.page.NextWithContext(ctx) 768 if err != nil { 769 iter.i-- 770 return err 771 } 772 iter.i = 0 773 return nil 774} 775 776// Next advances to the next value. If there was an error making 777// the request the iterator does not advance and the error is returned. 778// Deprecated: Use NextWithContext() instead. 779func (iter *ExpressRouteAuthorizationListIterator) Next() error { 780 return iter.NextWithContext(context.Background()) 781} 782 783// NotDone returns true if the enumeration should be started or is not yet complete. 784func (iter ExpressRouteAuthorizationListIterator) NotDone() bool { 785 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 786} 787 788// Response returns the raw server response from the last page request. 789func (iter ExpressRouteAuthorizationListIterator) Response() ExpressRouteAuthorizationList { 790 return iter.page.Response() 791} 792 793// Value returns the current value or a zero-initialized value if the 794// iterator has advanced beyond the end of the collection. 795func (iter ExpressRouteAuthorizationListIterator) Value() ExpressRouteAuthorization { 796 if !iter.page.NotDone() { 797 return ExpressRouteAuthorization{} 798 } 799 return iter.page.Values()[iter.i] 800} 801 802// Creates a new instance of the ExpressRouteAuthorizationListIterator type. 803func NewExpressRouteAuthorizationListIterator(page ExpressRouteAuthorizationListPage) ExpressRouteAuthorizationListIterator { 804 return ExpressRouteAuthorizationListIterator{page: page} 805} 806 807// IsEmpty returns true if the ListResult contains no values. 808func (eral ExpressRouteAuthorizationList) IsEmpty() bool { 809 return eral.Value == nil || len(*eral.Value) == 0 810} 811 812// hasNextLink returns true if the NextLink is not empty. 813func (eral ExpressRouteAuthorizationList) hasNextLink() bool { 814 return eral.NextLink != nil && len(*eral.NextLink) != 0 815} 816 817// expressRouteAuthorizationListPreparer prepares a request to retrieve the next set of results. 818// It returns nil if no more results exist. 819func (eral ExpressRouteAuthorizationList) expressRouteAuthorizationListPreparer(ctx context.Context) (*http.Request, error) { 820 if !eral.hasNextLink() { 821 return nil, nil 822 } 823 return autorest.Prepare((&http.Request{}).WithContext(ctx), 824 autorest.AsJSON(), 825 autorest.AsGet(), 826 autorest.WithBaseURL(to.String(eral.NextLink))) 827} 828 829// ExpressRouteAuthorizationListPage contains a page of ExpressRouteAuthorization values. 830type ExpressRouteAuthorizationListPage struct { 831 fn func(context.Context, ExpressRouteAuthorizationList) (ExpressRouteAuthorizationList, error) 832 eral ExpressRouteAuthorizationList 833} 834 835// NextWithContext advances to the next page of values. If there was an error making 836// the request the page does not advance and the error is returned. 837func (page *ExpressRouteAuthorizationListPage) NextWithContext(ctx context.Context) (err error) { 838 if tracing.IsEnabled() { 839 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteAuthorizationListPage.NextWithContext") 840 defer func() { 841 sc := -1 842 if page.Response().Response.Response != nil { 843 sc = page.Response().Response.Response.StatusCode 844 } 845 tracing.EndSpan(ctx, sc, err) 846 }() 847 } 848 for { 849 next, err := page.fn(ctx, page.eral) 850 if err != nil { 851 return err 852 } 853 page.eral = next 854 if !next.hasNextLink() || !next.IsEmpty() { 855 break 856 } 857 } 858 return nil 859} 860 861// Next advances to the next page of values. If there was an error making 862// the request the page does not advance and the error is returned. 863// Deprecated: Use NextWithContext() instead. 864func (page *ExpressRouteAuthorizationListPage) Next() error { 865 return page.NextWithContext(context.Background()) 866} 867 868// NotDone returns true if the page enumeration should be started or is not yet complete. 869func (page ExpressRouteAuthorizationListPage) NotDone() bool { 870 return !page.eral.IsEmpty() 871} 872 873// Response returns the raw server response from the last page request. 874func (page ExpressRouteAuthorizationListPage) Response() ExpressRouteAuthorizationList { 875 return page.eral 876} 877 878// Values returns the slice of values for the current page or nil if there are no values. 879func (page ExpressRouteAuthorizationListPage) Values() []ExpressRouteAuthorization { 880 if page.eral.IsEmpty() { 881 return nil 882 } 883 return *page.eral.Value 884} 885 886// Creates a new instance of the ExpressRouteAuthorizationListPage type. 887func NewExpressRouteAuthorizationListPage(cur ExpressRouteAuthorizationList, getNextPage func(context.Context, ExpressRouteAuthorizationList) (ExpressRouteAuthorizationList, error)) ExpressRouteAuthorizationListPage { 888 return ExpressRouteAuthorizationListPage{ 889 fn: getNextPage, 890 eral: cur, 891 } 892} 893 894// ExpressRouteAuthorizationProperties the properties of an ExpressRoute Circuit Authorization resource 895type ExpressRouteAuthorizationProperties struct { 896 // ProvisioningState - READ-ONLY; The state of the ExpressRoute Circuit Authorization provisioning. Possible values include: 'ExpressRouteAuthorizationProvisioningStateSucceeded', 'ExpressRouteAuthorizationProvisioningStateFailed', 'ExpressRouteAuthorizationProvisioningStateUpdating' 897 ProvisioningState ExpressRouteAuthorizationProvisioningState `json:"provisioningState,omitempty"` 898 // ExpressRouteAuthorizationID - READ-ONLY; The ID of the ExpressRoute Circuit Authorization 899 ExpressRouteAuthorizationID *string `json:"expressRouteAuthorizationId,omitempty"` 900 // ExpressRouteAuthorizationKey - READ-ONLY; The key of the ExpressRoute Circuit Authorization 901 ExpressRouteAuthorizationKey *string `json:"expressRouteAuthorizationKey,omitempty"` 902} 903 904// MarshalJSON is the custom marshaler for ExpressRouteAuthorizationProperties. 905func (erap ExpressRouteAuthorizationProperties) MarshalJSON() ([]byte, error) { 906 objectMap := make(map[string]interface{}) 907 return json.Marshal(objectMap) 908} 909 910// GlobalReachConnection a global reach connection resource 911type GlobalReachConnection struct { 912 autorest.Response `json:"-"` 913 // GlobalReachConnectionProperties - The properties of a global reach connection resource 914 *GlobalReachConnectionProperties `json:"properties,omitempty"` 915 // ID - READ-ONLY; Resource ID. 916 ID *string `json:"id,omitempty"` 917 // Name - READ-ONLY; Resource name. 918 Name *string `json:"name,omitempty"` 919 // Type - READ-ONLY; Resource type. 920 Type *string `json:"type,omitempty"` 921} 922 923// MarshalJSON is the custom marshaler for GlobalReachConnection. 924func (grc GlobalReachConnection) MarshalJSON() ([]byte, error) { 925 objectMap := make(map[string]interface{}) 926 if grc.GlobalReachConnectionProperties != nil { 927 objectMap["properties"] = grc.GlobalReachConnectionProperties 928 } 929 return json.Marshal(objectMap) 930} 931 932// UnmarshalJSON is the custom unmarshaler for GlobalReachConnection struct. 933func (grc *GlobalReachConnection) UnmarshalJSON(body []byte) error { 934 var m map[string]*json.RawMessage 935 err := json.Unmarshal(body, &m) 936 if err != nil { 937 return err 938 } 939 for k, v := range m { 940 switch k { 941 case "properties": 942 if v != nil { 943 var globalReachConnectionProperties GlobalReachConnectionProperties 944 err = json.Unmarshal(*v, &globalReachConnectionProperties) 945 if err != nil { 946 return err 947 } 948 grc.GlobalReachConnectionProperties = &globalReachConnectionProperties 949 } 950 case "id": 951 if v != nil { 952 var ID string 953 err = json.Unmarshal(*v, &ID) 954 if err != nil { 955 return err 956 } 957 grc.ID = &ID 958 } 959 case "name": 960 if v != nil { 961 var name string 962 err = json.Unmarshal(*v, &name) 963 if err != nil { 964 return err 965 } 966 grc.Name = &name 967 } 968 case "type": 969 if v != nil { 970 var typeVar string 971 err = json.Unmarshal(*v, &typeVar) 972 if err != nil { 973 return err 974 } 975 grc.Type = &typeVar 976 } 977 } 978 } 979 980 return nil 981} 982 983// GlobalReachConnectionList a paged list of global reach connections 984type GlobalReachConnectionList struct { 985 autorest.Response `json:"-"` 986 // Value - READ-ONLY; The items on a page 987 Value *[]GlobalReachConnection `json:"value,omitempty"` 988 // NextLink - READ-ONLY; URL to get the next page if any 989 NextLink *string `json:"nextLink,omitempty"` 990} 991 992// MarshalJSON is the custom marshaler for GlobalReachConnectionList. 993func (grcl GlobalReachConnectionList) MarshalJSON() ([]byte, error) { 994 objectMap := make(map[string]interface{}) 995 return json.Marshal(objectMap) 996} 997 998// GlobalReachConnectionListIterator provides access to a complete listing of GlobalReachConnection values. 999type GlobalReachConnectionListIterator struct { 1000 i int 1001 page GlobalReachConnectionListPage 1002} 1003 1004// NextWithContext advances to the next value. If there was an error making 1005// the request the iterator does not advance and the error is returned. 1006func (iter *GlobalReachConnectionListIterator) NextWithContext(ctx context.Context) (err error) { 1007 if tracing.IsEnabled() { 1008 ctx = tracing.StartSpan(ctx, fqdn+"/GlobalReachConnectionListIterator.NextWithContext") 1009 defer func() { 1010 sc := -1 1011 if iter.Response().Response.Response != nil { 1012 sc = iter.Response().Response.Response.StatusCode 1013 } 1014 tracing.EndSpan(ctx, sc, err) 1015 }() 1016 } 1017 iter.i++ 1018 if iter.i < len(iter.page.Values()) { 1019 return nil 1020 } 1021 err = iter.page.NextWithContext(ctx) 1022 if err != nil { 1023 iter.i-- 1024 return err 1025 } 1026 iter.i = 0 1027 return nil 1028} 1029 1030// Next advances to the next value. If there was an error making 1031// the request the iterator does not advance and the error is returned. 1032// Deprecated: Use NextWithContext() instead. 1033func (iter *GlobalReachConnectionListIterator) Next() error { 1034 return iter.NextWithContext(context.Background()) 1035} 1036 1037// NotDone returns true if the enumeration should be started or is not yet complete. 1038func (iter GlobalReachConnectionListIterator) NotDone() bool { 1039 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1040} 1041 1042// Response returns the raw server response from the last page request. 1043func (iter GlobalReachConnectionListIterator) Response() GlobalReachConnectionList { 1044 return iter.page.Response() 1045} 1046 1047// Value returns the current value or a zero-initialized value if the 1048// iterator has advanced beyond the end of the collection. 1049func (iter GlobalReachConnectionListIterator) Value() GlobalReachConnection { 1050 if !iter.page.NotDone() { 1051 return GlobalReachConnection{} 1052 } 1053 return iter.page.Values()[iter.i] 1054} 1055 1056// Creates a new instance of the GlobalReachConnectionListIterator type. 1057func NewGlobalReachConnectionListIterator(page GlobalReachConnectionListPage) GlobalReachConnectionListIterator { 1058 return GlobalReachConnectionListIterator{page: page} 1059} 1060 1061// IsEmpty returns true if the ListResult contains no values. 1062func (grcl GlobalReachConnectionList) IsEmpty() bool { 1063 return grcl.Value == nil || len(*grcl.Value) == 0 1064} 1065 1066// hasNextLink returns true if the NextLink is not empty. 1067func (grcl GlobalReachConnectionList) hasNextLink() bool { 1068 return grcl.NextLink != nil && len(*grcl.NextLink) != 0 1069} 1070 1071// globalReachConnectionListPreparer prepares a request to retrieve the next set of results. 1072// It returns nil if no more results exist. 1073func (grcl GlobalReachConnectionList) globalReachConnectionListPreparer(ctx context.Context) (*http.Request, error) { 1074 if !grcl.hasNextLink() { 1075 return nil, nil 1076 } 1077 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1078 autorest.AsJSON(), 1079 autorest.AsGet(), 1080 autorest.WithBaseURL(to.String(grcl.NextLink))) 1081} 1082 1083// GlobalReachConnectionListPage contains a page of GlobalReachConnection values. 1084type GlobalReachConnectionListPage struct { 1085 fn func(context.Context, GlobalReachConnectionList) (GlobalReachConnectionList, error) 1086 grcl GlobalReachConnectionList 1087} 1088 1089// NextWithContext advances to the next page of values. If there was an error making 1090// the request the page does not advance and the error is returned. 1091func (page *GlobalReachConnectionListPage) NextWithContext(ctx context.Context) (err error) { 1092 if tracing.IsEnabled() { 1093 ctx = tracing.StartSpan(ctx, fqdn+"/GlobalReachConnectionListPage.NextWithContext") 1094 defer func() { 1095 sc := -1 1096 if page.Response().Response.Response != nil { 1097 sc = page.Response().Response.Response.StatusCode 1098 } 1099 tracing.EndSpan(ctx, sc, err) 1100 }() 1101 } 1102 for { 1103 next, err := page.fn(ctx, page.grcl) 1104 if err != nil { 1105 return err 1106 } 1107 page.grcl = next 1108 if !next.hasNextLink() || !next.IsEmpty() { 1109 break 1110 } 1111 } 1112 return nil 1113} 1114 1115// Next advances to the next page of values. If there was an error making 1116// the request the page does not advance and the error is returned. 1117// Deprecated: Use NextWithContext() instead. 1118func (page *GlobalReachConnectionListPage) Next() error { 1119 return page.NextWithContext(context.Background()) 1120} 1121 1122// NotDone returns true if the page enumeration should be started or is not yet complete. 1123func (page GlobalReachConnectionListPage) NotDone() bool { 1124 return !page.grcl.IsEmpty() 1125} 1126 1127// Response returns the raw server response from the last page request. 1128func (page GlobalReachConnectionListPage) Response() GlobalReachConnectionList { 1129 return page.grcl 1130} 1131 1132// Values returns the slice of values for the current page or nil if there are no values. 1133func (page GlobalReachConnectionListPage) Values() []GlobalReachConnection { 1134 if page.grcl.IsEmpty() { 1135 return nil 1136 } 1137 return *page.grcl.Value 1138} 1139 1140// Creates a new instance of the GlobalReachConnectionListPage type. 1141func NewGlobalReachConnectionListPage(cur GlobalReachConnectionList, getNextPage func(context.Context, GlobalReachConnectionList) (GlobalReachConnectionList, error)) GlobalReachConnectionListPage { 1142 return GlobalReachConnectionListPage{ 1143 fn: getNextPage, 1144 grcl: cur, 1145 } 1146} 1147 1148// GlobalReachConnectionProperties the properties of a global reach connection 1149type GlobalReachConnectionProperties struct { 1150 // ProvisioningState - READ-ONLY; The state of the ExpressRoute Circuit Authorization provisioning. Possible values include: 'GlobalReachConnectionProvisioningStateSucceeded', 'GlobalReachConnectionProvisioningStateFailed', 'GlobalReachConnectionProvisioningStateUpdating' 1151 ProvisioningState GlobalReachConnectionProvisioningState `json:"provisioningState,omitempty"` 1152 // AddressPrefix - READ-ONLY; The network used for global reach carved out from the original network block provided for the private cloud 1153 AddressPrefix *string `json:"addressPrefix,omitempty"` 1154 // AuthorizationKey - Authorization key from the peer express route used for the global reach connection 1155 AuthorizationKey *string `json:"authorizationKey,omitempty"` 1156 // CircuitConnectionStatus - READ-ONLY; The connection status of the global reach connection. Possible values include: 'Connected', 'Connecting', 'Disconnected' 1157 CircuitConnectionStatus GlobalReachConnectionStatus `json:"circuitConnectionStatus,omitempty"` 1158 // PeerExpressRouteCircuit - Identifier of the ExpressRoute Circuit to peer with in the global reach connection 1159 PeerExpressRouteCircuit *string `json:"peerExpressRouteCircuit,omitempty"` 1160} 1161 1162// MarshalJSON is the custom marshaler for GlobalReachConnectionProperties. 1163func (grcp GlobalReachConnectionProperties) MarshalJSON() ([]byte, error) { 1164 objectMap := make(map[string]interface{}) 1165 if grcp.AuthorizationKey != nil { 1166 objectMap["authorizationKey"] = grcp.AuthorizationKey 1167 } 1168 if grcp.PeerExpressRouteCircuit != nil { 1169 objectMap["peerExpressRouteCircuit"] = grcp.PeerExpressRouteCircuit 1170 } 1171 return json.Marshal(objectMap) 1172} 1173 1174// GlobalReachConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1175// long-running operation. 1176type GlobalReachConnectionsCreateOrUpdateFuture struct { 1177 azure.FutureAPI 1178 // Result returns the result of the asynchronous operation. 1179 // If the operation has not completed it will return an error. 1180 Result func(GlobalReachConnectionsClient) (GlobalReachConnection, error) 1181} 1182 1183// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1184func (future *GlobalReachConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1185 var azFuture azure.Future 1186 if err := json.Unmarshal(body, &azFuture); err != nil { 1187 return err 1188 } 1189 future.FutureAPI = &azFuture 1190 future.Result = future.result 1191 return nil 1192} 1193 1194// result is the default implementation for GlobalReachConnectionsCreateOrUpdateFuture.Result. 1195func (future *GlobalReachConnectionsCreateOrUpdateFuture) result(client GlobalReachConnectionsClient) (grc GlobalReachConnection, err error) { 1196 var done bool 1197 done, err = future.DoneWithContext(context.Background(), client) 1198 if err != nil { 1199 err = autorest.NewErrorWithError(err, "avs.GlobalReachConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1200 return 1201 } 1202 if !done { 1203 grc.Response.Response = future.Response() 1204 err = azure.NewAsyncOpIncompleteError("avs.GlobalReachConnectionsCreateOrUpdateFuture") 1205 return 1206 } 1207 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1208 if grc.Response.Response, err = future.GetResult(sender); err == nil && grc.Response.Response.StatusCode != http.StatusNoContent { 1209 grc, err = client.CreateOrUpdateResponder(grc.Response.Response) 1210 if err != nil { 1211 err = autorest.NewErrorWithError(err, "avs.GlobalReachConnectionsCreateOrUpdateFuture", "Result", grc.Response.Response, "Failure responding to request") 1212 } 1213 } 1214 return 1215} 1216 1217// GlobalReachConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a 1218// long-running operation. 1219type GlobalReachConnectionsDeleteFuture struct { 1220 azure.FutureAPI 1221 // Result returns the result of the asynchronous operation. 1222 // If the operation has not completed it will return an error. 1223 Result func(GlobalReachConnectionsClient) (autorest.Response, error) 1224} 1225 1226// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1227func (future *GlobalReachConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { 1228 var azFuture azure.Future 1229 if err := json.Unmarshal(body, &azFuture); err != nil { 1230 return err 1231 } 1232 future.FutureAPI = &azFuture 1233 future.Result = future.result 1234 return nil 1235} 1236 1237// result is the default implementation for GlobalReachConnectionsDeleteFuture.Result. 1238func (future *GlobalReachConnectionsDeleteFuture) result(client GlobalReachConnectionsClient) (ar autorest.Response, err error) { 1239 var done bool 1240 done, err = future.DoneWithContext(context.Background(), client) 1241 if err != nil { 1242 err = autorest.NewErrorWithError(err, "avs.GlobalReachConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") 1243 return 1244 } 1245 if !done { 1246 ar.Response = future.Response() 1247 err = azure.NewAsyncOpIncompleteError("avs.GlobalReachConnectionsDeleteFuture") 1248 return 1249 } 1250 ar.Response = future.Response() 1251 return 1252} 1253 1254// HcxEnterpriseSite an HCX Enterprise Site resource 1255type HcxEnterpriseSite struct { 1256 autorest.Response `json:"-"` 1257 // HcxEnterpriseSiteProperties - READ-ONLY; The properties of an HCX Enterprise Site resource 1258 *HcxEnterpriseSiteProperties `json:"properties,omitempty"` 1259 // ID - READ-ONLY; Resource ID. 1260 ID *string `json:"id,omitempty"` 1261 // Name - READ-ONLY; Resource name. 1262 Name *string `json:"name,omitempty"` 1263 // Type - READ-ONLY; Resource type. 1264 Type *string `json:"type,omitempty"` 1265} 1266 1267// MarshalJSON is the custom marshaler for HcxEnterpriseSite. 1268func (hes HcxEnterpriseSite) MarshalJSON() ([]byte, error) { 1269 objectMap := make(map[string]interface{}) 1270 return json.Marshal(objectMap) 1271} 1272 1273// UnmarshalJSON is the custom unmarshaler for HcxEnterpriseSite struct. 1274func (hes *HcxEnterpriseSite) UnmarshalJSON(body []byte) error { 1275 var m map[string]*json.RawMessage 1276 err := json.Unmarshal(body, &m) 1277 if err != nil { 1278 return err 1279 } 1280 for k, v := range m { 1281 switch k { 1282 case "properties": 1283 if v != nil { 1284 var hcxEnterpriseSiteProperties HcxEnterpriseSiteProperties 1285 err = json.Unmarshal(*v, &hcxEnterpriseSiteProperties) 1286 if err != nil { 1287 return err 1288 } 1289 hes.HcxEnterpriseSiteProperties = &hcxEnterpriseSiteProperties 1290 } 1291 case "id": 1292 if v != nil { 1293 var ID string 1294 err = json.Unmarshal(*v, &ID) 1295 if err != nil { 1296 return err 1297 } 1298 hes.ID = &ID 1299 } 1300 case "name": 1301 if v != nil { 1302 var name string 1303 err = json.Unmarshal(*v, &name) 1304 if err != nil { 1305 return err 1306 } 1307 hes.Name = &name 1308 } 1309 case "type": 1310 if v != nil { 1311 var typeVar string 1312 err = json.Unmarshal(*v, &typeVar) 1313 if err != nil { 1314 return err 1315 } 1316 hes.Type = &typeVar 1317 } 1318 } 1319 } 1320 1321 return nil 1322} 1323 1324// HcxEnterpriseSiteList a paged list of HCX Enterprise Sites 1325type HcxEnterpriseSiteList struct { 1326 autorest.Response `json:"-"` 1327 // Value - READ-ONLY; The items on a page 1328 Value *[]HcxEnterpriseSite `json:"value,omitempty"` 1329 // NextLink - READ-ONLY; URL to get the next page if any 1330 NextLink *string `json:"nextLink,omitempty"` 1331} 1332 1333// MarshalJSON is the custom marshaler for HcxEnterpriseSiteList. 1334func (hesl HcxEnterpriseSiteList) MarshalJSON() ([]byte, error) { 1335 objectMap := make(map[string]interface{}) 1336 return json.Marshal(objectMap) 1337} 1338 1339// HcxEnterpriseSiteListIterator provides access to a complete listing of HcxEnterpriseSite values. 1340type HcxEnterpriseSiteListIterator struct { 1341 i int 1342 page HcxEnterpriseSiteListPage 1343} 1344 1345// NextWithContext advances to the next value. If there was an error making 1346// the request the iterator does not advance and the error is returned. 1347func (iter *HcxEnterpriseSiteListIterator) NextWithContext(ctx context.Context) (err error) { 1348 if tracing.IsEnabled() { 1349 ctx = tracing.StartSpan(ctx, fqdn+"/HcxEnterpriseSiteListIterator.NextWithContext") 1350 defer func() { 1351 sc := -1 1352 if iter.Response().Response.Response != nil { 1353 sc = iter.Response().Response.Response.StatusCode 1354 } 1355 tracing.EndSpan(ctx, sc, err) 1356 }() 1357 } 1358 iter.i++ 1359 if iter.i < len(iter.page.Values()) { 1360 return nil 1361 } 1362 err = iter.page.NextWithContext(ctx) 1363 if err != nil { 1364 iter.i-- 1365 return err 1366 } 1367 iter.i = 0 1368 return nil 1369} 1370 1371// Next advances to the next value. If there was an error making 1372// the request the iterator does not advance and the error is returned. 1373// Deprecated: Use NextWithContext() instead. 1374func (iter *HcxEnterpriseSiteListIterator) Next() error { 1375 return iter.NextWithContext(context.Background()) 1376} 1377 1378// NotDone returns true if the enumeration should be started or is not yet complete. 1379func (iter HcxEnterpriseSiteListIterator) NotDone() bool { 1380 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1381} 1382 1383// Response returns the raw server response from the last page request. 1384func (iter HcxEnterpriseSiteListIterator) Response() HcxEnterpriseSiteList { 1385 return iter.page.Response() 1386} 1387 1388// Value returns the current value or a zero-initialized value if the 1389// iterator has advanced beyond the end of the collection. 1390func (iter HcxEnterpriseSiteListIterator) Value() HcxEnterpriseSite { 1391 if !iter.page.NotDone() { 1392 return HcxEnterpriseSite{} 1393 } 1394 return iter.page.Values()[iter.i] 1395} 1396 1397// Creates a new instance of the HcxEnterpriseSiteListIterator type. 1398func NewHcxEnterpriseSiteListIterator(page HcxEnterpriseSiteListPage) HcxEnterpriseSiteListIterator { 1399 return HcxEnterpriseSiteListIterator{page: page} 1400} 1401 1402// IsEmpty returns true if the ListResult contains no values. 1403func (hesl HcxEnterpriseSiteList) IsEmpty() bool { 1404 return hesl.Value == nil || len(*hesl.Value) == 0 1405} 1406 1407// hasNextLink returns true if the NextLink is not empty. 1408func (hesl HcxEnterpriseSiteList) hasNextLink() bool { 1409 return hesl.NextLink != nil && len(*hesl.NextLink) != 0 1410} 1411 1412// hcxEnterpriseSiteListPreparer prepares a request to retrieve the next set of results. 1413// It returns nil if no more results exist. 1414func (hesl HcxEnterpriseSiteList) hcxEnterpriseSiteListPreparer(ctx context.Context) (*http.Request, error) { 1415 if !hesl.hasNextLink() { 1416 return nil, nil 1417 } 1418 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1419 autorest.AsJSON(), 1420 autorest.AsGet(), 1421 autorest.WithBaseURL(to.String(hesl.NextLink))) 1422} 1423 1424// HcxEnterpriseSiteListPage contains a page of HcxEnterpriseSite values. 1425type HcxEnterpriseSiteListPage struct { 1426 fn func(context.Context, HcxEnterpriseSiteList) (HcxEnterpriseSiteList, error) 1427 hesl HcxEnterpriseSiteList 1428} 1429 1430// NextWithContext advances to the next page of values. If there was an error making 1431// the request the page does not advance and the error is returned. 1432func (page *HcxEnterpriseSiteListPage) NextWithContext(ctx context.Context) (err error) { 1433 if tracing.IsEnabled() { 1434 ctx = tracing.StartSpan(ctx, fqdn+"/HcxEnterpriseSiteListPage.NextWithContext") 1435 defer func() { 1436 sc := -1 1437 if page.Response().Response.Response != nil { 1438 sc = page.Response().Response.Response.StatusCode 1439 } 1440 tracing.EndSpan(ctx, sc, err) 1441 }() 1442 } 1443 for { 1444 next, err := page.fn(ctx, page.hesl) 1445 if err != nil { 1446 return err 1447 } 1448 page.hesl = next 1449 if !next.hasNextLink() || !next.IsEmpty() { 1450 break 1451 } 1452 } 1453 return nil 1454} 1455 1456// Next advances to the next page of values. If there was an error making 1457// the request the page does not advance and the error is returned. 1458// Deprecated: Use NextWithContext() instead. 1459func (page *HcxEnterpriseSiteListPage) Next() error { 1460 return page.NextWithContext(context.Background()) 1461} 1462 1463// NotDone returns true if the page enumeration should be started or is not yet complete. 1464func (page HcxEnterpriseSiteListPage) NotDone() bool { 1465 return !page.hesl.IsEmpty() 1466} 1467 1468// Response returns the raw server response from the last page request. 1469func (page HcxEnterpriseSiteListPage) Response() HcxEnterpriseSiteList { 1470 return page.hesl 1471} 1472 1473// Values returns the slice of values for the current page or nil if there are no values. 1474func (page HcxEnterpriseSiteListPage) Values() []HcxEnterpriseSite { 1475 if page.hesl.IsEmpty() { 1476 return nil 1477 } 1478 return *page.hesl.Value 1479} 1480 1481// Creates a new instance of the HcxEnterpriseSiteListPage type. 1482func NewHcxEnterpriseSiteListPage(cur HcxEnterpriseSiteList, getNextPage func(context.Context, HcxEnterpriseSiteList) (HcxEnterpriseSiteList, error)) HcxEnterpriseSiteListPage { 1483 return HcxEnterpriseSiteListPage{ 1484 fn: getNextPage, 1485 hesl: cur, 1486 } 1487} 1488 1489// HcxEnterpriseSiteProperties the properties of an HCX Enterprise Site 1490type HcxEnterpriseSiteProperties struct { 1491 // ActivationKey - READ-ONLY; The activation key 1492 ActivationKey *string `json:"activationKey,omitempty"` 1493 // Status - READ-ONLY; The status of the HCX Enterprise Site. Possible values include: 'Available', 'Consumed', 'Deactivated', 'Deleted' 1494 Status HcxEnterpriseSiteStatus `json:"status,omitempty"` 1495} 1496 1497// MarshalJSON is the custom marshaler for HcxEnterpriseSiteProperties. 1498func (hesp HcxEnterpriseSiteProperties) MarshalJSON() ([]byte, error) { 1499 objectMap := make(map[string]interface{}) 1500 return json.Marshal(objectMap) 1501} 1502 1503// IdentitySource vCenter Single Sign On Identity Source 1504type IdentitySource struct { 1505 // Name - The name of the identity source 1506 Name *string `json:"name,omitempty"` 1507 // Alias - The domain's NetBIOS name 1508 Alias *string `json:"alias,omitempty"` 1509 // Domain - The domain's dns name 1510 Domain *string `json:"domain,omitempty"` 1511 // BaseUserDN - The base distinguished name for users 1512 BaseUserDN *string `json:"baseUserDN,omitempty"` 1513 // BaseGroupDN - The base distinguished name for groups 1514 BaseGroupDN *string `json:"baseGroupDN,omitempty"` 1515 // PrimaryServer - Primary server URL 1516 PrimaryServer *string `json:"primaryServer,omitempty"` 1517 // SecondaryServer - Secondary server URL 1518 SecondaryServer *string `json:"secondaryServer,omitempty"` 1519 // Ssl - Protect LDAP communication using SSL certificate (LDAPS). Possible values include: 'SslEnumEnabled', 'SslEnumDisabled' 1520 Ssl SslEnum `json:"ssl,omitempty"` 1521 // Username - The ID of an Active Directory user with a minimum of read-only access to Base DN for users and group 1522 Username *string `json:"username,omitempty"` 1523 // Password - The password of the Active Directory user with a minimum of read-only access to Base DN for users and groups. 1524 Password *string `json:"password,omitempty"` 1525} 1526 1527// LogSpecification specifications of the Log for Azure Monitoring 1528type LogSpecification struct { 1529 // Name - Name of the log 1530 Name *string `json:"name,omitempty"` 1531 // DisplayName - Localized friendly display name of the log 1532 DisplayName *string `json:"displayName,omitempty"` 1533 // BlobDuration - Blob duration of the log 1534 BlobDuration *string `json:"blobDuration,omitempty"` 1535} 1536 1537// ManagementCluster the properties of a management cluster 1538type ManagementCluster struct { 1539 // ProvisioningState - READ-ONLY; The state of the cluster provisioning. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Deleting', 'Updating' 1540 ProvisioningState ClusterProvisioningState `json:"provisioningState,omitempty"` 1541 // ClusterSize - The cluster size 1542 ClusterSize *int32 `json:"clusterSize,omitempty"` 1543 // ClusterID - READ-ONLY; The identity 1544 ClusterID *int32 `json:"clusterId,omitempty"` 1545 // Hosts - READ-ONLY; The hosts 1546 Hosts *[]string `json:"hosts,omitempty"` 1547} 1548 1549// MarshalJSON is the custom marshaler for ManagementCluster. 1550func (mc ManagementCluster) MarshalJSON() ([]byte, error) { 1551 objectMap := make(map[string]interface{}) 1552 if mc.ClusterSize != nil { 1553 objectMap["clusterSize"] = mc.ClusterSize 1554 } 1555 return json.Marshal(objectMap) 1556} 1557 1558// MetricDimension specifications of the Dimension of metrics 1559type MetricDimension struct { 1560 // Name - Name of the dimension 1561 Name *string `json:"name,omitempty"` 1562 // DisplayName - Localized friendly display name of the dimension 1563 DisplayName *string `json:"displayName,omitempty"` 1564} 1565 1566// MetricSpecification specifications of the Metrics for Azure Monitoring 1567type MetricSpecification struct { 1568 // Name - Name of the metric 1569 Name *string `json:"name,omitempty"` 1570 // DisplayName - Localized friendly display name of the metric 1571 DisplayName *string `json:"displayName,omitempty"` 1572 // DisplayDescription - Localized friendly description of the metric 1573 DisplayDescription *string `json:"displayDescription,omitempty"` 1574 // Unit - Unit that makes sense for the metric 1575 Unit *string `json:"unit,omitempty"` 1576 // Category - Name of the metric category that the metric belongs to. A metric can only belong to a single category. 1577 Category *string `json:"category,omitempty"` 1578 // AggregationType - Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. 1579 AggregationType *string `json:"aggregationType,omitempty"` 1580 // SupportedAggregationTypes - Supported aggregation types 1581 SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` 1582 // SupportedTimeGrainTypes - Supported time grain types 1583 SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` 1584 // FillGapWithZero - Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. 1585 FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` 1586 // Dimensions - Dimensions of the metric 1587 Dimensions *[]MetricDimension `json:"dimensions,omitempty"` 1588 // EnableRegionalMdmAccount - Whether or not the service is using regional MDM accounts. 1589 EnableRegionalMdmAccount *string `json:"enableRegionalMdmAccount,omitempty"` 1590 // SourceMdmAccount - The name of the MDM account. 1591 SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` 1592 // SourceMdmNamespace - The name of the MDM namespace. 1593 SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` 1594} 1595 1596// Operation a REST API operation 1597type Operation struct { 1598 // Name - READ-ONLY; Name of the operation being performed on this object 1599 Name *string `json:"name,omitempty"` 1600 // Display - READ-ONLY; Contains the localized display information for this operation 1601 Display *OperationDisplay `json:"display,omitempty"` 1602 // IsDataAction - Gets or sets a value indicating whether the operation is a data action or not 1603 IsDataAction *bool `json:"isDataAction,omitempty"` 1604 // Origin - Origin of the operation 1605 Origin *string `json:"origin,omitempty"` 1606 // Properties - Properties of the operation 1607 Properties *OperationProperties `json:"properties,omitempty"` 1608} 1609 1610// MarshalJSON is the custom marshaler for Operation. 1611func (o Operation) MarshalJSON() ([]byte, error) { 1612 objectMap := make(map[string]interface{}) 1613 if o.IsDataAction != nil { 1614 objectMap["isDataAction"] = o.IsDataAction 1615 } 1616 if o.Origin != nil { 1617 objectMap["origin"] = o.Origin 1618 } 1619 if o.Properties != nil { 1620 objectMap["properties"] = o.Properties 1621 } 1622 return json.Marshal(objectMap) 1623} 1624 1625// OperationDisplay contains the localized display information for this operation 1626type OperationDisplay struct { 1627 // Provider - READ-ONLY; Localized friendly form of the resource provider name 1628 Provider *string `json:"provider,omitempty"` 1629 // Resource - READ-ONLY; Localized friendly form of the resource type related to this operation 1630 Resource *string `json:"resource,omitempty"` 1631 // Operation - READ-ONLY; Localized friendly name for the operation 1632 Operation *string `json:"operation,omitempty"` 1633 // Description - READ-ONLY; Localized friendly description for the operation 1634 Description *string `json:"description,omitempty"` 1635} 1636 1637// MarshalJSON is the custom marshaler for OperationDisplay. 1638func (o OperationDisplay) MarshalJSON() ([]byte, error) { 1639 objectMap := make(map[string]interface{}) 1640 return json.Marshal(objectMap) 1641} 1642 1643// OperationList pageable list of operations 1644type OperationList struct { 1645 autorest.Response `json:"-"` 1646 // Value - READ-ONLY; List of operations 1647 Value *[]Operation `json:"value,omitempty"` 1648 // NextLink - READ-ONLY; URL to get the next page if any 1649 NextLink *string `json:"nextLink,omitempty"` 1650} 1651 1652// MarshalJSON is the custom marshaler for OperationList. 1653func (ol OperationList) MarshalJSON() ([]byte, error) { 1654 objectMap := make(map[string]interface{}) 1655 return json.Marshal(objectMap) 1656} 1657 1658// OperationListIterator provides access to a complete listing of Operation values. 1659type OperationListIterator struct { 1660 i int 1661 page OperationListPage 1662} 1663 1664// NextWithContext advances to the next value. If there was an error making 1665// the request the iterator does not advance and the error is returned. 1666func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) { 1667 if tracing.IsEnabled() { 1668 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.NextWithContext") 1669 defer func() { 1670 sc := -1 1671 if iter.Response().Response.Response != nil { 1672 sc = iter.Response().Response.Response.StatusCode 1673 } 1674 tracing.EndSpan(ctx, sc, err) 1675 }() 1676 } 1677 iter.i++ 1678 if iter.i < len(iter.page.Values()) { 1679 return nil 1680 } 1681 err = iter.page.NextWithContext(ctx) 1682 if err != nil { 1683 iter.i-- 1684 return err 1685 } 1686 iter.i = 0 1687 return nil 1688} 1689 1690// Next advances to the next value. If there was an error making 1691// the request the iterator does not advance and the error is returned. 1692// Deprecated: Use NextWithContext() instead. 1693func (iter *OperationListIterator) Next() error { 1694 return iter.NextWithContext(context.Background()) 1695} 1696 1697// NotDone returns true if the enumeration should be started or is not yet complete. 1698func (iter OperationListIterator) NotDone() bool { 1699 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1700} 1701 1702// Response returns the raw server response from the last page request. 1703func (iter OperationListIterator) Response() OperationList { 1704 return iter.page.Response() 1705} 1706 1707// Value returns the current value or a zero-initialized value if the 1708// iterator has advanced beyond the end of the collection. 1709func (iter OperationListIterator) Value() Operation { 1710 if !iter.page.NotDone() { 1711 return Operation{} 1712 } 1713 return iter.page.Values()[iter.i] 1714} 1715 1716// Creates a new instance of the OperationListIterator type. 1717func NewOperationListIterator(page OperationListPage) OperationListIterator { 1718 return OperationListIterator{page: page} 1719} 1720 1721// IsEmpty returns true if the ListResult contains no values. 1722func (ol OperationList) IsEmpty() bool { 1723 return ol.Value == nil || len(*ol.Value) == 0 1724} 1725 1726// hasNextLink returns true if the NextLink is not empty. 1727func (ol OperationList) hasNextLink() bool { 1728 return ol.NextLink != nil && len(*ol.NextLink) != 0 1729} 1730 1731// operationListPreparer prepares a request to retrieve the next set of results. 1732// It returns nil if no more results exist. 1733func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) { 1734 if !ol.hasNextLink() { 1735 return nil, nil 1736 } 1737 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1738 autorest.AsJSON(), 1739 autorest.AsGet(), 1740 autorest.WithBaseURL(to.String(ol.NextLink))) 1741} 1742 1743// OperationListPage contains a page of Operation values. 1744type OperationListPage struct { 1745 fn func(context.Context, OperationList) (OperationList, error) 1746 ol OperationList 1747} 1748 1749// NextWithContext advances to the next page of values. If there was an error making 1750// the request the page does not advance and the error is returned. 1751func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) { 1752 if tracing.IsEnabled() { 1753 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.NextWithContext") 1754 defer func() { 1755 sc := -1 1756 if page.Response().Response.Response != nil { 1757 sc = page.Response().Response.Response.StatusCode 1758 } 1759 tracing.EndSpan(ctx, sc, err) 1760 }() 1761 } 1762 for { 1763 next, err := page.fn(ctx, page.ol) 1764 if err != nil { 1765 return err 1766 } 1767 page.ol = next 1768 if !next.hasNextLink() || !next.IsEmpty() { 1769 break 1770 } 1771 } 1772 return nil 1773} 1774 1775// Next advances to the next page of values. If there was an error making 1776// the request the page does not advance and the error is returned. 1777// Deprecated: Use NextWithContext() instead. 1778func (page *OperationListPage) Next() error { 1779 return page.NextWithContext(context.Background()) 1780} 1781 1782// NotDone returns true if the page enumeration should be started or is not yet complete. 1783func (page OperationListPage) NotDone() bool { 1784 return !page.ol.IsEmpty() 1785} 1786 1787// Response returns the raw server response from the last page request. 1788func (page OperationListPage) Response() OperationList { 1789 return page.ol 1790} 1791 1792// Values returns the slice of values for the current page or nil if there are no values. 1793func (page OperationListPage) Values() []Operation { 1794 if page.ol.IsEmpty() { 1795 return nil 1796 } 1797 return *page.ol.Value 1798} 1799 1800// Creates a new instance of the OperationListPage type. 1801func NewOperationListPage(cur OperationList, getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage { 1802 return OperationListPage{ 1803 fn: getNextPage, 1804 ol: cur, 1805 } 1806} 1807 1808// OperationProperties extra Operation properties 1809type OperationProperties struct { 1810 // ServiceSpecification - Service specifications of the operation 1811 ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` 1812} 1813 1814// PrivateCloud a private cloud resource 1815type PrivateCloud struct { 1816 autorest.Response `json:"-"` 1817 // Sku - The private cloud SKU 1818 Sku *Sku `json:"sku,omitempty"` 1819 // PrivateCloudProperties - The properties of a private cloud resource 1820 *PrivateCloudProperties `json:"properties,omitempty"` 1821 // Location - Resource location 1822 Location *string `json:"location,omitempty"` 1823 // Tags - Resource tags 1824 Tags map[string]*string `json:"tags"` 1825 // ID - READ-ONLY; Resource ID. 1826 ID *string `json:"id,omitempty"` 1827 // Name - READ-ONLY; Resource name. 1828 Name *string `json:"name,omitempty"` 1829 // Type - READ-ONLY; Resource type. 1830 Type *string `json:"type,omitempty"` 1831} 1832 1833// MarshalJSON is the custom marshaler for PrivateCloud. 1834func (pc PrivateCloud) MarshalJSON() ([]byte, error) { 1835 objectMap := make(map[string]interface{}) 1836 if pc.Sku != nil { 1837 objectMap["sku"] = pc.Sku 1838 } 1839 if pc.PrivateCloudProperties != nil { 1840 objectMap["properties"] = pc.PrivateCloudProperties 1841 } 1842 if pc.Location != nil { 1843 objectMap["location"] = pc.Location 1844 } 1845 if pc.Tags != nil { 1846 objectMap["tags"] = pc.Tags 1847 } 1848 return json.Marshal(objectMap) 1849} 1850 1851// UnmarshalJSON is the custom unmarshaler for PrivateCloud struct. 1852func (pc *PrivateCloud) UnmarshalJSON(body []byte) error { 1853 var m map[string]*json.RawMessage 1854 err := json.Unmarshal(body, &m) 1855 if err != nil { 1856 return err 1857 } 1858 for k, v := range m { 1859 switch k { 1860 case "sku": 1861 if v != nil { 1862 var sku Sku 1863 err = json.Unmarshal(*v, &sku) 1864 if err != nil { 1865 return err 1866 } 1867 pc.Sku = &sku 1868 } 1869 case "properties": 1870 if v != nil { 1871 var privateCloudProperties PrivateCloudProperties 1872 err = json.Unmarshal(*v, &privateCloudProperties) 1873 if err != nil { 1874 return err 1875 } 1876 pc.PrivateCloudProperties = &privateCloudProperties 1877 } 1878 case "location": 1879 if v != nil { 1880 var location string 1881 err = json.Unmarshal(*v, &location) 1882 if err != nil { 1883 return err 1884 } 1885 pc.Location = &location 1886 } 1887 case "tags": 1888 if v != nil { 1889 var tags map[string]*string 1890 err = json.Unmarshal(*v, &tags) 1891 if err != nil { 1892 return err 1893 } 1894 pc.Tags = tags 1895 } 1896 case "id": 1897 if v != nil { 1898 var ID string 1899 err = json.Unmarshal(*v, &ID) 1900 if err != nil { 1901 return err 1902 } 1903 pc.ID = &ID 1904 } 1905 case "name": 1906 if v != nil { 1907 var name string 1908 err = json.Unmarshal(*v, &name) 1909 if err != nil { 1910 return err 1911 } 1912 pc.Name = &name 1913 } 1914 case "type": 1915 if v != nil { 1916 var typeVar string 1917 err = json.Unmarshal(*v, &typeVar) 1918 if err != nil { 1919 return err 1920 } 1921 pc.Type = &typeVar 1922 } 1923 } 1924 } 1925 1926 return nil 1927} 1928 1929// PrivateCloudList a paged list of private clouds 1930type PrivateCloudList struct { 1931 autorest.Response `json:"-"` 1932 // Value - READ-ONLY; The items on the page 1933 Value *[]PrivateCloud `json:"value,omitempty"` 1934 // NextLink - READ-ONLY; URL to get the next page if any 1935 NextLink *string `json:"nextLink,omitempty"` 1936} 1937 1938// MarshalJSON is the custom marshaler for PrivateCloudList. 1939func (pcl PrivateCloudList) MarshalJSON() ([]byte, error) { 1940 objectMap := make(map[string]interface{}) 1941 return json.Marshal(objectMap) 1942} 1943 1944// PrivateCloudListIterator provides access to a complete listing of PrivateCloud values. 1945type PrivateCloudListIterator struct { 1946 i int 1947 page PrivateCloudListPage 1948} 1949 1950// NextWithContext advances to the next value. If there was an error making 1951// the request the iterator does not advance and the error is returned. 1952func (iter *PrivateCloudListIterator) NextWithContext(ctx context.Context) (err error) { 1953 if tracing.IsEnabled() { 1954 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateCloudListIterator.NextWithContext") 1955 defer func() { 1956 sc := -1 1957 if iter.Response().Response.Response != nil { 1958 sc = iter.Response().Response.Response.StatusCode 1959 } 1960 tracing.EndSpan(ctx, sc, err) 1961 }() 1962 } 1963 iter.i++ 1964 if iter.i < len(iter.page.Values()) { 1965 return nil 1966 } 1967 err = iter.page.NextWithContext(ctx) 1968 if err != nil { 1969 iter.i-- 1970 return err 1971 } 1972 iter.i = 0 1973 return nil 1974} 1975 1976// Next advances to the next value. If there was an error making 1977// the request the iterator does not advance and the error is returned. 1978// Deprecated: Use NextWithContext() instead. 1979func (iter *PrivateCloudListIterator) Next() error { 1980 return iter.NextWithContext(context.Background()) 1981} 1982 1983// NotDone returns true if the enumeration should be started or is not yet complete. 1984func (iter PrivateCloudListIterator) NotDone() bool { 1985 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1986} 1987 1988// Response returns the raw server response from the last page request. 1989func (iter PrivateCloudListIterator) Response() PrivateCloudList { 1990 return iter.page.Response() 1991} 1992 1993// Value returns the current value or a zero-initialized value if the 1994// iterator has advanced beyond the end of the collection. 1995func (iter PrivateCloudListIterator) Value() PrivateCloud { 1996 if !iter.page.NotDone() { 1997 return PrivateCloud{} 1998 } 1999 return iter.page.Values()[iter.i] 2000} 2001 2002// Creates a new instance of the PrivateCloudListIterator type. 2003func NewPrivateCloudListIterator(page PrivateCloudListPage) PrivateCloudListIterator { 2004 return PrivateCloudListIterator{page: page} 2005} 2006 2007// IsEmpty returns true if the ListResult contains no values. 2008func (pcl PrivateCloudList) IsEmpty() bool { 2009 return pcl.Value == nil || len(*pcl.Value) == 0 2010} 2011 2012// hasNextLink returns true if the NextLink is not empty. 2013func (pcl PrivateCloudList) hasNextLink() bool { 2014 return pcl.NextLink != nil && len(*pcl.NextLink) != 0 2015} 2016 2017// privateCloudListPreparer prepares a request to retrieve the next set of results. 2018// It returns nil if no more results exist. 2019func (pcl PrivateCloudList) privateCloudListPreparer(ctx context.Context) (*http.Request, error) { 2020 if !pcl.hasNextLink() { 2021 return nil, nil 2022 } 2023 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2024 autorest.AsJSON(), 2025 autorest.AsGet(), 2026 autorest.WithBaseURL(to.String(pcl.NextLink))) 2027} 2028 2029// PrivateCloudListPage contains a page of PrivateCloud values. 2030type PrivateCloudListPage struct { 2031 fn func(context.Context, PrivateCloudList) (PrivateCloudList, error) 2032 pcl PrivateCloudList 2033} 2034 2035// NextWithContext advances to the next page of values. If there was an error making 2036// the request the page does not advance and the error is returned. 2037func (page *PrivateCloudListPage) NextWithContext(ctx context.Context) (err error) { 2038 if tracing.IsEnabled() { 2039 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateCloudListPage.NextWithContext") 2040 defer func() { 2041 sc := -1 2042 if page.Response().Response.Response != nil { 2043 sc = page.Response().Response.Response.StatusCode 2044 } 2045 tracing.EndSpan(ctx, sc, err) 2046 }() 2047 } 2048 for { 2049 next, err := page.fn(ctx, page.pcl) 2050 if err != nil { 2051 return err 2052 } 2053 page.pcl = next 2054 if !next.hasNextLink() || !next.IsEmpty() { 2055 break 2056 } 2057 } 2058 return nil 2059} 2060 2061// Next advances to the next page of values. If there was an error making 2062// the request the page does not advance and the error is returned. 2063// Deprecated: Use NextWithContext() instead. 2064func (page *PrivateCloudListPage) Next() error { 2065 return page.NextWithContext(context.Background()) 2066} 2067 2068// NotDone returns true if the page enumeration should be started or is not yet complete. 2069func (page PrivateCloudListPage) NotDone() bool { 2070 return !page.pcl.IsEmpty() 2071} 2072 2073// Response returns the raw server response from the last page request. 2074func (page PrivateCloudListPage) Response() PrivateCloudList { 2075 return page.pcl 2076} 2077 2078// Values returns the slice of values for the current page or nil if there are no values. 2079func (page PrivateCloudListPage) Values() []PrivateCloud { 2080 if page.pcl.IsEmpty() { 2081 return nil 2082 } 2083 return *page.pcl.Value 2084} 2085 2086// Creates a new instance of the PrivateCloudListPage type. 2087func NewPrivateCloudListPage(cur PrivateCloudList, getNextPage func(context.Context, PrivateCloudList) (PrivateCloudList, error)) PrivateCloudListPage { 2088 return PrivateCloudListPage{ 2089 fn: getNextPage, 2090 pcl: cur, 2091 } 2092} 2093 2094// PrivateCloudProperties the properties of a private cloud resource 2095type PrivateCloudProperties struct { 2096 // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'PrivateCloudProvisioningStateSucceeded', 'PrivateCloudProvisioningStateFailed', 'PrivateCloudProvisioningStateCancelled', 'PrivateCloudProvisioningStatePending', 'PrivateCloudProvisioningStateBuilding', 'PrivateCloudProvisioningStateDeleting', 'PrivateCloudProvisioningStateUpdating' 2097 ProvisioningState PrivateCloudProvisioningState `json:"provisioningState,omitempty"` 2098 // Circuit - An ExpressRoute Circuit 2099 Circuit *Circuit `json:"circuit,omitempty"` 2100 // Endpoints - READ-ONLY; The endpoints 2101 Endpoints *Endpoints `json:"endpoints,omitempty"` 2102 // NetworkBlock - The block of addresses should be unique across VNet in your subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are between 0 and 255, and X is between 0 and 22 2103 NetworkBlock *string `json:"networkBlock,omitempty"` 2104 // ManagementNetwork - READ-ONLY; Network used to access vCenter Server and NSX-T Manager 2105 ManagementNetwork *string `json:"managementNetwork,omitempty"` 2106 // ProvisioningNetwork - READ-ONLY; Used for virtual machine cold migration, cloning, and snapshot migration 2107 ProvisioningNetwork *string `json:"provisioningNetwork,omitempty"` 2108 // VmotionNetwork - READ-ONLY; Used for live migration of virtual machines 2109 VmotionNetwork *string `json:"vmotionNetwork,omitempty"` 2110 // VcenterCertificateThumbprint - READ-ONLY; Thumbprint of the vCenter Server SSL certificate 2111 VcenterCertificateThumbprint *string `json:"vcenterCertificateThumbprint,omitempty"` 2112 // NsxtCertificateThumbprint - READ-ONLY; Thumbprint of the NSX-T Manager SSL certificate 2113 NsxtCertificateThumbprint *string `json:"nsxtCertificateThumbprint,omitempty"` 2114 // ManagementCluster - The default cluster used for management 2115 ManagementCluster *ManagementCluster `json:"managementCluster,omitempty"` 2116 // Internet - Connectivity to internet is enabled or disabled. Possible values include: 'Enabled', 'Disabled' 2117 Internet InternetEnum `json:"internet,omitempty"` 2118 // IdentitySources - vCenter Single Sign On Identity Sources 2119 IdentitySources *[]IdentitySource `json:"identitySources,omitempty"` 2120 // VcenterPassword - Indicate to rotate the vCenter admin password for the private cloud. Possible values include: 'VcsaAdminRotateEnumOnetimeRotate' 2121 VcenterPassword VcsaAdminRotateEnum `json:"vcenterPassword,omitempty"` 2122 // NsxtPassword - Indicate to rotate the NSX-T Manager password for the private cloud. Possible values include: 'OnetimeRotate' 2123 NsxtPassword NsxtAdminRotateEnum `json:"nsxtPassword,omitempty"` 2124} 2125 2126// MarshalJSON is the custom marshaler for PrivateCloudProperties. 2127func (pcp PrivateCloudProperties) MarshalJSON() ([]byte, error) { 2128 objectMap := make(map[string]interface{}) 2129 if pcp.Circuit != nil { 2130 objectMap["circuit"] = pcp.Circuit 2131 } 2132 if pcp.NetworkBlock != nil { 2133 objectMap["networkBlock"] = pcp.NetworkBlock 2134 } 2135 if pcp.ManagementCluster != nil { 2136 objectMap["managementCluster"] = pcp.ManagementCluster 2137 } 2138 if pcp.Internet != "" { 2139 objectMap["internet"] = pcp.Internet 2140 } 2141 if pcp.IdentitySources != nil { 2142 objectMap["identitySources"] = pcp.IdentitySources 2143 } 2144 if pcp.VcenterPassword != "" { 2145 objectMap["vcenterPassword"] = pcp.VcenterPassword 2146 } 2147 if pcp.NsxtPassword != "" { 2148 objectMap["nsxtPassword"] = pcp.NsxtPassword 2149 } 2150 return json.Marshal(objectMap) 2151} 2152 2153// PrivateCloudsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 2154// long-running operation. 2155type PrivateCloudsCreateOrUpdateFuture struct { 2156 azure.FutureAPI 2157 // Result returns the result of the asynchronous operation. 2158 // If the operation has not completed it will return an error. 2159 Result func(PrivateCloudsClient) (PrivateCloud, error) 2160} 2161 2162// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2163func (future *PrivateCloudsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 2164 var azFuture azure.Future 2165 if err := json.Unmarshal(body, &azFuture); err != nil { 2166 return err 2167 } 2168 future.FutureAPI = &azFuture 2169 future.Result = future.result 2170 return nil 2171} 2172 2173// result is the default implementation for PrivateCloudsCreateOrUpdateFuture.Result. 2174func (future *PrivateCloudsCreateOrUpdateFuture) result(client PrivateCloudsClient) (pc PrivateCloud, err error) { 2175 var done bool 2176 done, err = future.DoneWithContext(context.Background(), client) 2177 if err != nil { 2178 err = autorest.NewErrorWithError(err, "avs.PrivateCloudsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 2179 return 2180 } 2181 if !done { 2182 pc.Response.Response = future.Response() 2183 err = azure.NewAsyncOpIncompleteError("avs.PrivateCloudsCreateOrUpdateFuture") 2184 return 2185 } 2186 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2187 if pc.Response.Response, err = future.GetResult(sender); err == nil && pc.Response.Response.StatusCode != http.StatusNoContent { 2188 pc, err = client.CreateOrUpdateResponder(pc.Response.Response) 2189 if err != nil { 2190 err = autorest.NewErrorWithError(err, "avs.PrivateCloudsCreateOrUpdateFuture", "Result", pc.Response.Response, "Failure responding to request") 2191 } 2192 } 2193 return 2194} 2195 2196// PrivateCloudsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 2197// operation. 2198type PrivateCloudsDeleteFuture struct { 2199 azure.FutureAPI 2200 // Result returns the result of the asynchronous operation. 2201 // If the operation has not completed it will return an error. 2202 Result func(PrivateCloudsClient) (autorest.Response, error) 2203} 2204 2205// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2206func (future *PrivateCloudsDeleteFuture) UnmarshalJSON(body []byte) error { 2207 var azFuture azure.Future 2208 if err := json.Unmarshal(body, &azFuture); err != nil { 2209 return err 2210 } 2211 future.FutureAPI = &azFuture 2212 future.Result = future.result 2213 return nil 2214} 2215 2216// result is the default implementation for PrivateCloudsDeleteFuture.Result. 2217func (future *PrivateCloudsDeleteFuture) result(client PrivateCloudsClient) (ar autorest.Response, err error) { 2218 var done bool 2219 done, err = future.DoneWithContext(context.Background(), client) 2220 if err != nil { 2221 err = autorest.NewErrorWithError(err, "avs.PrivateCloudsDeleteFuture", "Result", future.Response(), "Polling failure") 2222 return 2223 } 2224 if !done { 2225 ar.Response = future.Response() 2226 err = azure.NewAsyncOpIncompleteError("avs.PrivateCloudsDeleteFuture") 2227 return 2228 } 2229 ar.Response = future.Response() 2230 return 2231} 2232 2233// PrivateCloudsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2234// operation. 2235type PrivateCloudsUpdateFuture struct { 2236 azure.FutureAPI 2237 // Result returns the result of the asynchronous operation. 2238 // If the operation has not completed it will return an error. 2239 Result func(PrivateCloudsClient) (PrivateCloud, error) 2240} 2241 2242// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2243func (future *PrivateCloudsUpdateFuture) UnmarshalJSON(body []byte) error { 2244 var azFuture azure.Future 2245 if err := json.Unmarshal(body, &azFuture); err != nil { 2246 return err 2247 } 2248 future.FutureAPI = &azFuture 2249 future.Result = future.result 2250 return nil 2251} 2252 2253// result is the default implementation for PrivateCloudsUpdateFuture.Result. 2254func (future *PrivateCloudsUpdateFuture) result(client PrivateCloudsClient) (pc PrivateCloud, err error) { 2255 var done bool 2256 done, err = future.DoneWithContext(context.Background(), client) 2257 if err != nil { 2258 err = autorest.NewErrorWithError(err, "avs.PrivateCloudsUpdateFuture", "Result", future.Response(), "Polling failure") 2259 return 2260 } 2261 if !done { 2262 pc.Response.Response = future.Response() 2263 err = azure.NewAsyncOpIncompleteError("avs.PrivateCloudsUpdateFuture") 2264 return 2265 } 2266 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2267 if pc.Response.Response, err = future.GetResult(sender); err == nil && pc.Response.Response.StatusCode != http.StatusNoContent { 2268 pc, err = client.UpdateResponder(pc.Response.Response) 2269 if err != nil { 2270 err = autorest.NewErrorWithError(err, "avs.PrivateCloudsUpdateFuture", "Result", pc.Response.Response, "Failure responding to request") 2271 } 2272 } 2273 return 2274} 2275 2276// PrivateCloudUpdate an update to a private cloud resource 2277type PrivateCloudUpdate struct { 2278 // Tags - Resource tags 2279 Tags map[string]*string `json:"tags"` 2280 // PrivateCloudUpdateProperties - The updatable properties of a private cloud resource 2281 *PrivateCloudUpdateProperties `json:"properties,omitempty"` 2282} 2283 2284// MarshalJSON is the custom marshaler for PrivateCloudUpdate. 2285func (pcu PrivateCloudUpdate) MarshalJSON() ([]byte, error) { 2286 objectMap := make(map[string]interface{}) 2287 if pcu.Tags != nil { 2288 objectMap["tags"] = pcu.Tags 2289 } 2290 if pcu.PrivateCloudUpdateProperties != nil { 2291 objectMap["properties"] = pcu.PrivateCloudUpdateProperties 2292 } 2293 return json.Marshal(objectMap) 2294} 2295 2296// UnmarshalJSON is the custom unmarshaler for PrivateCloudUpdate struct. 2297func (pcu *PrivateCloudUpdate) UnmarshalJSON(body []byte) error { 2298 var m map[string]*json.RawMessage 2299 err := json.Unmarshal(body, &m) 2300 if err != nil { 2301 return err 2302 } 2303 for k, v := range m { 2304 switch k { 2305 case "tags": 2306 if v != nil { 2307 var tags map[string]*string 2308 err = json.Unmarshal(*v, &tags) 2309 if err != nil { 2310 return err 2311 } 2312 pcu.Tags = tags 2313 } 2314 case "properties": 2315 if v != nil { 2316 var privateCloudUpdateProperties PrivateCloudUpdateProperties 2317 err = json.Unmarshal(*v, &privateCloudUpdateProperties) 2318 if err != nil { 2319 return err 2320 } 2321 pcu.PrivateCloudUpdateProperties = &privateCloudUpdateProperties 2322 } 2323 } 2324 } 2325 2326 return nil 2327} 2328 2329// PrivateCloudUpdateProperties the properties of a private cloud resource that may be updated 2330type PrivateCloudUpdateProperties struct { 2331 // ManagementCluster - The default cluster used for management 2332 ManagementCluster *ManagementCluster `json:"managementCluster,omitempty"` 2333 // Internet - Connectivity to internet is enabled or disabled. Possible values include: 'Enabled', 'Disabled' 2334 Internet InternetEnum `json:"internet,omitempty"` 2335 // IdentitySources - vCenter Single Sign On Identity Sources 2336 IdentitySources *[]IdentitySource `json:"identitySources,omitempty"` 2337 // VcenterPassword - Indicate to rotate the vCenter admin password for the private cloud. Possible values include: 'VcsaAdminRotateEnumOnetimeRotate' 2338 VcenterPassword VcsaAdminRotateEnum `json:"vcenterPassword,omitempty"` 2339 // NsxtPassword - Indicate to rotate the NSX-T Manager password for the private cloud. Possible values include: 'OnetimeRotate' 2340 NsxtPassword NsxtAdminRotateEnum `json:"nsxtPassword,omitempty"` 2341} 2342 2343// ProxyResource the resource model definition for a ARM proxy resource 2344type ProxyResource struct { 2345 // ID - READ-ONLY; Resource ID. 2346 ID *string `json:"id,omitempty"` 2347 // Name - READ-ONLY; Resource name. 2348 Name *string `json:"name,omitempty"` 2349 // Type - READ-ONLY; Resource type. 2350 Type *string `json:"type,omitempty"` 2351} 2352 2353// MarshalJSON is the custom marshaler for ProxyResource. 2354func (pr ProxyResource) MarshalJSON() ([]byte, error) { 2355 objectMap := make(map[string]interface{}) 2356 return json.Marshal(objectMap) 2357} 2358 2359// Quota subscription quotas 2360type Quota struct { 2361 autorest.Response `json:"-"` 2362 // HostsRemaining - READ-ONLY; Remaining hosts quota by sku type 2363 HostsRemaining map[string]*int32 `json:"hostsRemaining"` 2364 // QuotaEnabled - READ-ONLY; Host quota is active for current subscription. Possible values include: 'QuotaEnabledEnabled', 'QuotaEnabledDisabled' 2365 QuotaEnabled QuotaEnabled `json:"quotaEnabled,omitempty"` 2366} 2367 2368// MarshalJSON is the custom marshaler for Quota. 2369func (q Quota) MarshalJSON() ([]byte, error) { 2370 objectMap := make(map[string]interface{}) 2371 return json.Marshal(objectMap) 2372} 2373 2374// Resource the core properties of ARM resources 2375type Resource struct { 2376 // ID - READ-ONLY; Resource ID. 2377 ID *string `json:"id,omitempty"` 2378 // Name - READ-ONLY; Resource name. 2379 Name *string `json:"name,omitempty"` 2380 // Type - READ-ONLY; Resource type. 2381 Type *string `json:"type,omitempty"` 2382} 2383 2384// MarshalJSON is the custom marshaler for Resource. 2385func (r Resource) MarshalJSON() ([]byte, error) { 2386 objectMap := make(map[string]interface{}) 2387 return json.Marshal(objectMap) 2388} 2389 2390// ServiceSpecification service specification payload 2391type ServiceSpecification struct { 2392 // LogSpecifications - Specifications of the Log for Azure Monitoring 2393 LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` 2394 // MetricSpecifications - Specifications of the Metrics for Azure Monitoring 2395 MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` 2396} 2397 2398// Sku the resource model definition representing SKU 2399type Sku struct { 2400 // Name - The name of the SKU. 2401 Name *string `json:"name,omitempty"` 2402} 2403 2404// TrackedResource the resource model definition for a ARM tracked top level resource 2405type TrackedResource struct { 2406 // Location - Resource location 2407 Location *string `json:"location,omitempty"` 2408 // Tags - Resource tags 2409 Tags map[string]*string `json:"tags"` 2410 // ID - READ-ONLY; Resource ID. 2411 ID *string `json:"id,omitempty"` 2412 // Name - READ-ONLY; Resource name. 2413 Name *string `json:"name,omitempty"` 2414 // Type - READ-ONLY; Resource type. 2415 Type *string `json:"type,omitempty"` 2416} 2417 2418// MarshalJSON is the custom marshaler for TrackedResource. 2419func (tr TrackedResource) MarshalJSON() ([]byte, error) { 2420 objectMap := make(map[string]interface{}) 2421 if tr.Location != nil { 2422 objectMap["location"] = tr.Location 2423 } 2424 if tr.Tags != nil { 2425 objectMap["tags"] = tr.Tags 2426 } 2427 return json.Marshal(objectMap) 2428} 2429 2430// Trial subscription trial availability 2431type Trial struct { 2432 autorest.Response `json:"-"` 2433 // Status - READ-ONLY; Trial status. Possible values include: 'TrialAvailable', 'TrialUsed', 'TrialDisabled' 2434 Status TrialStatus `json:"status,omitempty"` 2435 // AvailableHosts - READ-ONLY; Number of trial hosts available 2436 AvailableHosts *int32 `json:"availableHosts,omitempty"` 2437} 2438 2439// MarshalJSON is the custom marshaler for Trial. 2440func (t Trial) MarshalJSON() ([]byte, error) { 2441 objectMap := make(map[string]interface{}) 2442 return json.Marshal(objectMap) 2443} 2444 2445// WorkloadNetworkDhcp NSX DHCP 2446type WorkloadNetworkDhcp struct { 2447 autorest.Response `json:"-"` 2448 // BasicWorkloadNetworkDhcpEntity - DHCP properties. 2449 BasicWorkloadNetworkDhcpEntity `json:"properties,omitempty"` 2450 // ID - READ-ONLY; Resource ID. 2451 ID *string `json:"id,omitempty"` 2452 // Name - READ-ONLY; Resource name. 2453 Name *string `json:"name,omitempty"` 2454 // Type - READ-ONLY; Resource type. 2455 Type *string `json:"type,omitempty"` 2456} 2457 2458// MarshalJSON is the custom marshaler for WorkloadNetworkDhcp. 2459func (wnd WorkloadNetworkDhcp) MarshalJSON() ([]byte, error) { 2460 objectMap := make(map[string]interface{}) 2461 objectMap["properties"] = wnd.BasicWorkloadNetworkDhcpEntity 2462 return json.Marshal(objectMap) 2463} 2464 2465// UnmarshalJSON is the custom unmarshaler for WorkloadNetworkDhcp struct. 2466func (wnd *WorkloadNetworkDhcp) UnmarshalJSON(body []byte) error { 2467 var m map[string]*json.RawMessage 2468 err := json.Unmarshal(body, &m) 2469 if err != nil { 2470 return err 2471 } 2472 for k, v := range m { 2473 switch k { 2474 case "properties": 2475 if v != nil { 2476 basicWorkloadNetworkDhcpEntity, err := unmarshalBasicWorkloadNetworkDhcpEntity(*v) 2477 if err != nil { 2478 return err 2479 } 2480 wnd.BasicWorkloadNetworkDhcpEntity = basicWorkloadNetworkDhcpEntity 2481 } 2482 case "id": 2483 if v != nil { 2484 var ID string 2485 err = json.Unmarshal(*v, &ID) 2486 if err != nil { 2487 return err 2488 } 2489 wnd.ID = &ID 2490 } 2491 case "name": 2492 if v != nil { 2493 var name string 2494 err = json.Unmarshal(*v, &name) 2495 if err != nil { 2496 return err 2497 } 2498 wnd.Name = &name 2499 } 2500 case "type": 2501 if v != nil { 2502 var typeVar string 2503 err = json.Unmarshal(*v, &typeVar) 2504 if err != nil { 2505 return err 2506 } 2507 wnd.Type = &typeVar 2508 } 2509 } 2510 } 2511 2512 return nil 2513} 2514 2515// BasicWorkloadNetworkDhcpEntity base class for WorkloadNetworkDhcpServer and WorkloadNetworkDhcpRelay to inherit from 2516type BasicWorkloadNetworkDhcpEntity interface { 2517 AsWorkloadNetworkDhcpServer() (*WorkloadNetworkDhcpServer, bool) 2518 AsWorkloadNetworkDhcpRelay() (*WorkloadNetworkDhcpRelay, bool) 2519 AsWorkloadNetworkDhcpEntity() (*WorkloadNetworkDhcpEntity, bool) 2520} 2521 2522// WorkloadNetworkDhcpEntity base class for WorkloadNetworkDhcpServer and WorkloadNetworkDhcpRelay to inherit 2523// from 2524type WorkloadNetworkDhcpEntity struct { 2525 // DisplayName - Display name of the DHCP entity. 2526 DisplayName *string `json:"displayName,omitempty"` 2527 // Segments - READ-ONLY; NSX Segments consuming DHCP. 2528 Segments *[]string `json:"segments,omitempty"` 2529 // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'WorkloadNetworkDhcpProvisioningStateSucceeded', 'WorkloadNetworkDhcpProvisioningStateFailed', 'WorkloadNetworkDhcpProvisioningStateBuilding', 'WorkloadNetworkDhcpProvisioningStateDeleting', 'WorkloadNetworkDhcpProvisioningStateUpdating' 2530 ProvisioningState WorkloadNetworkDhcpProvisioningState `json:"provisioningState,omitempty"` 2531 // Revision - NSX revision number. 2532 Revision *int64 `json:"revision,omitempty"` 2533 // DhcpType - Possible values include: 'DhcpTypeWorkloadNetworkDhcpEntity', 'DhcpTypeSERVER', 'DhcpTypeRELAY' 2534 DhcpType DhcpType `json:"dhcpType,omitempty"` 2535} 2536 2537func unmarshalBasicWorkloadNetworkDhcpEntity(body []byte) (BasicWorkloadNetworkDhcpEntity, error) { 2538 var m map[string]interface{} 2539 err := json.Unmarshal(body, &m) 2540 if err != nil { 2541 return nil, err 2542 } 2543 2544 switch m["dhcpType"] { 2545 case string(DhcpTypeSERVER): 2546 var wnds WorkloadNetworkDhcpServer 2547 err := json.Unmarshal(body, &wnds) 2548 return wnds, err 2549 case string(DhcpTypeRELAY): 2550 var wndr WorkloadNetworkDhcpRelay 2551 err := json.Unmarshal(body, &wndr) 2552 return wndr, err 2553 default: 2554 var wnde WorkloadNetworkDhcpEntity 2555 err := json.Unmarshal(body, &wnde) 2556 return wnde, err 2557 } 2558} 2559func unmarshalBasicWorkloadNetworkDhcpEntityArray(body []byte) ([]BasicWorkloadNetworkDhcpEntity, error) { 2560 var rawMessages []*json.RawMessage 2561 err := json.Unmarshal(body, &rawMessages) 2562 if err != nil { 2563 return nil, err 2564 } 2565 2566 wndeArray := make([]BasicWorkloadNetworkDhcpEntity, len(rawMessages)) 2567 2568 for index, rawMessage := range rawMessages { 2569 wnde, err := unmarshalBasicWorkloadNetworkDhcpEntity(*rawMessage) 2570 if err != nil { 2571 return nil, err 2572 } 2573 wndeArray[index] = wnde 2574 } 2575 return wndeArray, nil 2576} 2577 2578// MarshalJSON is the custom marshaler for WorkloadNetworkDhcpEntity. 2579func (wnde WorkloadNetworkDhcpEntity) MarshalJSON() ([]byte, error) { 2580 wnde.DhcpType = DhcpTypeWorkloadNetworkDhcpEntity 2581 objectMap := make(map[string]interface{}) 2582 if wnde.DisplayName != nil { 2583 objectMap["displayName"] = wnde.DisplayName 2584 } 2585 if wnde.Revision != nil { 2586 objectMap["revision"] = wnde.Revision 2587 } 2588 if wnde.DhcpType != "" { 2589 objectMap["dhcpType"] = wnde.DhcpType 2590 } 2591 return json.Marshal(objectMap) 2592} 2593 2594// AsWorkloadNetworkDhcpServer is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpEntity. 2595func (wnde WorkloadNetworkDhcpEntity) AsWorkloadNetworkDhcpServer() (*WorkloadNetworkDhcpServer, bool) { 2596 return nil, false 2597} 2598 2599// AsWorkloadNetworkDhcpRelay is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpEntity. 2600func (wnde WorkloadNetworkDhcpEntity) AsWorkloadNetworkDhcpRelay() (*WorkloadNetworkDhcpRelay, bool) { 2601 return nil, false 2602} 2603 2604// AsWorkloadNetworkDhcpEntity is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpEntity. 2605func (wnde WorkloadNetworkDhcpEntity) AsWorkloadNetworkDhcpEntity() (*WorkloadNetworkDhcpEntity, bool) { 2606 return &wnde, true 2607} 2608 2609// AsBasicWorkloadNetworkDhcpEntity is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpEntity. 2610func (wnde WorkloadNetworkDhcpEntity) AsBasicWorkloadNetworkDhcpEntity() (BasicWorkloadNetworkDhcpEntity, bool) { 2611 return &wnde, true 2612} 2613 2614// WorkloadNetworkDhcpList a list of NSX dhcp entities 2615type WorkloadNetworkDhcpList struct { 2616 autorest.Response `json:"-"` 2617 // Value - READ-ONLY; The items on the page 2618 Value *[]WorkloadNetworkDhcp `json:"value,omitempty"` 2619 // NextLink - READ-ONLY; URL to get the next page if any 2620 NextLink *string `json:"nextLink,omitempty"` 2621} 2622 2623// MarshalJSON is the custom marshaler for WorkloadNetworkDhcpList. 2624func (wndl WorkloadNetworkDhcpList) MarshalJSON() ([]byte, error) { 2625 objectMap := make(map[string]interface{}) 2626 return json.Marshal(objectMap) 2627} 2628 2629// WorkloadNetworkDhcpListIterator provides access to a complete listing of WorkloadNetworkDhcp values. 2630type WorkloadNetworkDhcpListIterator struct { 2631 i int 2632 page WorkloadNetworkDhcpListPage 2633} 2634 2635// NextWithContext advances to the next value. If there was an error making 2636// the request the iterator does not advance and the error is returned. 2637func (iter *WorkloadNetworkDhcpListIterator) NextWithContext(ctx context.Context) (err error) { 2638 if tracing.IsEnabled() { 2639 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkDhcpListIterator.NextWithContext") 2640 defer func() { 2641 sc := -1 2642 if iter.Response().Response.Response != nil { 2643 sc = iter.Response().Response.Response.StatusCode 2644 } 2645 tracing.EndSpan(ctx, sc, err) 2646 }() 2647 } 2648 iter.i++ 2649 if iter.i < len(iter.page.Values()) { 2650 return nil 2651 } 2652 err = iter.page.NextWithContext(ctx) 2653 if err != nil { 2654 iter.i-- 2655 return err 2656 } 2657 iter.i = 0 2658 return nil 2659} 2660 2661// Next advances to the next value. If there was an error making 2662// the request the iterator does not advance and the error is returned. 2663// Deprecated: Use NextWithContext() instead. 2664func (iter *WorkloadNetworkDhcpListIterator) Next() error { 2665 return iter.NextWithContext(context.Background()) 2666} 2667 2668// NotDone returns true if the enumeration should be started or is not yet complete. 2669func (iter WorkloadNetworkDhcpListIterator) NotDone() bool { 2670 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2671} 2672 2673// Response returns the raw server response from the last page request. 2674func (iter WorkloadNetworkDhcpListIterator) Response() WorkloadNetworkDhcpList { 2675 return iter.page.Response() 2676} 2677 2678// Value returns the current value or a zero-initialized value if the 2679// iterator has advanced beyond the end of the collection. 2680func (iter WorkloadNetworkDhcpListIterator) Value() WorkloadNetworkDhcp { 2681 if !iter.page.NotDone() { 2682 return WorkloadNetworkDhcp{} 2683 } 2684 return iter.page.Values()[iter.i] 2685} 2686 2687// Creates a new instance of the WorkloadNetworkDhcpListIterator type. 2688func NewWorkloadNetworkDhcpListIterator(page WorkloadNetworkDhcpListPage) WorkloadNetworkDhcpListIterator { 2689 return WorkloadNetworkDhcpListIterator{page: page} 2690} 2691 2692// IsEmpty returns true if the ListResult contains no values. 2693func (wndl WorkloadNetworkDhcpList) IsEmpty() bool { 2694 return wndl.Value == nil || len(*wndl.Value) == 0 2695} 2696 2697// hasNextLink returns true if the NextLink is not empty. 2698func (wndl WorkloadNetworkDhcpList) hasNextLink() bool { 2699 return wndl.NextLink != nil && len(*wndl.NextLink) != 0 2700} 2701 2702// workloadNetworkDhcpListPreparer prepares a request to retrieve the next set of results. 2703// It returns nil if no more results exist. 2704func (wndl WorkloadNetworkDhcpList) workloadNetworkDhcpListPreparer(ctx context.Context) (*http.Request, error) { 2705 if !wndl.hasNextLink() { 2706 return nil, nil 2707 } 2708 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2709 autorest.AsJSON(), 2710 autorest.AsGet(), 2711 autorest.WithBaseURL(to.String(wndl.NextLink))) 2712} 2713 2714// WorkloadNetworkDhcpListPage contains a page of WorkloadNetworkDhcp values. 2715type WorkloadNetworkDhcpListPage struct { 2716 fn func(context.Context, WorkloadNetworkDhcpList) (WorkloadNetworkDhcpList, error) 2717 wndl WorkloadNetworkDhcpList 2718} 2719 2720// NextWithContext advances to the next page of values. If there was an error making 2721// the request the page does not advance and the error is returned. 2722func (page *WorkloadNetworkDhcpListPage) NextWithContext(ctx context.Context) (err error) { 2723 if tracing.IsEnabled() { 2724 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkDhcpListPage.NextWithContext") 2725 defer func() { 2726 sc := -1 2727 if page.Response().Response.Response != nil { 2728 sc = page.Response().Response.Response.StatusCode 2729 } 2730 tracing.EndSpan(ctx, sc, err) 2731 }() 2732 } 2733 for { 2734 next, err := page.fn(ctx, page.wndl) 2735 if err != nil { 2736 return err 2737 } 2738 page.wndl = next 2739 if !next.hasNextLink() || !next.IsEmpty() { 2740 break 2741 } 2742 } 2743 return nil 2744} 2745 2746// Next advances to the next page of values. If there was an error making 2747// the request the page does not advance and the error is returned. 2748// Deprecated: Use NextWithContext() instead. 2749func (page *WorkloadNetworkDhcpListPage) Next() error { 2750 return page.NextWithContext(context.Background()) 2751} 2752 2753// NotDone returns true if the page enumeration should be started or is not yet complete. 2754func (page WorkloadNetworkDhcpListPage) NotDone() bool { 2755 return !page.wndl.IsEmpty() 2756} 2757 2758// Response returns the raw server response from the last page request. 2759func (page WorkloadNetworkDhcpListPage) Response() WorkloadNetworkDhcpList { 2760 return page.wndl 2761} 2762 2763// Values returns the slice of values for the current page or nil if there are no values. 2764func (page WorkloadNetworkDhcpListPage) Values() []WorkloadNetworkDhcp { 2765 if page.wndl.IsEmpty() { 2766 return nil 2767 } 2768 return *page.wndl.Value 2769} 2770 2771// Creates a new instance of the WorkloadNetworkDhcpListPage type. 2772func NewWorkloadNetworkDhcpListPage(cur WorkloadNetworkDhcpList, getNextPage func(context.Context, WorkloadNetworkDhcpList) (WorkloadNetworkDhcpList, error)) WorkloadNetworkDhcpListPage { 2773 return WorkloadNetworkDhcpListPage{ 2774 fn: getNextPage, 2775 wndl: cur, 2776 } 2777} 2778 2779// WorkloadNetworkDhcpRelay NSX DHCP Relay 2780type WorkloadNetworkDhcpRelay struct { 2781 // ServerAddresses - DHCP Relay Addresses. Max 3. 2782 ServerAddresses *[]string `json:"serverAddresses,omitempty"` 2783 // DisplayName - Display name of the DHCP entity. 2784 DisplayName *string `json:"displayName,omitempty"` 2785 // Segments - READ-ONLY; NSX Segments consuming DHCP. 2786 Segments *[]string `json:"segments,omitempty"` 2787 // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'WorkloadNetworkDhcpProvisioningStateSucceeded', 'WorkloadNetworkDhcpProvisioningStateFailed', 'WorkloadNetworkDhcpProvisioningStateBuilding', 'WorkloadNetworkDhcpProvisioningStateDeleting', 'WorkloadNetworkDhcpProvisioningStateUpdating' 2788 ProvisioningState WorkloadNetworkDhcpProvisioningState `json:"provisioningState,omitempty"` 2789 // Revision - NSX revision number. 2790 Revision *int64 `json:"revision,omitempty"` 2791 // DhcpType - Possible values include: 'DhcpTypeWorkloadNetworkDhcpEntity', 'DhcpTypeSERVER', 'DhcpTypeRELAY' 2792 DhcpType DhcpType `json:"dhcpType,omitempty"` 2793} 2794 2795// MarshalJSON is the custom marshaler for WorkloadNetworkDhcpRelay. 2796func (wndr WorkloadNetworkDhcpRelay) MarshalJSON() ([]byte, error) { 2797 wndr.DhcpType = DhcpTypeRELAY 2798 objectMap := make(map[string]interface{}) 2799 if wndr.ServerAddresses != nil { 2800 objectMap["serverAddresses"] = wndr.ServerAddresses 2801 } 2802 if wndr.DisplayName != nil { 2803 objectMap["displayName"] = wndr.DisplayName 2804 } 2805 if wndr.Revision != nil { 2806 objectMap["revision"] = wndr.Revision 2807 } 2808 if wndr.DhcpType != "" { 2809 objectMap["dhcpType"] = wndr.DhcpType 2810 } 2811 return json.Marshal(objectMap) 2812} 2813 2814// AsWorkloadNetworkDhcpServer is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpRelay. 2815func (wndr WorkloadNetworkDhcpRelay) AsWorkloadNetworkDhcpServer() (*WorkloadNetworkDhcpServer, bool) { 2816 return nil, false 2817} 2818 2819// AsWorkloadNetworkDhcpRelay is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpRelay. 2820func (wndr WorkloadNetworkDhcpRelay) AsWorkloadNetworkDhcpRelay() (*WorkloadNetworkDhcpRelay, bool) { 2821 return &wndr, true 2822} 2823 2824// AsWorkloadNetworkDhcpEntity is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpRelay. 2825func (wndr WorkloadNetworkDhcpRelay) AsWorkloadNetworkDhcpEntity() (*WorkloadNetworkDhcpEntity, bool) { 2826 return nil, false 2827} 2828 2829// AsBasicWorkloadNetworkDhcpEntity is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpRelay. 2830func (wndr WorkloadNetworkDhcpRelay) AsBasicWorkloadNetworkDhcpEntity() (BasicWorkloadNetworkDhcpEntity, bool) { 2831 return &wndr, true 2832} 2833 2834// WorkloadNetworkDhcpServer NSX DHCP Server 2835type WorkloadNetworkDhcpServer struct { 2836 // ServerAddress - DHCP Server Address. 2837 ServerAddress *string `json:"serverAddress,omitempty"` 2838 // LeaseTime - DHCP Server Lease Time. 2839 LeaseTime *int64 `json:"leaseTime,omitempty"` 2840 // DisplayName - Display name of the DHCP entity. 2841 DisplayName *string `json:"displayName,omitempty"` 2842 // Segments - READ-ONLY; NSX Segments consuming DHCP. 2843 Segments *[]string `json:"segments,omitempty"` 2844 // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'WorkloadNetworkDhcpProvisioningStateSucceeded', 'WorkloadNetworkDhcpProvisioningStateFailed', 'WorkloadNetworkDhcpProvisioningStateBuilding', 'WorkloadNetworkDhcpProvisioningStateDeleting', 'WorkloadNetworkDhcpProvisioningStateUpdating' 2845 ProvisioningState WorkloadNetworkDhcpProvisioningState `json:"provisioningState,omitempty"` 2846 // Revision - NSX revision number. 2847 Revision *int64 `json:"revision,omitempty"` 2848 // DhcpType - Possible values include: 'DhcpTypeWorkloadNetworkDhcpEntity', 'DhcpTypeSERVER', 'DhcpTypeRELAY' 2849 DhcpType DhcpType `json:"dhcpType,omitempty"` 2850} 2851 2852// MarshalJSON is the custom marshaler for WorkloadNetworkDhcpServer. 2853func (wnds WorkloadNetworkDhcpServer) MarshalJSON() ([]byte, error) { 2854 wnds.DhcpType = DhcpTypeSERVER 2855 objectMap := make(map[string]interface{}) 2856 if wnds.ServerAddress != nil { 2857 objectMap["serverAddress"] = wnds.ServerAddress 2858 } 2859 if wnds.LeaseTime != nil { 2860 objectMap["leaseTime"] = wnds.LeaseTime 2861 } 2862 if wnds.DisplayName != nil { 2863 objectMap["displayName"] = wnds.DisplayName 2864 } 2865 if wnds.Revision != nil { 2866 objectMap["revision"] = wnds.Revision 2867 } 2868 if wnds.DhcpType != "" { 2869 objectMap["dhcpType"] = wnds.DhcpType 2870 } 2871 return json.Marshal(objectMap) 2872} 2873 2874// AsWorkloadNetworkDhcpServer is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpServer. 2875func (wnds WorkloadNetworkDhcpServer) AsWorkloadNetworkDhcpServer() (*WorkloadNetworkDhcpServer, bool) { 2876 return &wnds, true 2877} 2878 2879// AsWorkloadNetworkDhcpRelay is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpServer. 2880func (wnds WorkloadNetworkDhcpServer) AsWorkloadNetworkDhcpRelay() (*WorkloadNetworkDhcpRelay, bool) { 2881 return nil, false 2882} 2883 2884// AsWorkloadNetworkDhcpEntity is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpServer. 2885func (wnds WorkloadNetworkDhcpServer) AsWorkloadNetworkDhcpEntity() (*WorkloadNetworkDhcpEntity, bool) { 2886 return nil, false 2887} 2888 2889// AsBasicWorkloadNetworkDhcpEntity is the BasicWorkloadNetworkDhcpEntity implementation for WorkloadNetworkDhcpServer. 2890func (wnds WorkloadNetworkDhcpServer) AsBasicWorkloadNetworkDhcpEntity() (BasicWorkloadNetworkDhcpEntity, bool) { 2891 return &wnds, true 2892} 2893 2894// WorkloadNetworkGateway NSX Gateway. 2895type WorkloadNetworkGateway struct { 2896 autorest.Response `json:"-"` 2897 // WorkloadNetworkGatewayProperties - Gateway properties. 2898 *WorkloadNetworkGatewayProperties `json:"properties,omitempty"` 2899 // ID - READ-ONLY; Resource ID. 2900 ID *string `json:"id,omitempty"` 2901 // Name - READ-ONLY; Resource name. 2902 Name *string `json:"name,omitempty"` 2903 // Type - READ-ONLY; Resource type. 2904 Type *string `json:"type,omitempty"` 2905} 2906 2907// MarshalJSON is the custom marshaler for WorkloadNetworkGateway. 2908func (wng WorkloadNetworkGateway) MarshalJSON() ([]byte, error) { 2909 objectMap := make(map[string]interface{}) 2910 if wng.WorkloadNetworkGatewayProperties != nil { 2911 objectMap["properties"] = wng.WorkloadNetworkGatewayProperties 2912 } 2913 return json.Marshal(objectMap) 2914} 2915 2916// UnmarshalJSON is the custom unmarshaler for WorkloadNetworkGateway struct. 2917func (wng *WorkloadNetworkGateway) UnmarshalJSON(body []byte) error { 2918 var m map[string]*json.RawMessage 2919 err := json.Unmarshal(body, &m) 2920 if err != nil { 2921 return err 2922 } 2923 for k, v := range m { 2924 switch k { 2925 case "properties": 2926 if v != nil { 2927 var workloadNetworkGatewayProperties WorkloadNetworkGatewayProperties 2928 err = json.Unmarshal(*v, &workloadNetworkGatewayProperties) 2929 if err != nil { 2930 return err 2931 } 2932 wng.WorkloadNetworkGatewayProperties = &workloadNetworkGatewayProperties 2933 } 2934 case "id": 2935 if v != nil { 2936 var ID string 2937 err = json.Unmarshal(*v, &ID) 2938 if err != nil { 2939 return err 2940 } 2941 wng.ID = &ID 2942 } 2943 case "name": 2944 if v != nil { 2945 var name string 2946 err = json.Unmarshal(*v, &name) 2947 if err != nil { 2948 return err 2949 } 2950 wng.Name = &name 2951 } 2952 case "type": 2953 if v != nil { 2954 var typeVar string 2955 err = json.Unmarshal(*v, &typeVar) 2956 if err != nil { 2957 return err 2958 } 2959 wng.Type = &typeVar 2960 } 2961 } 2962 } 2963 2964 return nil 2965} 2966 2967// WorkloadNetworkGatewayList a list of NSX Gateways 2968type WorkloadNetworkGatewayList struct { 2969 autorest.Response `json:"-"` 2970 // Value - READ-ONLY; The items on the page 2971 Value *[]WorkloadNetworkGateway `json:"value,omitempty"` 2972 // NextLink - READ-ONLY; URL to get the next page if any 2973 NextLink *string `json:"nextLink,omitempty"` 2974} 2975 2976// MarshalJSON is the custom marshaler for WorkloadNetworkGatewayList. 2977func (wngl WorkloadNetworkGatewayList) MarshalJSON() ([]byte, error) { 2978 objectMap := make(map[string]interface{}) 2979 return json.Marshal(objectMap) 2980} 2981 2982// WorkloadNetworkGatewayListIterator provides access to a complete listing of WorkloadNetworkGateway 2983// values. 2984type WorkloadNetworkGatewayListIterator struct { 2985 i int 2986 page WorkloadNetworkGatewayListPage 2987} 2988 2989// NextWithContext advances to the next value. If there was an error making 2990// the request the iterator does not advance and the error is returned. 2991func (iter *WorkloadNetworkGatewayListIterator) NextWithContext(ctx context.Context) (err error) { 2992 if tracing.IsEnabled() { 2993 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkGatewayListIterator.NextWithContext") 2994 defer func() { 2995 sc := -1 2996 if iter.Response().Response.Response != nil { 2997 sc = iter.Response().Response.Response.StatusCode 2998 } 2999 tracing.EndSpan(ctx, sc, err) 3000 }() 3001 } 3002 iter.i++ 3003 if iter.i < len(iter.page.Values()) { 3004 return nil 3005 } 3006 err = iter.page.NextWithContext(ctx) 3007 if err != nil { 3008 iter.i-- 3009 return err 3010 } 3011 iter.i = 0 3012 return nil 3013} 3014 3015// Next advances to the next value. If there was an error making 3016// the request the iterator does not advance and the error is returned. 3017// Deprecated: Use NextWithContext() instead. 3018func (iter *WorkloadNetworkGatewayListIterator) Next() error { 3019 return iter.NextWithContext(context.Background()) 3020} 3021 3022// NotDone returns true if the enumeration should be started or is not yet complete. 3023func (iter WorkloadNetworkGatewayListIterator) NotDone() bool { 3024 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3025} 3026 3027// Response returns the raw server response from the last page request. 3028func (iter WorkloadNetworkGatewayListIterator) Response() WorkloadNetworkGatewayList { 3029 return iter.page.Response() 3030} 3031 3032// Value returns the current value or a zero-initialized value if the 3033// iterator has advanced beyond the end of the collection. 3034func (iter WorkloadNetworkGatewayListIterator) Value() WorkloadNetworkGateway { 3035 if !iter.page.NotDone() { 3036 return WorkloadNetworkGateway{} 3037 } 3038 return iter.page.Values()[iter.i] 3039} 3040 3041// Creates a new instance of the WorkloadNetworkGatewayListIterator type. 3042func NewWorkloadNetworkGatewayListIterator(page WorkloadNetworkGatewayListPage) WorkloadNetworkGatewayListIterator { 3043 return WorkloadNetworkGatewayListIterator{page: page} 3044} 3045 3046// IsEmpty returns true if the ListResult contains no values. 3047func (wngl WorkloadNetworkGatewayList) IsEmpty() bool { 3048 return wngl.Value == nil || len(*wngl.Value) == 0 3049} 3050 3051// hasNextLink returns true if the NextLink is not empty. 3052func (wngl WorkloadNetworkGatewayList) hasNextLink() bool { 3053 return wngl.NextLink != nil && len(*wngl.NextLink) != 0 3054} 3055 3056// workloadNetworkGatewayListPreparer prepares a request to retrieve the next set of results. 3057// It returns nil if no more results exist. 3058func (wngl WorkloadNetworkGatewayList) workloadNetworkGatewayListPreparer(ctx context.Context) (*http.Request, error) { 3059 if !wngl.hasNextLink() { 3060 return nil, nil 3061 } 3062 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3063 autorest.AsJSON(), 3064 autorest.AsGet(), 3065 autorest.WithBaseURL(to.String(wngl.NextLink))) 3066} 3067 3068// WorkloadNetworkGatewayListPage contains a page of WorkloadNetworkGateway values. 3069type WorkloadNetworkGatewayListPage struct { 3070 fn func(context.Context, WorkloadNetworkGatewayList) (WorkloadNetworkGatewayList, error) 3071 wngl WorkloadNetworkGatewayList 3072} 3073 3074// NextWithContext advances to the next page of values. If there was an error making 3075// the request the page does not advance and the error is returned. 3076func (page *WorkloadNetworkGatewayListPage) NextWithContext(ctx context.Context) (err error) { 3077 if tracing.IsEnabled() { 3078 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkGatewayListPage.NextWithContext") 3079 defer func() { 3080 sc := -1 3081 if page.Response().Response.Response != nil { 3082 sc = page.Response().Response.Response.StatusCode 3083 } 3084 tracing.EndSpan(ctx, sc, err) 3085 }() 3086 } 3087 for { 3088 next, err := page.fn(ctx, page.wngl) 3089 if err != nil { 3090 return err 3091 } 3092 page.wngl = next 3093 if !next.hasNextLink() || !next.IsEmpty() { 3094 break 3095 } 3096 } 3097 return nil 3098} 3099 3100// Next advances to the next page of values. If there was an error making 3101// the request the page does not advance and the error is returned. 3102// Deprecated: Use NextWithContext() instead. 3103func (page *WorkloadNetworkGatewayListPage) Next() error { 3104 return page.NextWithContext(context.Background()) 3105} 3106 3107// NotDone returns true if the page enumeration should be started or is not yet complete. 3108func (page WorkloadNetworkGatewayListPage) NotDone() bool { 3109 return !page.wngl.IsEmpty() 3110} 3111 3112// Response returns the raw server response from the last page request. 3113func (page WorkloadNetworkGatewayListPage) Response() WorkloadNetworkGatewayList { 3114 return page.wngl 3115} 3116 3117// Values returns the slice of values for the current page or nil if there are no values. 3118func (page WorkloadNetworkGatewayListPage) Values() []WorkloadNetworkGateway { 3119 if page.wngl.IsEmpty() { 3120 return nil 3121 } 3122 return *page.wngl.Value 3123} 3124 3125// Creates a new instance of the WorkloadNetworkGatewayListPage type. 3126func NewWorkloadNetworkGatewayListPage(cur WorkloadNetworkGatewayList, getNextPage func(context.Context, WorkloadNetworkGatewayList) (WorkloadNetworkGatewayList, error)) WorkloadNetworkGatewayListPage { 3127 return WorkloadNetworkGatewayListPage{ 3128 fn: getNextPage, 3129 wngl: cur, 3130 } 3131} 3132 3133// WorkloadNetworkGatewayProperties properties of a NSX Gateway. 3134type WorkloadNetworkGatewayProperties struct { 3135 // DisplayName - Display name of the DHCP entity. 3136 DisplayName *string `json:"displayName,omitempty"` 3137 // Path - READ-ONLY; NSX Gateway Path. 3138 Path *string `json:"path,omitempty"` 3139} 3140 3141// MarshalJSON is the custom marshaler for WorkloadNetworkGatewayProperties. 3142func (wngp WorkloadNetworkGatewayProperties) MarshalJSON() ([]byte, error) { 3143 objectMap := make(map[string]interface{}) 3144 if wngp.DisplayName != nil { 3145 objectMap["displayName"] = wngp.DisplayName 3146 } 3147 return json.Marshal(objectMap) 3148} 3149 3150// WorkloadNetworkPortMirroring NSX Port Mirroring 3151type WorkloadNetworkPortMirroring struct { 3152 autorest.Response `json:"-"` 3153 // WorkloadNetworkPortMirroringProperties - Port Mirroring Properties. 3154 *WorkloadNetworkPortMirroringProperties `json:"properties,omitempty"` 3155 // ID - READ-ONLY; Resource ID. 3156 ID *string `json:"id,omitempty"` 3157 // Name - READ-ONLY; Resource name. 3158 Name *string `json:"name,omitempty"` 3159 // Type - READ-ONLY; Resource type. 3160 Type *string `json:"type,omitempty"` 3161} 3162 3163// MarshalJSON is the custom marshaler for WorkloadNetworkPortMirroring. 3164func (wnpm WorkloadNetworkPortMirroring) MarshalJSON() ([]byte, error) { 3165 objectMap := make(map[string]interface{}) 3166 if wnpm.WorkloadNetworkPortMirroringProperties != nil { 3167 objectMap["properties"] = wnpm.WorkloadNetworkPortMirroringProperties 3168 } 3169 return json.Marshal(objectMap) 3170} 3171 3172// UnmarshalJSON is the custom unmarshaler for WorkloadNetworkPortMirroring struct. 3173func (wnpm *WorkloadNetworkPortMirroring) UnmarshalJSON(body []byte) error { 3174 var m map[string]*json.RawMessage 3175 err := json.Unmarshal(body, &m) 3176 if err != nil { 3177 return err 3178 } 3179 for k, v := range m { 3180 switch k { 3181 case "properties": 3182 if v != nil { 3183 var workloadNetworkPortMirroringProperties WorkloadNetworkPortMirroringProperties 3184 err = json.Unmarshal(*v, &workloadNetworkPortMirroringProperties) 3185 if err != nil { 3186 return err 3187 } 3188 wnpm.WorkloadNetworkPortMirroringProperties = &workloadNetworkPortMirroringProperties 3189 } 3190 case "id": 3191 if v != nil { 3192 var ID string 3193 err = json.Unmarshal(*v, &ID) 3194 if err != nil { 3195 return err 3196 } 3197 wnpm.ID = &ID 3198 } 3199 case "name": 3200 if v != nil { 3201 var name string 3202 err = json.Unmarshal(*v, &name) 3203 if err != nil { 3204 return err 3205 } 3206 wnpm.Name = &name 3207 } 3208 case "type": 3209 if v != nil { 3210 var typeVar string 3211 err = json.Unmarshal(*v, &typeVar) 3212 if err != nil { 3213 return err 3214 } 3215 wnpm.Type = &typeVar 3216 } 3217 } 3218 } 3219 3220 return nil 3221} 3222 3223// WorkloadNetworkPortMirroringList a list of NSX Port Mirroring 3224type WorkloadNetworkPortMirroringList struct { 3225 autorest.Response `json:"-"` 3226 // Value - READ-ONLY; The items on the page 3227 Value *[]WorkloadNetworkPortMirroring `json:"value,omitempty"` 3228 // NextLink - READ-ONLY; URL to get the next page if any 3229 NextLink *string `json:"nextLink,omitempty"` 3230} 3231 3232// MarshalJSON is the custom marshaler for WorkloadNetworkPortMirroringList. 3233func (wnpml WorkloadNetworkPortMirroringList) MarshalJSON() ([]byte, error) { 3234 objectMap := make(map[string]interface{}) 3235 return json.Marshal(objectMap) 3236} 3237 3238// WorkloadNetworkPortMirroringListIterator provides access to a complete listing of 3239// WorkloadNetworkPortMirroring values. 3240type WorkloadNetworkPortMirroringListIterator struct { 3241 i int 3242 page WorkloadNetworkPortMirroringListPage 3243} 3244 3245// NextWithContext advances to the next value. If there was an error making 3246// the request the iterator does not advance and the error is returned. 3247func (iter *WorkloadNetworkPortMirroringListIterator) NextWithContext(ctx context.Context) (err error) { 3248 if tracing.IsEnabled() { 3249 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkPortMirroringListIterator.NextWithContext") 3250 defer func() { 3251 sc := -1 3252 if iter.Response().Response.Response != nil { 3253 sc = iter.Response().Response.Response.StatusCode 3254 } 3255 tracing.EndSpan(ctx, sc, err) 3256 }() 3257 } 3258 iter.i++ 3259 if iter.i < len(iter.page.Values()) { 3260 return nil 3261 } 3262 err = iter.page.NextWithContext(ctx) 3263 if err != nil { 3264 iter.i-- 3265 return err 3266 } 3267 iter.i = 0 3268 return nil 3269} 3270 3271// Next advances to the next value. If there was an error making 3272// the request the iterator does not advance and the error is returned. 3273// Deprecated: Use NextWithContext() instead. 3274func (iter *WorkloadNetworkPortMirroringListIterator) Next() error { 3275 return iter.NextWithContext(context.Background()) 3276} 3277 3278// NotDone returns true if the enumeration should be started or is not yet complete. 3279func (iter WorkloadNetworkPortMirroringListIterator) NotDone() bool { 3280 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3281} 3282 3283// Response returns the raw server response from the last page request. 3284func (iter WorkloadNetworkPortMirroringListIterator) Response() WorkloadNetworkPortMirroringList { 3285 return iter.page.Response() 3286} 3287 3288// Value returns the current value or a zero-initialized value if the 3289// iterator has advanced beyond the end of the collection. 3290func (iter WorkloadNetworkPortMirroringListIterator) Value() WorkloadNetworkPortMirroring { 3291 if !iter.page.NotDone() { 3292 return WorkloadNetworkPortMirroring{} 3293 } 3294 return iter.page.Values()[iter.i] 3295} 3296 3297// Creates a new instance of the WorkloadNetworkPortMirroringListIterator type. 3298func NewWorkloadNetworkPortMirroringListIterator(page WorkloadNetworkPortMirroringListPage) WorkloadNetworkPortMirroringListIterator { 3299 return WorkloadNetworkPortMirroringListIterator{page: page} 3300} 3301 3302// IsEmpty returns true if the ListResult contains no values. 3303func (wnpml WorkloadNetworkPortMirroringList) IsEmpty() bool { 3304 return wnpml.Value == nil || len(*wnpml.Value) == 0 3305} 3306 3307// hasNextLink returns true if the NextLink is not empty. 3308func (wnpml WorkloadNetworkPortMirroringList) hasNextLink() bool { 3309 return wnpml.NextLink != nil && len(*wnpml.NextLink) != 0 3310} 3311 3312// workloadNetworkPortMirroringListPreparer prepares a request to retrieve the next set of results. 3313// It returns nil if no more results exist. 3314func (wnpml WorkloadNetworkPortMirroringList) workloadNetworkPortMirroringListPreparer(ctx context.Context) (*http.Request, error) { 3315 if !wnpml.hasNextLink() { 3316 return nil, nil 3317 } 3318 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3319 autorest.AsJSON(), 3320 autorest.AsGet(), 3321 autorest.WithBaseURL(to.String(wnpml.NextLink))) 3322} 3323 3324// WorkloadNetworkPortMirroringListPage contains a page of WorkloadNetworkPortMirroring values. 3325type WorkloadNetworkPortMirroringListPage struct { 3326 fn func(context.Context, WorkloadNetworkPortMirroringList) (WorkloadNetworkPortMirroringList, error) 3327 wnpml WorkloadNetworkPortMirroringList 3328} 3329 3330// NextWithContext advances to the next page of values. If there was an error making 3331// the request the page does not advance and the error is returned. 3332func (page *WorkloadNetworkPortMirroringListPage) NextWithContext(ctx context.Context) (err error) { 3333 if tracing.IsEnabled() { 3334 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkPortMirroringListPage.NextWithContext") 3335 defer func() { 3336 sc := -1 3337 if page.Response().Response.Response != nil { 3338 sc = page.Response().Response.Response.StatusCode 3339 } 3340 tracing.EndSpan(ctx, sc, err) 3341 }() 3342 } 3343 for { 3344 next, err := page.fn(ctx, page.wnpml) 3345 if err != nil { 3346 return err 3347 } 3348 page.wnpml = next 3349 if !next.hasNextLink() || !next.IsEmpty() { 3350 break 3351 } 3352 } 3353 return nil 3354} 3355 3356// Next advances to the next page of values. If there was an error making 3357// the request the page does not advance and the error is returned. 3358// Deprecated: Use NextWithContext() instead. 3359func (page *WorkloadNetworkPortMirroringListPage) Next() error { 3360 return page.NextWithContext(context.Background()) 3361} 3362 3363// NotDone returns true if the page enumeration should be started or is not yet complete. 3364func (page WorkloadNetworkPortMirroringListPage) NotDone() bool { 3365 return !page.wnpml.IsEmpty() 3366} 3367 3368// Response returns the raw server response from the last page request. 3369func (page WorkloadNetworkPortMirroringListPage) Response() WorkloadNetworkPortMirroringList { 3370 return page.wnpml 3371} 3372 3373// Values returns the slice of values for the current page or nil if there are no values. 3374func (page WorkloadNetworkPortMirroringListPage) Values() []WorkloadNetworkPortMirroring { 3375 if page.wnpml.IsEmpty() { 3376 return nil 3377 } 3378 return *page.wnpml.Value 3379} 3380 3381// Creates a new instance of the WorkloadNetworkPortMirroringListPage type. 3382func NewWorkloadNetworkPortMirroringListPage(cur WorkloadNetworkPortMirroringList, getNextPage func(context.Context, WorkloadNetworkPortMirroringList) (WorkloadNetworkPortMirroringList, error)) WorkloadNetworkPortMirroringListPage { 3383 return WorkloadNetworkPortMirroringListPage{ 3384 fn: getNextPage, 3385 wnpml: cur, 3386 } 3387} 3388 3389// WorkloadNetworkPortMirroringProperties NSX Port Mirroring Properties 3390type WorkloadNetworkPortMirroringProperties struct { 3391 // DisplayName - Display name of the port mirroring profile. 3392 DisplayName *string `json:"displayName,omitempty"` 3393 // Direction - Direction of port mirroring profile. Possible values include: 'INGRESSEGRESSBIDIRECTIONAL' 3394 Direction PortMirroringDirectionEnum `json:"direction,omitempty"` 3395 // Source - Source VM Group. 3396 Source *string `json:"source,omitempty"` 3397 // Destination - Destination VM Group. 3398 Destination *string `json:"destination,omitempty"` 3399 // Status - READ-ONLY; Port Mirroring Status. Possible values include: 'SUCCESSFAILURE' 3400 Status PortMirroringStatusEnum `json:"status,omitempty"` 3401 // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'WorkloadNetworkPortMirroringProvisioningStateSucceeded', 'WorkloadNetworkPortMirroringProvisioningStateFailed', 'WorkloadNetworkPortMirroringProvisioningStateBuilding', 'WorkloadNetworkPortMirroringProvisioningStateDeleting', 'WorkloadNetworkPortMirroringProvisioningStateUpdating' 3402 ProvisioningState WorkloadNetworkPortMirroringProvisioningState `json:"provisioningState,omitempty"` 3403 // Revision - NSX revision number. 3404 Revision *int64 `json:"revision,omitempty"` 3405} 3406 3407// MarshalJSON is the custom marshaler for WorkloadNetworkPortMirroringProperties. 3408func (wnpmp WorkloadNetworkPortMirroringProperties) MarshalJSON() ([]byte, error) { 3409 objectMap := make(map[string]interface{}) 3410 if wnpmp.DisplayName != nil { 3411 objectMap["displayName"] = wnpmp.DisplayName 3412 } 3413 if wnpmp.Direction != "" { 3414 objectMap["direction"] = wnpmp.Direction 3415 } 3416 if wnpmp.Source != nil { 3417 objectMap["source"] = wnpmp.Source 3418 } 3419 if wnpmp.Destination != nil { 3420 objectMap["destination"] = wnpmp.Destination 3421 } 3422 if wnpmp.Revision != nil { 3423 objectMap["revision"] = wnpmp.Revision 3424 } 3425 return json.Marshal(objectMap) 3426} 3427 3428// WorkloadNetworksCreateDhcpFuture an abstraction for monitoring and retrieving the results of a 3429// long-running operation. 3430type WorkloadNetworksCreateDhcpFuture struct { 3431 azure.FutureAPI 3432 // Result returns the result of the asynchronous operation. 3433 // If the operation has not completed it will return an error. 3434 Result func(WorkloadNetworksClient) (WorkloadNetworkDhcp, error) 3435} 3436 3437// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3438func (future *WorkloadNetworksCreateDhcpFuture) UnmarshalJSON(body []byte) error { 3439 var azFuture azure.Future 3440 if err := json.Unmarshal(body, &azFuture); err != nil { 3441 return err 3442 } 3443 future.FutureAPI = &azFuture 3444 future.Result = future.result 3445 return nil 3446} 3447 3448// result is the default implementation for WorkloadNetworksCreateDhcpFuture.Result. 3449func (future *WorkloadNetworksCreateDhcpFuture) result(client WorkloadNetworksClient) (wnd WorkloadNetworkDhcp, err error) { 3450 var done bool 3451 done, err = future.DoneWithContext(context.Background(), client) 3452 if err != nil { 3453 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksCreateDhcpFuture", "Result", future.Response(), "Polling failure") 3454 return 3455 } 3456 if !done { 3457 wnd.Response.Response = future.Response() 3458 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksCreateDhcpFuture") 3459 return 3460 } 3461 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3462 if wnd.Response.Response, err = future.GetResult(sender); err == nil && wnd.Response.Response.StatusCode != http.StatusNoContent { 3463 wnd, err = client.CreateDhcpResponder(wnd.Response.Response) 3464 if err != nil { 3465 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksCreateDhcpFuture", "Result", wnd.Response.Response, "Failure responding to request") 3466 } 3467 } 3468 return 3469} 3470 3471// WorkloadNetworksCreatePortMirroringFuture an abstraction for monitoring and retrieving the results of a 3472// long-running operation. 3473type WorkloadNetworksCreatePortMirroringFuture struct { 3474 azure.FutureAPI 3475 // Result returns the result of the asynchronous operation. 3476 // If the operation has not completed it will return an error. 3477 Result func(WorkloadNetworksClient) (WorkloadNetworkPortMirroring, error) 3478} 3479 3480// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3481func (future *WorkloadNetworksCreatePortMirroringFuture) UnmarshalJSON(body []byte) error { 3482 var azFuture azure.Future 3483 if err := json.Unmarshal(body, &azFuture); err != nil { 3484 return err 3485 } 3486 future.FutureAPI = &azFuture 3487 future.Result = future.result 3488 return nil 3489} 3490 3491// result is the default implementation for WorkloadNetworksCreatePortMirroringFuture.Result. 3492func (future *WorkloadNetworksCreatePortMirroringFuture) result(client WorkloadNetworksClient) (wnpm WorkloadNetworkPortMirroring, err error) { 3493 var done bool 3494 done, err = future.DoneWithContext(context.Background(), client) 3495 if err != nil { 3496 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksCreatePortMirroringFuture", "Result", future.Response(), "Polling failure") 3497 return 3498 } 3499 if !done { 3500 wnpm.Response.Response = future.Response() 3501 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksCreatePortMirroringFuture") 3502 return 3503 } 3504 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3505 if wnpm.Response.Response, err = future.GetResult(sender); err == nil && wnpm.Response.Response.StatusCode != http.StatusNoContent { 3506 wnpm, err = client.CreatePortMirroringResponder(wnpm.Response.Response) 3507 if err != nil { 3508 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksCreatePortMirroringFuture", "Result", wnpm.Response.Response, "Failure responding to request") 3509 } 3510 } 3511 return 3512} 3513 3514// WorkloadNetworksCreateSegmentsFuture an abstraction for monitoring and retrieving the results of a 3515// long-running operation. 3516type WorkloadNetworksCreateSegmentsFuture struct { 3517 azure.FutureAPI 3518 // Result returns the result of the asynchronous operation. 3519 // If the operation has not completed it will return an error. 3520 Result func(WorkloadNetworksClient) (WorkloadNetworkSegment, error) 3521} 3522 3523// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3524func (future *WorkloadNetworksCreateSegmentsFuture) UnmarshalJSON(body []byte) error { 3525 var azFuture azure.Future 3526 if err := json.Unmarshal(body, &azFuture); err != nil { 3527 return err 3528 } 3529 future.FutureAPI = &azFuture 3530 future.Result = future.result 3531 return nil 3532} 3533 3534// result is the default implementation for WorkloadNetworksCreateSegmentsFuture.Result. 3535func (future *WorkloadNetworksCreateSegmentsFuture) result(client WorkloadNetworksClient) (wns WorkloadNetworkSegment, err error) { 3536 var done bool 3537 done, err = future.DoneWithContext(context.Background(), client) 3538 if err != nil { 3539 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksCreateSegmentsFuture", "Result", future.Response(), "Polling failure") 3540 return 3541 } 3542 if !done { 3543 wns.Response.Response = future.Response() 3544 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksCreateSegmentsFuture") 3545 return 3546 } 3547 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3548 if wns.Response.Response, err = future.GetResult(sender); err == nil && wns.Response.Response.StatusCode != http.StatusNoContent { 3549 wns, err = client.CreateSegmentsResponder(wns.Response.Response) 3550 if err != nil { 3551 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksCreateSegmentsFuture", "Result", wns.Response.Response, "Failure responding to request") 3552 } 3553 } 3554 return 3555} 3556 3557// WorkloadNetworksCreateVMGroupFuture an abstraction for monitoring and retrieving the results of a 3558// long-running operation. 3559type WorkloadNetworksCreateVMGroupFuture struct { 3560 azure.FutureAPI 3561 // Result returns the result of the asynchronous operation. 3562 // If the operation has not completed it will return an error. 3563 Result func(WorkloadNetworksClient) (WorkloadNetworkVMGroup, error) 3564} 3565 3566// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3567func (future *WorkloadNetworksCreateVMGroupFuture) UnmarshalJSON(body []byte) error { 3568 var azFuture azure.Future 3569 if err := json.Unmarshal(body, &azFuture); err != nil { 3570 return err 3571 } 3572 future.FutureAPI = &azFuture 3573 future.Result = future.result 3574 return nil 3575} 3576 3577// result is the default implementation for WorkloadNetworksCreateVMGroupFuture.Result. 3578func (future *WorkloadNetworksCreateVMGroupFuture) result(client WorkloadNetworksClient) (wnvg WorkloadNetworkVMGroup, err error) { 3579 var done bool 3580 done, err = future.DoneWithContext(context.Background(), client) 3581 if err != nil { 3582 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksCreateVMGroupFuture", "Result", future.Response(), "Polling failure") 3583 return 3584 } 3585 if !done { 3586 wnvg.Response.Response = future.Response() 3587 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksCreateVMGroupFuture") 3588 return 3589 } 3590 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3591 if wnvg.Response.Response, err = future.GetResult(sender); err == nil && wnvg.Response.Response.StatusCode != http.StatusNoContent { 3592 wnvg, err = client.CreateVMGroupResponder(wnvg.Response.Response) 3593 if err != nil { 3594 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksCreateVMGroupFuture", "Result", wnvg.Response.Response, "Failure responding to request") 3595 } 3596 } 3597 return 3598} 3599 3600// WorkloadNetworksDeleteDhcpFuture an abstraction for monitoring and retrieving the results of a 3601// long-running operation. 3602type WorkloadNetworksDeleteDhcpFuture struct { 3603 azure.FutureAPI 3604 // Result returns the result of the asynchronous operation. 3605 // If the operation has not completed it will return an error. 3606 Result func(WorkloadNetworksClient) (autorest.Response, error) 3607} 3608 3609// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3610func (future *WorkloadNetworksDeleteDhcpFuture) UnmarshalJSON(body []byte) error { 3611 var azFuture azure.Future 3612 if err := json.Unmarshal(body, &azFuture); err != nil { 3613 return err 3614 } 3615 future.FutureAPI = &azFuture 3616 future.Result = future.result 3617 return nil 3618} 3619 3620// result is the default implementation for WorkloadNetworksDeleteDhcpFuture.Result. 3621func (future *WorkloadNetworksDeleteDhcpFuture) result(client WorkloadNetworksClient) (ar autorest.Response, err error) { 3622 var done bool 3623 done, err = future.DoneWithContext(context.Background(), client) 3624 if err != nil { 3625 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksDeleteDhcpFuture", "Result", future.Response(), "Polling failure") 3626 return 3627 } 3628 if !done { 3629 ar.Response = future.Response() 3630 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksDeleteDhcpFuture") 3631 return 3632 } 3633 ar.Response = future.Response() 3634 return 3635} 3636 3637// WorkloadNetworksDeletePortMirroringFuture an abstraction for monitoring and retrieving the results of a 3638// long-running operation. 3639type WorkloadNetworksDeletePortMirroringFuture struct { 3640 azure.FutureAPI 3641 // Result returns the result of the asynchronous operation. 3642 // If the operation has not completed it will return an error. 3643 Result func(WorkloadNetworksClient) (autorest.Response, error) 3644} 3645 3646// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3647func (future *WorkloadNetworksDeletePortMirroringFuture) UnmarshalJSON(body []byte) error { 3648 var azFuture azure.Future 3649 if err := json.Unmarshal(body, &azFuture); err != nil { 3650 return err 3651 } 3652 future.FutureAPI = &azFuture 3653 future.Result = future.result 3654 return nil 3655} 3656 3657// result is the default implementation for WorkloadNetworksDeletePortMirroringFuture.Result. 3658func (future *WorkloadNetworksDeletePortMirroringFuture) result(client WorkloadNetworksClient) (ar autorest.Response, err error) { 3659 var done bool 3660 done, err = future.DoneWithContext(context.Background(), client) 3661 if err != nil { 3662 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksDeletePortMirroringFuture", "Result", future.Response(), "Polling failure") 3663 return 3664 } 3665 if !done { 3666 ar.Response = future.Response() 3667 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksDeletePortMirroringFuture") 3668 return 3669 } 3670 ar.Response = future.Response() 3671 return 3672} 3673 3674// WorkloadNetworksDeleteSegmentFuture an abstraction for monitoring and retrieving the results of a 3675// long-running operation. 3676type WorkloadNetworksDeleteSegmentFuture struct { 3677 azure.FutureAPI 3678 // Result returns the result of the asynchronous operation. 3679 // If the operation has not completed it will return an error. 3680 Result func(WorkloadNetworksClient) (autorest.Response, error) 3681} 3682 3683// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3684func (future *WorkloadNetworksDeleteSegmentFuture) UnmarshalJSON(body []byte) error { 3685 var azFuture azure.Future 3686 if err := json.Unmarshal(body, &azFuture); err != nil { 3687 return err 3688 } 3689 future.FutureAPI = &azFuture 3690 future.Result = future.result 3691 return nil 3692} 3693 3694// result is the default implementation for WorkloadNetworksDeleteSegmentFuture.Result. 3695func (future *WorkloadNetworksDeleteSegmentFuture) result(client WorkloadNetworksClient) (ar autorest.Response, err error) { 3696 var done bool 3697 done, err = future.DoneWithContext(context.Background(), client) 3698 if err != nil { 3699 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksDeleteSegmentFuture", "Result", future.Response(), "Polling failure") 3700 return 3701 } 3702 if !done { 3703 ar.Response = future.Response() 3704 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksDeleteSegmentFuture") 3705 return 3706 } 3707 ar.Response = future.Response() 3708 return 3709} 3710 3711// WorkloadNetworksDeleteVMGroupFuture an abstraction for monitoring and retrieving the results of a 3712// long-running operation. 3713type WorkloadNetworksDeleteVMGroupFuture struct { 3714 azure.FutureAPI 3715 // Result returns the result of the asynchronous operation. 3716 // If the operation has not completed it will return an error. 3717 Result func(WorkloadNetworksClient) (autorest.Response, error) 3718} 3719 3720// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3721func (future *WorkloadNetworksDeleteVMGroupFuture) UnmarshalJSON(body []byte) error { 3722 var azFuture azure.Future 3723 if err := json.Unmarshal(body, &azFuture); err != nil { 3724 return err 3725 } 3726 future.FutureAPI = &azFuture 3727 future.Result = future.result 3728 return nil 3729} 3730 3731// result is the default implementation for WorkloadNetworksDeleteVMGroupFuture.Result. 3732func (future *WorkloadNetworksDeleteVMGroupFuture) result(client WorkloadNetworksClient) (ar autorest.Response, err error) { 3733 var done bool 3734 done, err = future.DoneWithContext(context.Background(), client) 3735 if err != nil { 3736 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksDeleteVMGroupFuture", "Result", future.Response(), "Polling failure") 3737 return 3738 } 3739 if !done { 3740 ar.Response = future.Response() 3741 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksDeleteVMGroupFuture") 3742 return 3743 } 3744 ar.Response = future.Response() 3745 return 3746} 3747 3748// WorkloadNetworkSegment NSX Segment 3749type WorkloadNetworkSegment struct { 3750 autorest.Response `json:"-"` 3751 // WorkloadNetworkSegmentProperties - The properties of a Workload Segment proxy resource. 3752 *WorkloadNetworkSegmentProperties `json:"properties,omitempty"` 3753 // ID - READ-ONLY; Resource ID. 3754 ID *string `json:"id,omitempty"` 3755 // Name - READ-ONLY; Resource name. 3756 Name *string `json:"name,omitempty"` 3757 // Type - READ-ONLY; Resource type. 3758 Type *string `json:"type,omitempty"` 3759} 3760 3761// MarshalJSON is the custom marshaler for WorkloadNetworkSegment. 3762func (wns WorkloadNetworkSegment) MarshalJSON() ([]byte, error) { 3763 objectMap := make(map[string]interface{}) 3764 if wns.WorkloadNetworkSegmentProperties != nil { 3765 objectMap["properties"] = wns.WorkloadNetworkSegmentProperties 3766 } 3767 return json.Marshal(objectMap) 3768} 3769 3770// UnmarshalJSON is the custom unmarshaler for WorkloadNetworkSegment struct. 3771func (wns *WorkloadNetworkSegment) UnmarshalJSON(body []byte) error { 3772 var m map[string]*json.RawMessage 3773 err := json.Unmarshal(body, &m) 3774 if err != nil { 3775 return err 3776 } 3777 for k, v := range m { 3778 switch k { 3779 case "properties": 3780 if v != nil { 3781 var workloadNetworkSegmentProperties WorkloadNetworkSegmentProperties 3782 err = json.Unmarshal(*v, &workloadNetworkSegmentProperties) 3783 if err != nil { 3784 return err 3785 } 3786 wns.WorkloadNetworkSegmentProperties = &workloadNetworkSegmentProperties 3787 } 3788 case "id": 3789 if v != nil { 3790 var ID string 3791 err = json.Unmarshal(*v, &ID) 3792 if err != nil { 3793 return err 3794 } 3795 wns.ID = &ID 3796 } 3797 case "name": 3798 if v != nil { 3799 var name string 3800 err = json.Unmarshal(*v, &name) 3801 if err != nil { 3802 return err 3803 } 3804 wns.Name = &name 3805 } 3806 case "type": 3807 if v != nil { 3808 var typeVar string 3809 err = json.Unmarshal(*v, &typeVar) 3810 if err != nil { 3811 return err 3812 } 3813 wns.Type = &typeVar 3814 } 3815 } 3816 } 3817 3818 return nil 3819} 3820 3821// WorkloadNetworkSegmentPortVif ports and any VIF attached to segment. 3822type WorkloadNetworkSegmentPortVif struct { 3823 // PortName - Name of port or VIF attached to segment. 3824 PortName *string `json:"portName,omitempty"` 3825} 3826 3827// WorkloadNetworkSegmentProperties NSX Segment Properties 3828type WorkloadNetworkSegmentProperties struct { 3829 // DisplayName - Display name of the segment. 3830 DisplayName *string `json:"displayName,omitempty"` 3831 // ConnectedGateway - Gateway which to connect segment to. 3832 ConnectedGateway *string `json:"connectedGateway,omitempty"` 3833 // Subnet - Subnet which to connect segment to. 3834 Subnet *WorkloadNetworkSegmentSubnet `json:"subnet,omitempty"` 3835 // PortVif - READ-ONLY; Port Vif which segment is associated with. 3836 PortVif *[]WorkloadNetworkSegmentPortVif `json:"portVif,omitempty"` 3837 // Status - READ-ONLY; Segment status. Possible values include: 'SegmentStatusEnumSUCCESSFAILURE' 3838 Status SegmentStatusEnum `json:"status,omitempty"` 3839 // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'WorkloadNetworkSegmentProvisioningStateSucceeded', 'WorkloadNetworkSegmentProvisioningStateFailed', 'WorkloadNetworkSegmentProvisioningStateBuilding', 'WorkloadNetworkSegmentProvisioningStateDeleting', 'WorkloadNetworkSegmentProvisioningStateUpdating' 3840 ProvisioningState WorkloadNetworkSegmentProvisioningState `json:"provisioningState,omitempty"` 3841 // Revision - NSX revision number. 3842 Revision *int64 `json:"revision,omitempty"` 3843} 3844 3845// MarshalJSON is the custom marshaler for WorkloadNetworkSegmentProperties. 3846func (wnsp WorkloadNetworkSegmentProperties) MarshalJSON() ([]byte, error) { 3847 objectMap := make(map[string]interface{}) 3848 if wnsp.DisplayName != nil { 3849 objectMap["displayName"] = wnsp.DisplayName 3850 } 3851 if wnsp.ConnectedGateway != nil { 3852 objectMap["connectedGateway"] = wnsp.ConnectedGateway 3853 } 3854 if wnsp.Subnet != nil { 3855 objectMap["subnet"] = wnsp.Subnet 3856 } 3857 if wnsp.Revision != nil { 3858 objectMap["revision"] = wnsp.Revision 3859 } 3860 return json.Marshal(objectMap) 3861} 3862 3863// WorkloadNetworkSegmentsList a list of NSX Segments 3864type WorkloadNetworkSegmentsList struct { 3865 autorest.Response `json:"-"` 3866 // Value - READ-ONLY; The items on the page 3867 Value *[]WorkloadNetworkSegment `json:"value,omitempty"` 3868 // NextLink - READ-ONLY; URL to get the next page if any 3869 NextLink *string `json:"nextLink,omitempty"` 3870} 3871 3872// MarshalJSON is the custom marshaler for WorkloadNetworkSegmentsList. 3873func (wnsl WorkloadNetworkSegmentsList) MarshalJSON() ([]byte, error) { 3874 objectMap := make(map[string]interface{}) 3875 return json.Marshal(objectMap) 3876} 3877 3878// WorkloadNetworkSegmentsListIterator provides access to a complete listing of WorkloadNetworkSegment 3879// values. 3880type WorkloadNetworkSegmentsListIterator struct { 3881 i int 3882 page WorkloadNetworkSegmentsListPage 3883} 3884 3885// NextWithContext advances to the next value. If there was an error making 3886// the request the iterator does not advance and the error is returned. 3887func (iter *WorkloadNetworkSegmentsListIterator) NextWithContext(ctx context.Context) (err error) { 3888 if tracing.IsEnabled() { 3889 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkSegmentsListIterator.NextWithContext") 3890 defer func() { 3891 sc := -1 3892 if iter.Response().Response.Response != nil { 3893 sc = iter.Response().Response.Response.StatusCode 3894 } 3895 tracing.EndSpan(ctx, sc, err) 3896 }() 3897 } 3898 iter.i++ 3899 if iter.i < len(iter.page.Values()) { 3900 return nil 3901 } 3902 err = iter.page.NextWithContext(ctx) 3903 if err != nil { 3904 iter.i-- 3905 return err 3906 } 3907 iter.i = 0 3908 return nil 3909} 3910 3911// Next advances to the next value. If there was an error making 3912// the request the iterator does not advance and the error is returned. 3913// Deprecated: Use NextWithContext() instead. 3914func (iter *WorkloadNetworkSegmentsListIterator) Next() error { 3915 return iter.NextWithContext(context.Background()) 3916} 3917 3918// NotDone returns true if the enumeration should be started or is not yet complete. 3919func (iter WorkloadNetworkSegmentsListIterator) NotDone() bool { 3920 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3921} 3922 3923// Response returns the raw server response from the last page request. 3924func (iter WorkloadNetworkSegmentsListIterator) Response() WorkloadNetworkSegmentsList { 3925 return iter.page.Response() 3926} 3927 3928// Value returns the current value or a zero-initialized value if the 3929// iterator has advanced beyond the end of the collection. 3930func (iter WorkloadNetworkSegmentsListIterator) Value() WorkloadNetworkSegment { 3931 if !iter.page.NotDone() { 3932 return WorkloadNetworkSegment{} 3933 } 3934 return iter.page.Values()[iter.i] 3935} 3936 3937// Creates a new instance of the WorkloadNetworkSegmentsListIterator type. 3938func NewWorkloadNetworkSegmentsListIterator(page WorkloadNetworkSegmentsListPage) WorkloadNetworkSegmentsListIterator { 3939 return WorkloadNetworkSegmentsListIterator{page: page} 3940} 3941 3942// IsEmpty returns true if the ListResult contains no values. 3943func (wnsl WorkloadNetworkSegmentsList) IsEmpty() bool { 3944 return wnsl.Value == nil || len(*wnsl.Value) == 0 3945} 3946 3947// hasNextLink returns true if the NextLink is not empty. 3948func (wnsl WorkloadNetworkSegmentsList) hasNextLink() bool { 3949 return wnsl.NextLink != nil && len(*wnsl.NextLink) != 0 3950} 3951 3952// workloadNetworkSegmentsListPreparer prepares a request to retrieve the next set of results. 3953// It returns nil if no more results exist. 3954func (wnsl WorkloadNetworkSegmentsList) workloadNetworkSegmentsListPreparer(ctx context.Context) (*http.Request, error) { 3955 if !wnsl.hasNextLink() { 3956 return nil, nil 3957 } 3958 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3959 autorest.AsJSON(), 3960 autorest.AsGet(), 3961 autorest.WithBaseURL(to.String(wnsl.NextLink))) 3962} 3963 3964// WorkloadNetworkSegmentsListPage contains a page of WorkloadNetworkSegment values. 3965type WorkloadNetworkSegmentsListPage struct { 3966 fn func(context.Context, WorkloadNetworkSegmentsList) (WorkloadNetworkSegmentsList, error) 3967 wnsl WorkloadNetworkSegmentsList 3968} 3969 3970// NextWithContext advances to the next page of values. If there was an error making 3971// the request the page does not advance and the error is returned. 3972func (page *WorkloadNetworkSegmentsListPage) NextWithContext(ctx context.Context) (err error) { 3973 if tracing.IsEnabled() { 3974 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkSegmentsListPage.NextWithContext") 3975 defer func() { 3976 sc := -1 3977 if page.Response().Response.Response != nil { 3978 sc = page.Response().Response.Response.StatusCode 3979 } 3980 tracing.EndSpan(ctx, sc, err) 3981 }() 3982 } 3983 for { 3984 next, err := page.fn(ctx, page.wnsl) 3985 if err != nil { 3986 return err 3987 } 3988 page.wnsl = next 3989 if !next.hasNextLink() || !next.IsEmpty() { 3990 break 3991 } 3992 } 3993 return nil 3994} 3995 3996// Next advances to the next page of values. If there was an error making 3997// the request the page does not advance and the error is returned. 3998// Deprecated: Use NextWithContext() instead. 3999func (page *WorkloadNetworkSegmentsListPage) Next() error { 4000 return page.NextWithContext(context.Background()) 4001} 4002 4003// NotDone returns true if the page enumeration should be started or is not yet complete. 4004func (page WorkloadNetworkSegmentsListPage) NotDone() bool { 4005 return !page.wnsl.IsEmpty() 4006} 4007 4008// Response returns the raw server response from the last page request. 4009func (page WorkloadNetworkSegmentsListPage) Response() WorkloadNetworkSegmentsList { 4010 return page.wnsl 4011} 4012 4013// Values returns the slice of values for the current page or nil if there are no values. 4014func (page WorkloadNetworkSegmentsListPage) Values() []WorkloadNetworkSegment { 4015 if page.wnsl.IsEmpty() { 4016 return nil 4017 } 4018 return *page.wnsl.Value 4019} 4020 4021// Creates a new instance of the WorkloadNetworkSegmentsListPage type. 4022func NewWorkloadNetworkSegmentsListPage(cur WorkloadNetworkSegmentsList, getNextPage func(context.Context, WorkloadNetworkSegmentsList) (WorkloadNetworkSegmentsList, error)) WorkloadNetworkSegmentsListPage { 4023 return WorkloadNetworkSegmentsListPage{ 4024 fn: getNextPage, 4025 wnsl: cur, 4026 } 4027} 4028 4029// WorkloadNetworkSegmentSubnet subnet configuration for segment 4030type WorkloadNetworkSegmentSubnet struct { 4031 // DhcpRanges - DHCP Range assigned for subnet. 4032 DhcpRanges *[]string `json:"dhcpRanges,omitempty"` 4033 // GatewayAddress - Gateway address. 4034 GatewayAddress *string `json:"gatewayAddress,omitempty"` 4035} 4036 4037// WorkloadNetworksUpdateDhcpFuture an abstraction for monitoring and retrieving the results of a 4038// long-running operation. 4039type WorkloadNetworksUpdateDhcpFuture struct { 4040 azure.FutureAPI 4041 // Result returns the result of the asynchronous operation. 4042 // If the operation has not completed it will return an error. 4043 Result func(WorkloadNetworksClient) (WorkloadNetworkDhcp, error) 4044} 4045 4046// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4047func (future *WorkloadNetworksUpdateDhcpFuture) UnmarshalJSON(body []byte) error { 4048 var azFuture azure.Future 4049 if err := json.Unmarshal(body, &azFuture); err != nil { 4050 return err 4051 } 4052 future.FutureAPI = &azFuture 4053 future.Result = future.result 4054 return nil 4055} 4056 4057// result is the default implementation for WorkloadNetworksUpdateDhcpFuture.Result. 4058func (future *WorkloadNetworksUpdateDhcpFuture) result(client WorkloadNetworksClient) (wnd WorkloadNetworkDhcp, err error) { 4059 var done bool 4060 done, err = future.DoneWithContext(context.Background(), client) 4061 if err != nil { 4062 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksUpdateDhcpFuture", "Result", future.Response(), "Polling failure") 4063 return 4064 } 4065 if !done { 4066 wnd.Response.Response = future.Response() 4067 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksUpdateDhcpFuture") 4068 return 4069 } 4070 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4071 if wnd.Response.Response, err = future.GetResult(sender); err == nil && wnd.Response.Response.StatusCode != http.StatusNoContent { 4072 wnd, err = client.UpdateDhcpResponder(wnd.Response.Response) 4073 if err != nil { 4074 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksUpdateDhcpFuture", "Result", wnd.Response.Response, "Failure responding to request") 4075 } 4076 } 4077 return 4078} 4079 4080// WorkloadNetworksUpdatePortMirroringFuture an abstraction for monitoring and retrieving the results of a 4081// long-running operation. 4082type WorkloadNetworksUpdatePortMirroringFuture struct { 4083 azure.FutureAPI 4084 // Result returns the result of the asynchronous operation. 4085 // If the operation has not completed it will return an error. 4086 Result func(WorkloadNetworksClient) (WorkloadNetworkPortMirroring, error) 4087} 4088 4089// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4090func (future *WorkloadNetworksUpdatePortMirroringFuture) UnmarshalJSON(body []byte) error { 4091 var azFuture azure.Future 4092 if err := json.Unmarshal(body, &azFuture); err != nil { 4093 return err 4094 } 4095 future.FutureAPI = &azFuture 4096 future.Result = future.result 4097 return nil 4098} 4099 4100// result is the default implementation for WorkloadNetworksUpdatePortMirroringFuture.Result. 4101func (future *WorkloadNetworksUpdatePortMirroringFuture) result(client WorkloadNetworksClient) (wnpm WorkloadNetworkPortMirroring, err error) { 4102 var done bool 4103 done, err = future.DoneWithContext(context.Background(), client) 4104 if err != nil { 4105 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksUpdatePortMirroringFuture", "Result", future.Response(), "Polling failure") 4106 return 4107 } 4108 if !done { 4109 wnpm.Response.Response = future.Response() 4110 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksUpdatePortMirroringFuture") 4111 return 4112 } 4113 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4114 if wnpm.Response.Response, err = future.GetResult(sender); err == nil && wnpm.Response.Response.StatusCode != http.StatusNoContent { 4115 wnpm, err = client.UpdatePortMirroringResponder(wnpm.Response.Response) 4116 if err != nil { 4117 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksUpdatePortMirroringFuture", "Result", wnpm.Response.Response, "Failure responding to request") 4118 } 4119 } 4120 return 4121} 4122 4123// WorkloadNetworksUpdateSegmentsFuture an abstraction for monitoring and retrieving the results of a 4124// long-running operation. 4125type WorkloadNetworksUpdateSegmentsFuture struct { 4126 azure.FutureAPI 4127 // Result returns the result of the asynchronous operation. 4128 // If the operation has not completed it will return an error. 4129 Result func(WorkloadNetworksClient) (WorkloadNetworkSegment, error) 4130} 4131 4132// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4133func (future *WorkloadNetworksUpdateSegmentsFuture) UnmarshalJSON(body []byte) error { 4134 var azFuture azure.Future 4135 if err := json.Unmarshal(body, &azFuture); err != nil { 4136 return err 4137 } 4138 future.FutureAPI = &azFuture 4139 future.Result = future.result 4140 return nil 4141} 4142 4143// result is the default implementation for WorkloadNetworksUpdateSegmentsFuture.Result. 4144func (future *WorkloadNetworksUpdateSegmentsFuture) result(client WorkloadNetworksClient) (wns WorkloadNetworkSegment, err error) { 4145 var done bool 4146 done, err = future.DoneWithContext(context.Background(), client) 4147 if err != nil { 4148 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksUpdateSegmentsFuture", "Result", future.Response(), "Polling failure") 4149 return 4150 } 4151 if !done { 4152 wns.Response.Response = future.Response() 4153 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksUpdateSegmentsFuture") 4154 return 4155 } 4156 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4157 if wns.Response.Response, err = future.GetResult(sender); err == nil && wns.Response.Response.StatusCode != http.StatusNoContent { 4158 wns, err = client.UpdateSegmentsResponder(wns.Response.Response) 4159 if err != nil { 4160 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksUpdateSegmentsFuture", "Result", wns.Response.Response, "Failure responding to request") 4161 } 4162 } 4163 return 4164} 4165 4166// WorkloadNetworksUpdateVMGroupFuture an abstraction for monitoring and retrieving the results of a 4167// long-running operation. 4168type WorkloadNetworksUpdateVMGroupFuture struct { 4169 azure.FutureAPI 4170 // Result returns the result of the asynchronous operation. 4171 // If the operation has not completed it will return an error. 4172 Result func(WorkloadNetworksClient) (WorkloadNetworkVMGroup, error) 4173} 4174 4175// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4176func (future *WorkloadNetworksUpdateVMGroupFuture) UnmarshalJSON(body []byte) error { 4177 var azFuture azure.Future 4178 if err := json.Unmarshal(body, &azFuture); err != nil { 4179 return err 4180 } 4181 future.FutureAPI = &azFuture 4182 future.Result = future.result 4183 return nil 4184} 4185 4186// result is the default implementation for WorkloadNetworksUpdateVMGroupFuture.Result. 4187func (future *WorkloadNetworksUpdateVMGroupFuture) result(client WorkloadNetworksClient) (wnvg WorkloadNetworkVMGroup, err error) { 4188 var done bool 4189 done, err = future.DoneWithContext(context.Background(), client) 4190 if err != nil { 4191 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksUpdateVMGroupFuture", "Result", future.Response(), "Polling failure") 4192 return 4193 } 4194 if !done { 4195 wnvg.Response.Response = future.Response() 4196 err = azure.NewAsyncOpIncompleteError("avs.WorkloadNetworksUpdateVMGroupFuture") 4197 return 4198 } 4199 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4200 if wnvg.Response.Response, err = future.GetResult(sender); err == nil && wnvg.Response.Response.StatusCode != http.StatusNoContent { 4201 wnvg, err = client.UpdateVMGroupResponder(wnvg.Response.Response) 4202 if err != nil { 4203 err = autorest.NewErrorWithError(err, "avs.WorkloadNetworksUpdateVMGroupFuture", "Result", wnvg.Response.Response, "Failure responding to request") 4204 } 4205 } 4206 return 4207} 4208 4209// WorkloadNetworkVirtualMachine NSX Virtual Machine 4210type WorkloadNetworkVirtualMachine struct { 4211 autorest.Response `json:"-"` 4212 // WorkloadNetworkVirtualMachineProperties - Virtual machine properties. 4213 *WorkloadNetworkVirtualMachineProperties `json:"properties,omitempty"` 4214 // ID - READ-ONLY; Resource ID. 4215 ID *string `json:"id,omitempty"` 4216 // Name - READ-ONLY; Resource name. 4217 Name *string `json:"name,omitempty"` 4218 // Type - READ-ONLY; Resource type. 4219 Type *string `json:"type,omitempty"` 4220} 4221 4222// MarshalJSON is the custom marshaler for WorkloadNetworkVirtualMachine. 4223func (wnvm WorkloadNetworkVirtualMachine) MarshalJSON() ([]byte, error) { 4224 objectMap := make(map[string]interface{}) 4225 if wnvm.WorkloadNetworkVirtualMachineProperties != nil { 4226 objectMap["properties"] = wnvm.WorkloadNetworkVirtualMachineProperties 4227 } 4228 return json.Marshal(objectMap) 4229} 4230 4231// UnmarshalJSON is the custom unmarshaler for WorkloadNetworkVirtualMachine struct. 4232func (wnvm *WorkloadNetworkVirtualMachine) UnmarshalJSON(body []byte) error { 4233 var m map[string]*json.RawMessage 4234 err := json.Unmarshal(body, &m) 4235 if err != nil { 4236 return err 4237 } 4238 for k, v := range m { 4239 switch k { 4240 case "properties": 4241 if v != nil { 4242 var workloadNetworkVirtualMachineProperties WorkloadNetworkVirtualMachineProperties 4243 err = json.Unmarshal(*v, &workloadNetworkVirtualMachineProperties) 4244 if err != nil { 4245 return err 4246 } 4247 wnvm.WorkloadNetworkVirtualMachineProperties = &workloadNetworkVirtualMachineProperties 4248 } 4249 case "id": 4250 if v != nil { 4251 var ID string 4252 err = json.Unmarshal(*v, &ID) 4253 if err != nil { 4254 return err 4255 } 4256 wnvm.ID = &ID 4257 } 4258 case "name": 4259 if v != nil { 4260 var name string 4261 err = json.Unmarshal(*v, &name) 4262 if err != nil { 4263 return err 4264 } 4265 wnvm.Name = &name 4266 } 4267 case "type": 4268 if v != nil { 4269 var typeVar string 4270 err = json.Unmarshal(*v, &typeVar) 4271 if err != nil { 4272 return err 4273 } 4274 wnvm.Type = &typeVar 4275 } 4276 } 4277 } 4278 4279 return nil 4280} 4281 4282// WorkloadNetworkVirtualMachineProperties NSX Virtual Machine Properties 4283type WorkloadNetworkVirtualMachineProperties struct { 4284 // DisplayName - Display name of the VM. 4285 DisplayName *string `json:"displayName,omitempty"` 4286 // VMType - READ-ONLY; Virtual machine type. Possible values include: 'REGULAREDGESERVICE' 4287 VMType VMTypeEnum `json:"vmType,omitempty"` 4288} 4289 4290// MarshalJSON is the custom marshaler for WorkloadNetworkVirtualMachineProperties. 4291func (wnvmp WorkloadNetworkVirtualMachineProperties) MarshalJSON() ([]byte, error) { 4292 objectMap := make(map[string]interface{}) 4293 if wnvmp.DisplayName != nil { 4294 objectMap["displayName"] = wnvmp.DisplayName 4295 } 4296 return json.Marshal(objectMap) 4297} 4298 4299// WorkloadNetworkVirtualMachinesList a list of NSX Virtual Machines 4300type WorkloadNetworkVirtualMachinesList struct { 4301 autorest.Response `json:"-"` 4302 // Value - READ-ONLY; The items on the page 4303 Value *[]WorkloadNetworkVirtualMachine `json:"value,omitempty"` 4304 // NextLink - READ-ONLY; URL to get the next page if any 4305 NextLink *string `json:"nextLink,omitempty"` 4306} 4307 4308// MarshalJSON is the custom marshaler for WorkloadNetworkVirtualMachinesList. 4309func (wnvml WorkloadNetworkVirtualMachinesList) MarshalJSON() ([]byte, error) { 4310 objectMap := make(map[string]interface{}) 4311 return json.Marshal(objectMap) 4312} 4313 4314// WorkloadNetworkVirtualMachinesListIterator provides access to a complete listing of 4315// WorkloadNetworkVirtualMachine values. 4316type WorkloadNetworkVirtualMachinesListIterator struct { 4317 i int 4318 page WorkloadNetworkVirtualMachinesListPage 4319} 4320 4321// NextWithContext advances to the next value. If there was an error making 4322// the request the iterator does not advance and the error is returned. 4323func (iter *WorkloadNetworkVirtualMachinesListIterator) NextWithContext(ctx context.Context) (err error) { 4324 if tracing.IsEnabled() { 4325 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkVirtualMachinesListIterator.NextWithContext") 4326 defer func() { 4327 sc := -1 4328 if iter.Response().Response.Response != nil { 4329 sc = iter.Response().Response.Response.StatusCode 4330 } 4331 tracing.EndSpan(ctx, sc, err) 4332 }() 4333 } 4334 iter.i++ 4335 if iter.i < len(iter.page.Values()) { 4336 return nil 4337 } 4338 err = iter.page.NextWithContext(ctx) 4339 if err != nil { 4340 iter.i-- 4341 return err 4342 } 4343 iter.i = 0 4344 return nil 4345} 4346 4347// Next advances to the next value. If there was an error making 4348// the request the iterator does not advance and the error is returned. 4349// Deprecated: Use NextWithContext() instead. 4350func (iter *WorkloadNetworkVirtualMachinesListIterator) Next() error { 4351 return iter.NextWithContext(context.Background()) 4352} 4353 4354// NotDone returns true if the enumeration should be started or is not yet complete. 4355func (iter WorkloadNetworkVirtualMachinesListIterator) NotDone() bool { 4356 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4357} 4358 4359// Response returns the raw server response from the last page request. 4360func (iter WorkloadNetworkVirtualMachinesListIterator) Response() WorkloadNetworkVirtualMachinesList { 4361 return iter.page.Response() 4362} 4363 4364// Value returns the current value or a zero-initialized value if the 4365// iterator has advanced beyond the end of the collection. 4366func (iter WorkloadNetworkVirtualMachinesListIterator) Value() WorkloadNetworkVirtualMachine { 4367 if !iter.page.NotDone() { 4368 return WorkloadNetworkVirtualMachine{} 4369 } 4370 return iter.page.Values()[iter.i] 4371} 4372 4373// Creates a new instance of the WorkloadNetworkVirtualMachinesListIterator type. 4374func NewWorkloadNetworkVirtualMachinesListIterator(page WorkloadNetworkVirtualMachinesListPage) WorkloadNetworkVirtualMachinesListIterator { 4375 return WorkloadNetworkVirtualMachinesListIterator{page: page} 4376} 4377 4378// IsEmpty returns true if the ListResult contains no values. 4379func (wnvml WorkloadNetworkVirtualMachinesList) IsEmpty() bool { 4380 return wnvml.Value == nil || len(*wnvml.Value) == 0 4381} 4382 4383// hasNextLink returns true if the NextLink is not empty. 4384func (wnvml WorkloadNetworkVirtualMachinesList) hasNextLink() bool { 4385 return wnvml.NextLink != nil && len(*wnvml.NextLink) != 0 4386} 4387 4388// workloadNetworkVirtualMachinesListPreparer prepares a request to retrieve the next set of results. 4389// It returns nil if no more results exist. 4390func (wnvml WorkloadNetworkVirtualMachinesList) workloadNetworkVirtualMachinesListPreparer(ctx context.Context) (*http.Request, error) { 4391 if !wnvml.hasNextLink() { 4392 return nil, nil 4393 } 4394 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4395 autorest.AsJSON(), 4396 autorest.AsGet(), 4397 autorest.WithBaseURL(to.String(wnvml.NextLink))) 4398} 4399 4400// WorkloadNetworkVirtualMachinesListPage contains a page of WorkloadNetworkVirtualMachine values. 4401type WorkloadNetworkVirtualMachinesListPage struct { 4402 fn func(context.Context, WorkloadNetworkVirtualMachinesList) (WorkloadNetworkVirtualMachinesList, error) 4403 wnvml WorkloadNetworkVirtualMachinesList 4404} 4405 4406// NextWithContext advances to the next page of values. If there was an error making 4407// the request the page does not advance and the error is returned. 4408func (page *WorkloadNetworkVirtualMachinesListPage) NextWithContext(ctx context.Context) (err error) { 4409 if tracing.IsEnabled() { 4410 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkVirtualMachinesListPage.NextWithContext") 4411 defer func() { 4412 sc := -1 4413 if page.Response().Response.Response != nil { 4414 sc = page.Response().Response.Response.StatusCode 4415 } 4416 tracing.EndSpan(ctx, sc, err) 4417 }() 4418 } 4419 for { 4420 next, err := page.fn(ctx, page.wnvml) 4421 if err != nil { 4422 return err 4423 } 4424 page.wnvml = next 4425 if !next.hasNextLink() || !next.IsEmpty() { 4426 break 4427 } 4428 } 4429 return nil 4430} 4431 4432// Next advances to the next page of values. If there was an error making 4433// the request the page does not advance and the error is returned. 4434// Deprecated: Use NextWithContext() instead. 4435func (page *WorkloadNetworkVirtualMachinesListPage) Next() error { 4436 return page.NextWithContext(context.Background()) 4437} 4438 4439// NotDone returns true if the page enumeration should be started or is not yet complete. 4440func (page WorkloadNetworkVirtualMachinesListPage) NotDone() bool { 4441 return !page.wnvml.IsEmpty() 4442} 4443 4444// Response returns the raw server response from the last page request. 4445func (page WorkloadNetworkVirtualMachinesListPage) Response() WorkloadNetworkVirtualMachinesList { 4446 return page.wnvml 4447} 4448 4449// Values returns the slice of values for the current page or nil if there are no values. 4450func (page WorkloadNetworkVirtualMachinesListPage) Values() []WorkloadNetworkVirtualMachine { 4451 if page.wnvml.IsEmpty() { 4452 return nil 4453 } 4454 return *page.wnvml.Value 4455} 4456 4457// Creates a new instance of the WorkloadNetworkVirtualMachinesListPage type. 4458func NewWorkloadNetworkVirtualMachinesListPage(cur WorkloadNetworkVirtualMachinesList, getNextPage func(context.Context, WorkloadNetworkVirtualMachinesList) (WorkloadNetworkVirtualMachinesList, error)) WorkloadNetworkVirtualMachinesListPage { 4459 return WorkloadNetworkVirtualMachinesListPage{ 4460 fn: getNextPage, 4461 wnvml: cur, 4462 } 4463} 4464 4465// WorkloadNetworkVMGroup NSX VM Group 4466type WorkloadNetworkVMGroup struct { 4467 autorest.Response `json:"-"` 4468 // WorkloadNetworkVMGroupProperties - VM Group properties. 4469 *WorkloadNetworkVMGroupProperties `json:"properties,omitempty"` 4470 // ID - READ-ONLY; Resource ID. 4471 ID *string `json:"id,omitempty"` 4472 // Name - READ-ONLY; Resource name. 4473 Name *string `json:"name,omitempty"` 4474 // Type - READ-ONLY; Resource type. 4475 Type *string `json:"type,omitempty"` 4476} 4477 4478// MarshalJSON is the custom marshaler for WorkloadNetworkVMGroup. 4479func (wnvg WorkloadNetworkVMGroup) MarshalJSON() ([]byte, error) { 4480 objectMap := make(map[string]interface{}) 4481 if wnvg.WorkloadNetworkVMGroupProperties != nil { 4482 objectMap["properties"] = wnvg.WorkloadNetworkVMGroupProperties 4483 } 4484 return json.Marshal(objectMap) 4485} 4486 4487// UnmarshalJSON is the custom unmarshaler for WorkloadNetworkVMGroup struct. 4488func (wnvg *WorkloadNetworkVMGroup) UnmarshalJSON(body []byte) error { 4489 var m map[string]*json.RawMessage 4490 err := json.Unmarshal(body, &m) 4491 if err != nil { 4492 return err 4493 } 4494 for k, v := range m { 4495 switch k { 4496 case "properties": 4497 if v != nil { 4498 var workloadNetworkVMGroupProperties WorkloadNetworkVMGroupProperties 4499 err = json.Unmarshal(*v, &workloadNetworkVMGroupProperties) 4500 if err != nil { 4501 return err 4502 } 4503 wnvg.WorkloadNetworkVMGroupProperties = &workloadNetworkVMGroupProperties 4504 } 4505 case "id": 4506 if v != nil { 4507 var ID string 4508 err = json.Unmarshal(*v, &ID) 4509 if err != nil { 4510 return err 4511 } 4512 wnvg.ID = &ID 4513 } 4514 case "name": 4515 if v != nil { 4516 var name string 4517 err = json.Unmarshal(*v, &name) 4518 if err != nil { 4519 return err 4520 } 4521 wnvg.Name = &name 4522 } 4523 case "type": 4524 if v != nil { 4525 var typeVar string 4526 err = json.Unmarshal(*v, &typeVar) 4527 if err != nil { 4528 return err 4529 } 4530 wnvg.Type = &typeVar 4531 } 4532 } 4533 } 4534 4535 return nil 4536} 4537 4538// WorkloadNetworkVMGroupProperties NSX VM Group Properties 4539type WorkloadNetworkVMGroupProperties struct { 4540 // DisplayName - Display name of the VM group. 4541 DisplayName *string `json:"displayName,omitempty"` 4542 // Members - Virtual machine members of this group. 4543 Members *[]string `json:"members,omitempty"` 4544 // Status - READ-ONLY; VM Group status. Possible values include: 'VMGroupStatusEnumSUCCESSFAILURE' 4545 Status VMGroupStatusEnum `json:"status,omitempty"` 4546 // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'WorkloadNetworkVMGroupProvisioningStateSucceeded', 'WorkloadNetworkVMGroupProvisioningStateFailed', 'WorkloadNetworkVMGroupProvisioningStateBuilding', 'WorkloadNetworkVMGroupProvisioningStateDeleting', 'WorkloadNetworkVMGroupProvisioningStateUpdating' 4547 ProvisioningState WorkloadNetworkVMGroupProvisioningState `json:"provisioningState,omitempty"` 4548 // Revision - NSX revision number. 4549 Revision *int64 `json:"revision,omitempty"` 4550} 4551 4552// MarshalJSON is the custom marshaler for WorkloadNetworkVMGroupProperties. 4553func (wnvgp WorkloadNetworkVMGroupProperties) MarshalJSON() ([]byte, error) { 4554 objectMap := make(map[string]interface{}) 4555 if wnvgp.DisplayName != nil { 4556 objectMap["displayName"] = wnvgp.DisplayName 4557 } 4558 if wnvgp.Members != nil { 4559 objectMap["members"] = wnvgp.Members 4560 } 4561 if wnvgp.Revision != nil { 4562 objectMap["revision"] = wnvgp.Revision 4563 } 4564 return json.Marshal(objectMap) 4565} 4566 4567// WorkloadNetworkVMGroupsList a list of NSX VM Groups 4568type WorkloadNetworkVMGroupsList struct { 4569 autorest.Response `json:"-"` 4570 // Value - READ-ONLY; The items on the page 4571 Value *[]WorkloadNetworkVMGroup `json:"value,omitempty"` 4572 // NextLink - READ-ONLY; URL to get the next page if any 4573 NextLink *string `json:"nextLink,omitempty"` 4574} 4575 4576// MarshalJSON is the custom marshaler for WorkloadNetworkVMGroupsList. 4577func (wnvgl WorkloadNetworkVMGroupsList) MarshalJSON() ([]byte, error) { 4578 objectMap := make(map[string]interface{}) 4579 return json.Marshal(objectMap) 4580} 4581 4582// WorkloadNetworkVMGroupsListIterator provides access to a complete listing of WorkloadNetworkVMGroup 4583// values. 4584type WorkloadNetworkVMGroupsListIterator struct { 4585 i int 4586 page WorkloadNetworkVMGroupsListPage 4587} 4588 4589// NextWithContext advances to the next value. If there was an error making 4590// the request the iterator does not advance and the error is returned. 4591func (iter *WorkloadNetworkVMGroupsListIterator) NextWithContext(ctx context.Context) (err error) { 4592 if tracing.IsEnabled() { 4593 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkVMGroupsListIterator.NextWithContext") 4594 defer func() { 4595 sc := -1 4596 if iter.Response().Response.Response != nil { 4597 sc = iter.Response().Response.Response.StatusCode 4598 } 4599 tracing.EndSpan(ctx, sc, err) 4600 }() 4601 } 4602 iter.i++ 4603 if iter.i < len(iter.page.Values()) { 4604 return nil 4605 } 4606 err = iter.page.NextWithContext(ctx) 4607 if err != nil { 4608 iter.i-- 4609 return err 4610 } 4611 iter.i = 0 4612 return nil 4613} 4614 4615// Next advances to the next value. If there was an error making 4616// the request the iterator does not advance and the error is returned. 4617// Deprecated: Use NextWithContext() instead. 4618func (iter *WorkloadNetworkVMGroupsListIterator) Next() error { 4619 return iter.NextWithContext(context.Background()) 4620} 4621 4622// NotDone returns true if the enumeration should be started or is not yet complete. 4623func (iter WorkloadNetworkVMGroupsListIterator) NotDone() bool { 4624 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4625} 4626 4627// Response returns the raw server response from the last page request. 4628func (iter WorkloadNetworkVMGroupsListIterator) Response() WorkloadNetworkVMGroupsList { 4629 return iter.page.Response() 4630} 4631 4632// Value returns the current value or a zero-initialized value if the 4633// iterator has advanced beyond the end of the collection. 4634func (iter WorkloadNetworkVMGroupsListIterator) Value() WorkloadNetworkVMGroup { 4635 if !iter.page.NotDone() { 4636 return WorkloadNetworkVMGroup{} 4637 } 4638 return iter.page.Values()[iter.i] 4639} 4640 4641// Creates a new instance of the WorkloadNetworkVMGroupsListIterator type. 4642func NewWorkloadNetworkVMGroupsListIterator(page WorkloadNetworkVMGroupsListPage) WorkloadNetworkVMGroupsListIterator { 4643 return WorkloadNetworkVMGroupsListIterator{page: page} 4644} 4645 4646// IsEmpty returns true if the ListResult contains no values. 4647func (wnvgl WorkloadNetworkVMGroupsList) IsEmpty() bool { 4648 return wnvgl.Value == nil || len(*wnvgl.Value) == 0 4649} 4650 4651// hasNextLink returns true if the NextLink is not empty. 4652func (wnvgl WorkloadNetworkVMGroupsList) hasNextLink() bool { 4653 return wnvgl.NextLink != nil && len(*wnvgl.NextLink) != 0 4654} 4655 4656// workloadNetworkVMGroupsListPreparer prepares a request to retrieve the next set of results. 4657// It returns nil if no more results exist. 4658func (wnvgl WorkloadNetworkVMGroupsList) workloadNetworkVMGroupsListPreparer(ctx context.Context) (*http.Request, error) { 4659 if !wnvgl.hasNextLink() { 4660 return nil, nil 4661 } 4662 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4663 autorest.AsJSON(), 4664 autorest.AsGet(), 4665 autorest.WithBaseURL(to.String(wnvgl.NextLink))) 4666} 4667 4668// WorkloadNetworkVMGroupsListPage contains a page of WorkloadNetworkVMGroup values. 4669type WorkloadNetworkVMGroupsListPage struct { 4670 fn func(context.Context, WorkloadNetworkVMGroupsList) (WorkloadNetworkVMGroupsList, error) 4671 wnvgl WorkloadNetworkVMGroupsList 4672} 4673 4674// NextWithContext advances to the next page of values. If there was an error making 4675// the request the page does not advance and the error is returned. 4676func (page *WorkloadNetworkVMGroupsListPage) NextWithContext(ctx context.Context) (err error) { 4677 if tracing.IsEnabled() { 4678 ctx = tracing.StartSpan(ctx, fqdn+"/WorkloadNetworkVMGroupsListPage.NextWithContext") 4679 defer func() { 4680 sc := -1 4681 if page.Response().Response.Response != nil { 4682 sc = page.Response().Response.Response.StatusCode 4683 } 4684 tracing.EndSpan(ctx, sc, err) 4685 }() 4686 } 4687 for { 4688 next, err := page.fn(ctx, page.wnvgl) 4689 if err != nil { 4690 return err 4691 } 4692 page.wnvgl = next 4693 if !next.hasNextLink() || !next.IsEmpty() { 4694 break 4695 } 4696 } 4697 return nil 4698} 4699 4700// Next advances to the next page of values. If there was an error making 4701// the request the page does not advance and the error is returned. 4702// Deprecated: Use NextWithContext() instead. 4703func (page *WorkloadNetworkVMGroupsListPage) Next() error { 4704 return page.NextWithContext(context.Background()) 4705} 4706 4707// NotDone returns true if the page enumeration should be started or is not yet complete. 4708func (page WorkloadNetworkVMGroupsListPage) NotDone() bool { 4709 return !page.wnvgl.IsEmpty() 4710} 4711 4712// Response returns the raw server response from the last page request. 4713func (page WorkloadNetworkVMGroupsListPage) Response() WorkloadNetworkVMGroupsList { 4714 return page.wnvgl 4715} 4716 4717// Values returns the slice of values for the current page or nil if there are no values. 4718func (page WorkloadNetworkVMGroupsListPage) Values() []WorkloadNetworkVMGroup { 4719 if page.wnvgl.IsEmpty() { 4720 return nil 4721 } 4722 return *page.wnvgl.Value 4723} 4724 4725// Creates a new instance of the WorkloadNetworkVMGroupsListPage type. 4726func NewWorkloadNetworkVMGroupsListPage(cur WorkloadNetworkVMGroupsList, getNextPage func(context.Context, WorkloadNetworkVMGroupsList) (WorkloadNetworkVMGroupsList, error)) WorkloadNetworkVMGroupsListPage { 4727 return WorkloadNetworkVMGroupsListPage{ 4728 fn: getNextPage, 4729 wnvgl: cur, 4730 } 4731} 4732