1package managednetwork 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/azure" 25 "github.com/Azure/go-autorest/autorest/to" 26 "github.com/Azure/go-autorest/tracing" 27 "net/http" 28) 29 30// The package's fully qualified name. 31const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/managednetwork/mgmt/2019-06-01-preview/managednetwork" 32 33// ConnectivityCollection the collection of Connectivity related groups and policies within the Managed 34// Network 35type ConnectivityCollection struct { 36 // Groups - READ-ONLY; The collection of connectivity related Managed Network Groups within the Managed Network 37 Groups *[]Group `json:"groups,omitempty"` 38 // Peerings - READ-ONLY; The collection of Managed Network Peering Policies within the Managed Network 39 Peerings *[]PeeringPolicy `json:"peerings,omitempty"` 40} 41 42// ErrorResponse the error response that indicates why an operation has failed. 43type ErrorResponse struct { 44 // Code - READ-ONLY; The error code. 45 Code *string `json:"code,omitempty"` 46 // Message - READ-ONLY; The error message. 47 Message *string `json:"message,omitempty"` 48} 49 50// Group the Managed Network Group resource 51type Group struct { 52 autorest.Response `json:"-"` 53 // GroupProperties - Gets or sets the properties of a network group 54 *GroupProperties `json:"properties,omitempty"` 55 // Kind - Responsibility role under which this Managed Network Group will be created. Possible values include: 'Connectivity' 56 Kind Kind `json:"kind,omitempty"` 57 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 58 ID *string `json:"id,omitempty"` 59 // Name - READ-ONLY; The name of the resource 60 Name *string `json:"name,omitempty"` 61 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 62 Type *string `json:"type,omitempty"` 63 // Location - The geo-location where the resource lives 64 Location *string `json:"location,omitempty"` 65} 66 67// MarshalJSON is the custom marshaler for Group. 68func (g Group) MarshalJSON() ([]byte, error) { 69 objectMap := make(map[string]interface{}) 70 if g.GroupProperties != nil { 71 objectMap["properties"] = g.GroupProperties 72 } 73 if g.Kind != "" { 74 objectMap["kind"] = g.Kind 75 } 76 if g.Location != nil { 77 objectMap["location"] = g.Location 78 } 79 return json.Marshal(objectMap) 80} 81 82// UnmarshalJSON is the custom unmarshaler for Group struct. 83func (g *Group) UnmarshalJSON(body []byte) error { 84 var m map[string]*json.RawMessage 85 err := json.Unmarshal(body, &m) 86 if err != nil { 87 return err 88 } 89 for k, v := range m { 90 switch k { 91 case "properties": 92 if v != nil { 93 var groupProperties GroupProperties 94 err = json.Unmarshal(*v, &groupProperties) 95 if err != nil { 96 return err 97 } 98 g.GroupProperties = &groupProperties 99 } 100 case "kind": 101 if v != nil { 102 var kind Kind 103 err = json.Unmarshal(*v, &kind) 104 if err != nil { 105 return err 106 } 107 g.Kind = kind 108 } 109 case "id": 110 if v != nil { 111 var ID string 112 err = json.Unmarshal(*v, &ID) 113 if err != nil { 114 return err 115 } 116 g.ID = &ID 117 } 118 case "name": 119 if v != nil { 120 var name string 121 err = json.Unmarshal(*v, &name) 122 if err != nil { 123 return err 124 } 125 g.Name = &name 126 } 127 case "type": 128 if v != nil { 129 var typeVar string 130 err = json.Unmarshal(*v, &typeVar) 131 if err != nil { 132 return err 133 } 134 g.Type = &typeVar 135 } 136 case "location": 137 if v != nil { 138 var location string 139 err = json.Unmarshal(*v, &location) 140 if err != nil { 141 return err 142 } 143 g.Location = &location 144 } 145 } 146 } 147 148 return nil 149} 150 151// GroupListResult result of the request to list Managed Network Groups. It contains a list of groups and a 152// URL link to get the next set of results. 153type GroupListResult struct { 154 autorest.Response `json:"-"` 155 // Value - Gets a page of ManagedNetworkGroup 156 Value *[]Group `json:"value,omitempty"` 157 // NextLink - Gets the URL to get the next set of results. 158 NextLink *string `json:"nextLink,omitempty"` 159} 160 161// GroupListResultIterator provides access to a complete listing of Group values. 162type GroupListResultIterator struct { 163 i int 164 page GroupListResultPage 165} 166 167// NextWithContext advances to the next value. If there was an error making 168// the request the iterator does not advance and the error is returned. 169func (iter *GroupListResultIterator) NextWithContext(ctx context.Context) (err error) { 170 if tracing.IsEnabled() { 171 ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultIterator.NextWithContext") 172 defer func() { 173 sc := -1 174 if iter.Response().Response.Response != nil { 175 sc = iter.Response().Response.Response.StatusCode 176 } 177 tracing.EndSpan(ctx, sc, err) 178 }() 179 } 180 iter.i++ 181 if iter.i < len(iter.page.Values()) { 182 return nil 183 } 184 err = iter.page.NextWithContext(ctx) 185 if err != nil { 186 iter.i-- 187 return err 188 } 189 iter.i = 0 190 return nil 191} 192 193// Next advances to the next value. If there was an error making 194// the request the iterator does not advance and the error is returned. 195// Deprecated: Use NextWithContext() instead. 196func (iter *GroupListResultIterator) Next() error { 197 return iter.NextWithContext(context.Background()) 198} 199 200// NotDone returns true if the enumeration should be started or is not yet complete. 201func (iter GroupListResultIterator) NotDone() bool { 202 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 203} 204 205// Response returns the raw server response from the last page request. 206func (iter GroupListResultIterator) Response() GroupListResult { 207 return iter.page.Response() 208} 209 210// Value returns the current value or a zero-initialized value if the 211// iterator has advanced beyond the end of the collection. 212func (iter GroupListResultIterator) Value() Group { 213 if !iter.page.NotDone() { 214 return Group{} 215 } 216 return iter.page.Values()[iter.i] 217} 218 219// Creates a new instance of the GroupListResultIterator type. 220func NewGroupListResultIterator(page GroupListResultPage) GroupListResultIterator { 221 return GroupListResultIterator{page: page} 222} 223 224// IsEmpty returns true if the ListResult contains no values. 225func (glr GroupListResult) IsEmpty() bool { 226 return glr.Value == nil || len(*glr.Value) == 0 227} 228 229// hasNextLink returns true if the NextLink is not empty. 230func (glr GroupListResult) hasNextLink() bool { 231 return glr.NextLink != nil && len(*glr.NextLink) != 0 232} 233 234// groupListResultPreparer prepares a request to retrieve the next set of results. 235// It returns nil if no more results exist. 236func (glr GroupListResult) groupListResultPreparer(ctx context.Context) (*http.Request, error) { 237 if !glr.hasNextLink() { 238 return nil, nil 239 } 240 return autorest.Prepare((&http.Request{}).WithContext(ctx), 241 autorest.AsJSON(), 242 autorest.AsGet(), 243 autorest.WithBaseURL(to.String(glr.NextLink))) 244} 245 246// GroupListResultPage contains a page of Group values. 247type GroupListResultPage struct { 248 fn func(context.Context, GroupListResult) (GroupListResult, error) 249 glr GroupListResult 250} 251 252// NextWithContext advances to the next page of values. If there was an error making 253// the request the page does not advance and the error is returned. 254func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error) { 255 if tracing.IsEnabled() { 256 ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultPage.NextWithContext") 257 defer func() { 258 sc := -1 259 if page.Response().Response.Response != nil { 260 sc = page.Response().Response.Response.StatusCode 261 } 262 tracing.EndSpan(ctx, sc, err) 263 }() 264 } 265 for { 266 next, err := page.fn(ctx, page.glr) 267 if err != nil { 268 return err 269 } 270 page.glr = next 271 if !next.hasNextLink() || !next.IsEmpty() { 272 break 273 } 274 } 275 return nil 276} 277 278// Next advances to the next page of values. If there was an error making 279// the request the page does not advance and the error is returned. 280// Deprecated: Use NextWithContext() instead. 281func (page *GroupListResultPage) Next() error { 282 return page.NextWithContext(context.Background()) 283} 284 285// NotDone returns true if the page enumeration should be started or is not yet complete. 286func (page GroupListResultPage) NotDone() bool { 287 return !page.glr.IsEmpty() 288} 289 290// Response returns the raw server response from the last page request. 291func (page GroupListResultPage) Response() GroupListResult { 292 return page.glr 293} 294 295// Values returns the slice of values for the current page or nil if there are no values. 296func (page GroupListResultPage) Values() []Group { 297 if page.glr.IsEmpty() { 298 return nil 299 } 300 return *page.glr.Value 301} 302 303// Creates a new instance of the GroupListResultPage type. 304func NewGroupListResultPage(cur GroupListResult, getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage { 305 return GroupListResultPage{ 306 fn: getNextPage, 307 glr: cur, 308 } 309} 310 311// GroupProperties properties of a Managed Network Group 312type GroupProperties struct { 313 // ManagementGroups - The collection of management groups covered by the Managed Network 314 ManagementGroups *[]ResourceID `json:"managementGroups,omitempty"` 315 // Subscriptions - The collection of subscriptions covered by the Managed Network 316 Subscriptions *[]ResourceID `json:"subscriptions,omitempty"` 317 // VirtualNetworks - The collection of virtual nets covered by the Managed Network 318 VirtualNetworks *[]ResourceID `json:"virtualNetworks,omitempty"` 319 // Subnets - The collection of subnets covered by the Managed Network 320 Subnets *[]ResourceID `json:"subnets,omitempty"` 321 // ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' 322 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 323 // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. 324 Etag *string `json:"etag,omitempty"` 325} 326 327// MarshalJSON is the custom marshaler for GroupProperties. 328func (gp GroupProperties) MarshalJSON() ([]byte, error) { 329 objectMap := make(map[string]interface{}) 330 if gp.ManagementGroups != nil { 331 objectMap["managementGroups"] = gp.ManagementGroups 332 } 333 if gp.Subscriptions != nil { 334 objectMap["subscriptions"] = gp.Subscriptions 335 } 336 if gp.VirtualNetworks != nil { 337 objectMap["virtualNetworks"] = gp.VirtualNetworks 338 } 339 if gp.Subnets != nil { 340 objectMap["subnets"] = gp.Subnets 341 } 342 return json.Marshal(objectMap) 343} 344 345// GroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 346// operation. 347type GroupsCreateOrUpdateFuture struct { 348 azure.FutureAPI 349 // Result returns the result of the asynchronous operation. 350 // If the operation has not completed it will return an error. 351 Result func(GroupsClient) (Group, error) 352} 353 354// GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 355type GroupsDeleteFuture struct { 356 azure.FutureAPI 357 // Result returns the result of the asynchronous operation. 358 // If the operation has not completed it will return an error. 359 Result func(GroupsClient) (autorest.Response, error) 360} 361 362// HubAndSpokePeeringPolicyProperties properties of a Hub and Spoke Peering Policy 363type HubAndSpokePeeringPolicyProperties struct { 364 // Type - Gets or sets the connectivity type of a network structure policy. Possible values include: 'HubAndSpokeTopology', 'MeshTopology' 365 Type Type `json:"type,omitempty"` 366 // Hub - Gets or sets the hub virtual network ID 367 Hub *ResourceID `json:"hub,omitempty"` 368 // Spokes - Gets or sets the spokes group IDs 369 Spokes *[]ResourceID `json:"spokes,omitempty"` 370 // Mesh - Gets or sets the mesh group IDs 371 Mesh *[]ResourceID `json:"mesh,omitempty"` 372 // ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' 373 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 374 // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. 375 Etag *string `json:"etag,omitempty"` 376} 377 378// MarshalJSON is the custom marshaler for HubAndSpokePeeringPolicyProperties. 379func (hasppp HubAndSpokePeeringPolicyProperties) MarshalJSON() ([]byte, error) { 380 objectMap := make(map[string]interface{}) 381 if hasppp.Type != "" { 382 objectMap["type"] = hasppp.Type 383 } 384 if hasppp.Hub != nil { 385 objectMap["hub"] = hasppp.Hub 386 } 387 if hasppp.Spokes != nil { 388 objectMap["spokes"] = hasppp.Spokes 389 } 390 if hasppp.Mesh != nil { 391 objectMap["mesh"] = hasppp.Mesh 392 } 393 return json.Marshal(objectMap) 394} 395 396// ListResult result of the request to list Managed Network. It contains a list of Managed Networks and a 397// URL link to get the next set of results. 398type ListResult struct { 399 autorest.Response `json:"-"` 400 // Value - Gets a page of ManagedNetworks 401 Value *[]ManagedNetwork `json:"value,omitempty"` 402 // NextLink - Gets the URL to get the next page of results. 403 NextLink *string `json:"nextLink,omitempty"` 404} 405 406// ListResultIterator provides access to a complete listing of ManagedNetwork values. 407type ListResultIterator struct { 408 i int 409 page ListResultPage 410} 411 412// NextWithContext advances to the next value. If there was an error making 413// the request the iterator does not advance and the error is returned. 414func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { 415 if tracing.IsEnabled() { 416 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") 417 defer func() { 418 sc := -1 419 if iter.Response().Response.Response != nil { 420 sc = iter.Response().Response.Response.StatusCode 421 } 422 tracing.EndSpan(ctx, sc, err) 423 }() 424 } 425 iter.i++ 426 if iter.i < len(iter.page.Values()) { 427 return nil 428 } 429 err = iter.page.NextWithContext(ctx) 430 if err != nil { 431 iter.i-- 432 return err 433 } 434 iter.i = 0 435 return nil 436} 437 438// Next advances to the next value. If there was an error making 439// the request the iterator does not advance and the error is returned. 440// Deprecated: Use NextWithContext() instead. 441func (iter *ListResultIterator) Next() error { 442 return iter.NextWithContext(context.Background()) 443} 444 445// NotDone returns true if the enumeration should be started or is not yet complete. 446func (iter ListResultIterator) NotDone() bool { 447 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 448} 449 450// Response returns the raw server response from the last page request. 451func (iter ListResultIterator) Response() ListResult { 452 return iter.page.Response() 453} 454 455// Value returns the current value or a zero-initialized value if the 456// iterator has advanced beyond the end of the collection. 457func (iter ListResultIterator) Value() ManagedNetwork { 458 if !iter.page.NotDone() { 459 return ManagedNetwork{} 460 } 461 return iter.page.Values()[iter.i] 462} 463 464// Creates a new instance of the ListResultIterator type. 465func NewListResultIterator(page ListResultPage) ListResultIterator { 466 return ListResultIterator{page: page} 467} 468 469// IsEmpty returns true if the ListResult contains no values. 470func (lr ListResult) IsEmpty() bool { 471 return lr.Value == nil || len(*lr.Value) == 0 472} 473 474// hasNextLink returns true if the NextLink is not empty. 475func (lr ListResult) hasNextLink() bool { 476 return lr.NextLink != nil && len(*lr.NextLink) != 0 477} 478 479// listResultPreparer prepares a request to retrieve the next set of results. 480// It returns nil if no more results exist. 481func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { 482 if !lr.hasNextLink() { 483 return nil, nil 484 } 485 return autorest.Prepare((&http.Request{}).WithContext(ctx), 486 autorest.AsJSON(), 487 autorest.AsGet(), 488 autorest.WithBaseURL(to.String(lr.NextLink))) 489} 490 491// ListResultPage contains a page of ManagedNetwork values. 492type ListResultPage struct { 493 fn func(context.Context, ListResult) (ListResult, error) 494 lr ListResult 495} 496 497// NextWithContext advances to the next page of values. If there was an error making 498// the request the page does not advance and the error is returned. 499func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { 500 if tracing.IsEnabled() { 501 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") 502 defer func() { 503 sc := -1 504 if page.Response().Response.Response != nil { 505 sc = page.Response().Response.Response.StatusCode 506 } 507 tracing.EndSpan(ctx, sc, err) 508 }() 509 } 510 for { 511 next, err := page.fn(ctx, page.lr) 512 if err != nil { 513 return err 514 } 515 page.lr = next 516 if !next.hasNextLink() || !next.IsEmpty() { 517 break 518 } 519 } 520 return nil 521} 522 523// Next advances to the next page of values. If there was an error making 524// the request the page does not advance and the error is returned. 525// Deprecated: Use NextWithContext() instead. 526func (page *ListResultPage) Next() error { 527 return page.NextWithContext(context.Background()) 528} 529 530// NotDone returns true if the page enumeration should be started or is not yet complete. 531func (page ListResultPage) NotDone() bool { 532 return !page.lr.IsEmpty() 533} 534 535// Response returns the raw server response from the last page request. 536func (page ListResultPage) Response() ListResult { 537 return page.lr 538} 539 540// Values returns the slice of values for the current page or nil if there are no values. 541func (page ListResultPage) Values() []ManagedNetwork { 542 if page.lr.IsEmpty() { 543 return nil 544 } 545 return *page.lr.Value 546} 547 548// Creates a new instance of the ListResultPage type. 549func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { 550 return ListResultPage{ 551 fn: getNextPage, 552 lr: cur, 553 } 554} 555 556// ManagedNetwork the Managed Network resource 557type ManagedNetwork struct { 558 autorest.Response `json:"-"` 559 // Properties - The MNC properties 560 *Properties `json:"properties,omitempty"` 561 // Tags - Resource tags 562 Tags map[string]*string `json:"tags"` 563 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 564 ID *string `json:"id,omitempty"` 565 // Name - READ-ONLY; The name of the resource 566 Name *string `json:"name,omitempty"` 567 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 568 Type *string `json:"type,omitempty"` 569 // Location - The geo-location where the resource lives 570 Location *string `json:"location,omitempty"` 571} 572 573// MarshalJSON is the custom marshaler for ManagedNetwork. 574func (mn ManagedNetwork) MarshalJSON() ([]byte, error) { 575 objectMap := make(map[string]interface{}) 576 if mn.Properties != nil { 577 objectMap["properties"] = mn.Properties 578 } 579 if mn.Tags != nil { 580 objectMap["tags"] = mn.Tags 581 } 582 if mn.Location != nil { 583 objectMap["location"] = mn.Location 584 } 585 return json.Marshal(objectMap) 586} 587 588// UnmarshalJSON is the custom unmarshaler for ManagedNetwork struct. 589func (mn *ManagedNetwork) UnmarshalJSON(body []byte) error { 590 var m map[string]*json.RawMessage 591 err := json.Unmarshal(body, &m) 592 if err != nil { 593 return err 594 } 595 for k, v := range m { 596 switch k { 597 case "properties": 598 if v != nil { 599 var properties Properties 600 err = json.Unmarshal(*v, &properties) 601 if err != nil { 602 return err 603 } 604 mn.Properties = &properties 605 } 606 case "tags": 607 if v != nil { 608 var tags map[string]*string 609 err = json.Unmarshal(*v, &tags) 610 if err != nil { 611 return err 612 } 613 mn.Tags = tags 614 } 615 case "id": 616 if v != nil { 617 var ID string 618 err = json.Unmarshal(*v, &ID) 619 if err != nil { 620 return err 621 } 622 mn.ID = &ID 623 } 624 case "name": 625 if v != nil { 626 var name string 627 err = json.Unmarshal(*v, &name) 628 if err != nil { 629 return err 630 } 631 mn.Name = &name 632 } 633 case "type": 634 if v != nil { 635 var typeVar string 636 err = json.Unmarshal(*v, &typeVar) 637 if err != nil { 638 return err 639 } 640 mn.Type = &typeVar 641 } 642 case "location": 643 if v != nil { 644 var location string 645 err = json.Unmarshal(*v, &location) 646 if err != nil { 647 return err 648 } 649 mn.Location = &location 650 } 651 } 652 } 653 654 return nil 655} 656 657// ManagedNetworksDeleteFutureType an abstraction for monitoring and retrieving the results of a 658// long-running operation. 659type ManagedNetworksDeleteFutureType struct { 660 azure.FutureAPI 661 // Result returns the result of the asynchronous operation. 662 // If the operation has not completed it will return an error. 663 Result func(ManagedNetworksClient) (autorest.Response, error) 664} 665 666// ManagedNetworksUpdateFutureType an abstraction for monitoring and retrieving the results of a 667// long-running operation. 668type ManagedNetworksUpdateFutureType struct { 669 azure.FutureAPI 670 // Result returns the result of the asynchronous operation. 671 // If the operation has not completed it will return an error. 672 Result func(ManagedNetworksClient) (ManagedNetwork, error) 673} 674 675// MeshPeeringPolicyProperties properties of a Mesh Peering Policy 676type MeshPeeringPolicyProperties struct { 677 // Type - Gets or sets the connectivity type of a network structure policy. Possible values include: 'HubAndSpokeTopology', 'MeshTopology' 678 Type Type `json:"type,omitempty"` 679 // Hub - Gets or sets the hub virtual network ID 680 Hub *ResourceID `json:"hub,omitempty"` 681 // Spokes - Gets or sets the spokes group IDs 682 Spokes *[]ResourceID `json:"spokes,omitempty"` 683 // Mesh - Gets or sets the mesh group IDs 684 Mesh *[]ResourceID `json:"mesh,omitempty"` 685 // ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' 686 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 687 // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. 688 Etag *string `json:"etag,omitempty"` 689} 690 691// MarshalJSON is the custom marshaler for MeshPeeringPolicyProperties. 692func (mppp MeshPeeringPolicyProperties) MarshalJSON() ([]byte, error) { 693 objectMap := make(map[string]interface{}) 694 if mppp.Type != "" { 695 objectMap["type"] = mppp.Type 696 } 697 if mppp.Hub != nil { 698 objectMap["hub"] = mppp.Hub 699 } 700 if mppp.Spokes != nil { 701 objectMap["spokes"] = mppp.Spokes 702 } 703 if mppp.Mesh != nil { 704 objectMap["mesh"] = mppp.Mesh 705 } 706 return json.Marshal(objectMap) 707} 708 709// Operation REST API operation 710type Operation struct { 711 // Name - Operation name: {provider}/{resource}/{operation} 712 Name *string `json:"name,omitempty"` 713 // Display - The object that represents the operation. 714 Display *OperationDisplay `json:"display,omitempty"` 715} 716 717// OperationDisplay the object that represents the operation. 718type OperationDisplay struct { 719 // Provider - Service provider: Microsoft.ManagedNetwork 720 Provider *string `json:"provider,omitempty"` 721 // Resource - Resource on which the operation is performed: Profile, endpoint, etc. 722 Resource *string `json:"resource,omitempty"` 723 // Operation - Operation type: Read, write, delete, etc. 724 Operation *string `json:"operation,omitempty"` 725} 726 727// OperationListResult result of the request to list Managed Network operations. It contains a list of 728// operations and a URL link to get the next set of results. 729type OperationListResult struct { 730 autorest.Response `json:"-"` 731 // Value - List of Resource Provider operations supported by the Managed Network resource provider. 732 Value *[]Operation `json:"value,omitempty"` 733 // NextLink - URL to get the next set of operation list results if there are any. 734 NextLink *string `json:"nextLink,omitempty"` 735} 736 737// OperationListResultIterator provides access to a complete listing of Operation values. 738type OperationListResultIterator struct { 739 i int 740 page OperationListResultPage 741} 742 743// NextWithContext advances to the next value. If there was an error making 744// the request the iterator does not advance and the error is returned. 745func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 746 if tracing.IsEnabled() { 747 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 748 defer func() { 749 sc := -1 750 if iter.Response().Response.Response != nil { 751 sc = iter.Response().Response.Response.StatusCode 752 } 753 tracing.EndSpan(ctx, sc, err) 754 }() 755 } 756 iter.i++ 757 if iter.i < len(iter.page.Values()) { 758 return nil 759 } 760 err = iter.page.NextWithContext(ctx) 761 if err != nil { 762 iter.i-- 763 return err 764 } 765 iter.i = 0 766 return nil 767} 768 769// Next advances to the next value. If there was an error making 770// the request the iterator does not advance and the error is returned. 771// Deprecated: Use NextWithContext() instead. 772func (iter *OperationListResultIterator) Next() error { 773 return iter.NextWithContext(context.Background()) 774} 775 776// NotDone returns true if the enumeration should be started or is not yet complete. 777func (iter OperationListResultIterator) NotDone() bool { 778 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 779} 780 781// Response returns the raw server response from the last page request. 782func (iter OperationListResultIterator) Response() OperationListResult { 783 return iter.page.Response() 784} 785 786// Value returns the current value or a zero-initialized value if the 787// iterator has advanced beyond the end of the collection. 788func (iter OperationListResultIterator) Value() Operation { 789 if !iter.page.NotDone() { 790 return Operation{} 791 } 792 return iter.page.Values()[iter.i] 793} 794 795// Creates a new instance of the OperationListResultIterator type. 796func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 797 return OperationListResultIterator{page: page} 798} 799 800// IsEmpty returns true if the ListResult contains no values. 801func (olr OperationListResult) IsEmpty() bool { 802 return olr.Value == nil || len(*olr.Value) == 0 803} 804 805// hasNextLink returns true if the NextLink is not empty. 806func (olr OperationListResult) hasNextLink() bool { 807 return olr.NextLink != nil && len(*olr.NextLink) != 0 808} 809 810// operationListResultPreparer prepares a request to retrieve the next set of results. 811// It returns nil if no more results exist. 812func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 813 if !olr.hasNextLink() { 814 return nil, nil 815 } 816 return autorest.Prepare((&http.Request{}).WithContext(ctx), 817 autorest.AsJSON(), 818 autorest.AsGet(), 819 autorest.WithBaseURL(to.String(olr.NextLink))) 820} 821 822// OperationListResultPage contains a page of Operation values. 823type OperationListResultPage struct { 824 fn func(context.Context, OperationListResult) (OperationListResult, error) 825 olr OperationListResult 826} 827 828// NextWithContext advances to the next page of values. If there was an error making 829// the request the page does not advance and the error is returned. 830func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 831 if tracing.IsEnabled() { 832 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 833 defer func() { 834 sc := -1 835 if page.Response().Response.Response != nil { 836 sc = page.Response().Response.Response.StatusCode 837 } 838 tracing.EndSpan(ctx, sc, err) 839 }() 840 } 841 for { 842 next, err := page.fn(ctx, page.olr) 843 if err != nil { 844 return err 845 } 846 page.olr = next 847 if !next.hasNextLink() || !next.IsEmpty() { 848 break 849 } 850 } 851 return nil 852} 853 854// Next advances to the next page of values. If there was an error making 855// the request the page does not advance and the error is returned. 856// Deprecated: Use NextWithContext() instead. 857func (page *OperationListResultPage) Next() error { 858 return page.NextWithContext(context.Background()) 859} 860 861// NotDone returns true if the page enumeration should be started or is not yet complete. 862func (page OperationListResultPage) NotDone() bool { 863 return !page.olr.IsEmpty() 864} 865 866// Response returns the raw server response from the last page request. 867func (page OperationListResultPage) Response() OperationListResult { 868 return page.olr 869} 870 871// Values returns the slice of values for the current page or nil if there are no values. 872func (page OperationListResultPage) Values() []Operation { 873 if page.olr.IsEmpty() { 874 return nil 875 } 876 return *page.olr.Value 877} 878 879// Creates a new instance of the OperationListResultPage type. 880func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 881 return OperationListResultPage{ 882 fn: getNextPage, 883 olr: cur, 884 } 885} 886 887// PeeringPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 888// long-running operation. 889type PeeringPoliciesCreateOrUpdateFuture struct { 890 azure.FutureAPI 891 // Result returns the result of the asynchronous operation. 892 // If the operation has not completed it will return an error. 893 Result func(PeeringPoliciesClient) (PeeringPolicy, error) 894} 895 896// PeeringPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 897// operation. 898type PeeringPoliciesDeleteFuture struct { 899 azure.FutureAPI 900 // Result returns the result of the asynchronous operation. 901 // If the operation has not completed it will return an error. 902 Result func(PeeringPoliciesClient) (autorest.Response, error) 903} 904 905// PeeringPolicy the Managed Network Peering Policy resource 906type PeeringPolicy struct { 907 autorest.Response `json:"-"` 908 // Properties - Gets or sets the properties of a Managed Network Policy 909 Properties *PeeringPolicyProperties `json:"properties,omitempty"` 910 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 911 ID *string `json:"id,omitempty"` 912 // Name - READ-ONLY; The name of the resource 913 Name *string `json:"name,omitempty"` 914 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 915 Type *string `json:"type,omitempty"` 916 // Location - The geo-location where the resource lives 917 Location *string `json:"location,omitempty"` 918} 919 920// MarshalJSON is the custom marshaler for PeeringPolicy. 921func (pp PeeringPolicy) MarshalJSON() ([]byte, error) { 922 objectMap := make(map[string]interface{}) 923 if pp.Properties != nil { 924 objectMap["properties"] = pp.Properties 925 } 926 if pp.Location != nil { 927 objectMap["location"] = pp.Location 928 } 929 return json.Marshal(objectMap) 930} 931 932// PeeringPolicyListResult result of the request to list Managed Network Peering Policies. It contains a 933// list of policies and a URL link to get the next set of results. 934type PeeringPolicyListResult struct { 935 autorest.Response `json:"-"` 936 // Value - Gets a page of Peering Policies 937 Value *[]PeeringPolicy `json:"value,omitempty"` 938 // NextLink - Gets the URL to get the next page of results. 939 NextLink *string `json:"nextLink,omitempty"` 940} 941 942// PeeringPolicyListResultIterator provides access to a complete listing of PeeringPolicy values. 943type PeeringPolicyListResultIterator struct { 944 i int 945 page PeeringPolicyListResultPage 946} 947 948// NextWithContext advances to the next value. If there was an error making 949// the request the iterator does not advance and the error is returned. 950func (iter *PeeringPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { 951 if tracing.IsEnabled() { 952 ctx = tracing.StartSpan(ctx, fqdn+"/PeeringPolicyListResultIterator.NextWithContext") 953 defer func() { 954 sc := -1 955 if iter.Response().Response.Response != nil { 956 sc = iter.Response().Response.Response.StatusCode 957 } 958 tracing.EndSpan(ctx, sc, err) 959 }() 960 } 961 iter.i++ 962 if iter.i < len(iter.page.Values()) { 963 return nil 964 } 965 err = iter.page.NextWithContext(ctx) 966 if err != nil { 967 iter.i-- 968 return err 969 } 970 iter.i = 0 971 return nil 972} 973 974// Next advances to the next value. If there was an error making 975// the request the iterator does not advance and the error is returned. 976// Deprecated: Use NextWithContext() instead. 977func (iter *PeeringPolicyListResultIterator) Next() error { 978 return iter.NextWithContext(context.Background()) 979} 980 981// NotDone returns true if the enumeration should be started or is not yet complete. 982func (iter PeeringPolicyListResultIterator) NotDone() bool { 983 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 984} 985 986// Response returns the raw server response from the last page request. 987func (iter PeeringPolicyListResultIterator) Response() PeeringPolicyListResult { 988 return iter.page.Response() 989} 990 991// Value returns the current value or a zero-initialized value if the 992// iterator has advanced beyond the end of the collection. 993func (iter PeeringPolicyListResultIterator) Value() PeeringPolicy { 994 if !iter.page.NotDone() { 995 return PeeringPolicy{} 996 } 997 return iter.page.Values()[iter.i] 998} 999 1000// Creates a new instance of the PeeringPolicyListResultIterator type. 1001func NewPeeringPolicyListResultIterator(page PeeringPolicyListResultPage) PeeringPolicyListResultIterator { 1002 return PeeringPolicyListResultIterator{page: page} 1003} 1004 1005// IsEmpty returns true if the ListResult contains no values. 1006func (pplr PeeringPolicyListResult) IsEmpty() bool { 1007 return pplr.Value == nil || len(*pplr.Value) == 0 1008} 1009 1010// hasNextLink returns true if the NextLink is not empty. 1011func (pplr PeeringPolicyListResult) hasNextLink() bool { 1012 return pplr.NextLink != nil && len(*pplr.NextLink) != 0 1013} 1014 1015// peeringPolicyListResultPreparer prepares a request to retrieve the next set of results. 1016// It returns nil if no more results exist. 1017func (pplr PeeringPolicyListResult) peeringPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { 1018 if !pplr.hasNextLink() { 1019 return nil, nil 1020 } 1021 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1022 autorest.AsJSON(), 1023 autorest.AsGet(), 1024 autorest.WithBaseURL(to.String(pplr.NextLink))) 1025} 1026 1027// PeeringPolicyListResultPage contains a page of PeeringPolicy values. 1028type PeeringPolicyListResultPage struct { 1029 fn func(context.Context, PeeringPolicyListResult) (PeeringPolicyListResult, error) 1030 pplr PeeringPolicyListResult 1031} 1032 1033// NextWithContext advances to the next page of values. If there was an error making 1034// the request the page does not advance and the error is returned. 1035func (page *PeeringPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { 1036 if tracing.IsEnabled() { 1037 ctx = tracing.StartSpan(ctx, fqdn+"/PeeringPolicyListResultPage.NextWithContext") 1038 defer func() { 1039 sc := -1 1040 if page.Response().Response.Response != nil { 1041 sc = page.Response().Response.Response.StatusCode 1042 } 1043 tracing.EndSpan(ctx, sc, err) 1044 }() 1045 } 1046 for { 1047 next, err := page.fn(ctx, page.pplr) 1048 if err != nil { 1049 return err 1050 } 1051 page.pplr = next 1052 if !next.hasNextLink() || !next.IsEmpty() { 1053 break 1054 } 1055 } 1056 return nil 1057} 1058 1059// Next advances to the next page of values. If there was an error making 1060// the request the page does not advance and the error is returned. 1061// Deprecated: Use NextWithContext() instead. 1062func (page *PeeringPolicyListResultPage) Next() error { 1063 return page.NextWithContext(context.Background()) 1064} 1065 1066// NotDone returns true if the page enumeration should be started or is not yet complete. 1067func (page PeeringPolicyListResultPage) NotDone() bool { 1068 return !page.pplr.IsEmpty() 1069} 1070 1071// Response returns the raw server response from the last page request. 1072func (page PeeringPolicyListResultPage) Response() PeeringPolicyListResult { 1073 return page.pplr 1074} 1075 1076// Values returns the slice of values for the current page or nil if there are no values. 1077func (page PeeringPolicyListResultPage) Values() []PeeringPolicy { 1078 if page.pplr.IsEmpty() { 1079 return nil 1080 } 1081 return *page.pplr.Value 1082} 1083 1084// Creates a new instance of the PeeringPolicyListResultPage type. 1085func NewPeeringPolicyListResultPage(cur PeeringPolicyListResult, getNextPage func(context.Context, PeeringPolicyListResult) (PeeringPolicyListResult, error)) PeeringPolicyListResultPage { 1086 return PeeringPolicyListResultPage{ 1087 fn: getNextPage, 1088 pplr: cur, 1089 } 1090} 1091 1092// PeeringPolicyProperties properties of a Managed Network Peering Policy 1093type PeeringPolicyProperties struct { 1094 // Type - Gets or sets the connectivity type of a network structure policy. Possible values include: 'HubAndSpokeTopology', 'MeshTopology' 1095 Type Type `json:"type,omitempty"` 1096 // Hub - Gets or sets the hub virtual network ID 1097 Hub *ResourceID `json:"hub,omitempty"` 1098 // Spokes - Gets or sets the spokes group IDs 1099 Spokes *[]ResourceID `json:"spokes,omitempty"` 1100 // Mesh - Gets or sets the mesh group IDs 1101 Mesh *[]ResourceID `json:"mesh,omitempty"` 1102 // ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' 1103 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1104 // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. 1105 Etag *string `json:"etag,omitempty"` 1106} 1107 1108// MarshalJSON is the custom marshaler for PeeringPolicyProperties. 1109func (ppp PeeringPolicyProperties) MarshalJSON() ([]byte, error) { 1110 objectMap := make(map[string]interface{}) 1111 if ppp.Type != "" { 1112 objectMap["type"] = ppp.Type 1113 } 1114 if ppp.Hub != nil { 1115 objectMap["hub"] = ppp.Hub 1116 } 1117 if ppp.Spokes != nil { 1118 objectMap["spokes"] = ppp.Spokes 1119 } 1120 if ppp.Mesh != nil { 1121 objectMap["mesh"] = ppp.Mesh 1122 } 1123 return json.Marshal(objectMap) 1124} 1125 1126// Properties properties of Managed Network 1127type Properties struct { 1128 // Scope - The collection of management groups, subscriptions, virtual networks, and subnets by the Managed Network. This is a read-only property that is reflective of all ScopeAssignments for this Managed Network 1129 Scope *Scope `json:"scope,omitempty"` 1130 // Connectivity - READ-ONLY; The collection of groups and policies concerned with connectivity 1131 Connectivity *ConnectivityCollection `json:"connectivity,omitempty"` 1132 // ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' 1133 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1134 // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. 1135 Etag *string `json:"etag,omitempty"` 1136} 1137 1138// MarshalJSON is the custom marshaler for Properties. 1139func (p Properties) MarshalJSON() ([]byte, error) { 1140 objectMap := make(map[string]interface{}) 1141 if p.Scope != nil { 1142 objectMap["scope"] = p.Scope 1143 } 1144 return json.Marshal(objectMap) 1145} 1146 1147// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than 1148// required location and tags 1149type ProxyResource struct { 1150 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1151 ID *string `json:"id,omitempty"` 1152 // Name - READ-ONLY; The name of the resource 1153 Name *string `json:"name,omitempty"` 1154 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1155 Type *string `json:"type,omitempty"` 1156 // Location - The geo-location where the resource lives 1157 Location *string `json:"location,omitempty"` 1158} 1159 1160// MarshalJSON is the custom marshaler for ProxyResource. 1161func (pr ProxyResource) MarshalJSON() ([]byte, error) { 1162 objectMap := make(map[string]interface{}) 1163 if pr.Location != nil { 1164 objectMap["location"] = pr.Location 1165 } 1166 return json.Marshal(objectMap) 1167} 1168 1169// Resource the general resource model definition 1170type Resource struct { 1171 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1172 ID *string `json:"id,omitempty"` 1173 // Name - READ-ONLY; The name of the resource 1174 Name *string `json:"name,omitempty"` 1175 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1176 Type *string `json:"type,omitempty"` 1177 // Location - The geo-location where the resource lives 1178 Location *string `json:"location,omitempty"` 1179} 1180 1181// MarshalJSON is the custom marshaler for Resource. 1182func (r Resource) MarshalJSON() ([]byte, error) { 1183 objectMap := make(map[string]interface{}) 1184 if r.Location != nil { 1185 objectMap["location"] = r.Location 1186 } 1187 return json.Marshal(objectMap) 1188} 1189 1190// ResourceID generic pointer to a resource 1191type ResourceID struct { 1192 // ID - Resource Id 1193 ID *string `json:"id,omitempty"` 1194} 1195 1196// ResourceProperties base for resource properties. 1197type ResourceProperties struct { 1198 // ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' 1199 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1200 // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. 1201 Etag *string `json:"etag,omitempty"` 1202} 1203 1204// Scope scope of a Managed Network 1205type Scope struct { 1206 // ManagementGroups - The collection of management groups covered by the Managed Network 1207 ManagementGroups *[]ResourceID `json:"managementGroups,omitempty"` 1208 // Subscriptions - The collection of subscriptions covered by the Managed Network 1209 Subscriptions *[]ResourceID `json:"subscriptions,omitempty"` 1210 // VirtualNetworks - The collection of virtual nets covered by the Managed Network 1211 VirtualNetworks *[]ResourceID `json:"virtualNetworks,omitempty"` 1212 // Subnets - The collection of subnets covered by the Managed Network 1213 Subnets *[]ResourceID `json:"subnets,omitempty"` 1214} 1215 1216// ScopeAssignment the Managed Network resource 1217type ScopeAssignment struct { 1218 autorest.Response `json:"-"` 1219 // ScopeAssignmentProperties - The Scope Assignment properties 1220 *ScopeAssignmentProperties `json:"properties,omitempty"` 1221 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1222 ID *string `json:"id,omitempty"` 1223 // Name - READ-ONLY; The name of the resource 1224 Name *string `json:"name,omitempty"` 1225 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1226 Type *string `json:"type,omitempty"` 1227 // Location - The geo-location where the resource lives 1228 Location *string `json:"location,omitempty"` 1229} 1230 1231// MarshalJSON is the custom marshaler for ScopeAssignment. 1232func (sa ScopeAssignment) MarshalJSON() ([]byte, error) { 1233 objectMap := make(map[string]interface{}) 1234 if sa.ScopeAssignmentProperties != nil { 1235 objectMap["properties"] = sa.ScopeAssignmentProperties 1236 } 1237 if sa.Location != nil { 1238 objectMap["location"] = sa.Location 1239 } 1240 return json.Marshal(objectMap) 1241} 1242 1243// UnmarshalJSON is the custom unmarshaler for ScopeAssignment struct. 1244func (sa *ScopeAssignment) UnmarshalJSON(body []byte) error { 1245 var m map[string]*json.RawMessage 1246 err := json.Unmarshal(body, &m) 1247 if err != nil { 1248 return err 1249 } 1250 for k, v := range m { 1251 switch k { 1252 case "properties": 1253 if v != nil { 1254 var scopeAssignmentProperties ScopeAssignmentProperties 1255 err = json.Unmarshal(*v, &scopeAssignmentProperties) 1256 if err != nil { 1257 return err 1258 } 1259 sa.ScopeAssignmentProperties = &scopeAssignmentProperties 1260 } 1261 case "id": 1262 if v != nil { 1263 var ID string 1264 err = json.Unmarshal(*v, &ID) 1265 if err != nil { 1266 return err 1267 } 1268 sa.ID = &ID 1269 } 1270 case "name": 1271 if v != nil { 1272 var name string 1273 err = json.Unmarshal(*v, &name) 1274 if err != nil { 1275 return err 1276 } 1277 sa.Name = &name 1278 } 1279 case "type": 1280 if v != nil { 1281 var typeVar string 1282 err = json.Unmarshal(*v, &typeVar) 1283 if err != nil { 1284 return err 1285 } 1286 sa.Type = &typeVar 1287 } 1288 case "location": 1289 if v != nil { 1290 var location string 1291 err = json.Unmarshal(*v, &location) 1292 if err != nil { 1293 return err 1294 } 1295 sa.Location = &location 1296 } 1297 } 1298 } 1299 1300 return nil 1301} 1302 1303// ScopeAssignmentListResult result of the request to list ScopeAssignment. It contains a list of groups 1304// and a URL link to get the next set of results. 1305type ScopeAssignmentListResult struct { 1306 autorest.Response `json:"-"` 1307 // Value - Gets a page of ScopeAssignment 1308 Value *[]ScopeAssignment `json:"value,omitempty"` 1309 // NextLink - Gets the URL to get the next set of results. 1310 NextLink *string `json:"nextLink,omitempty"` 1311} 1312 1313// ScopeAssignmentListResultIterator provides access to a complete listing of ScopeAssignment values. 1314type ScopeAssignmentListResultIterator struct { 1315 i int 1316 page ScopeAssignmentListResultPage 1317} 1318 1319// NextWithContext advances to the next value. If there was an error making 1320// the request the iterator does not advance and the error is returned. 1321func (iter *ScopeAssignmentListResultIterator) NextWithContext(ctx context.Context) (err error) { 1322 if tracing.IsEnabled() { 1323 ctx = tracing.StartSpan(ctx, fqdn+"/ScopeAssignmentListResultIterator.NextWithContext") 1324 defer func() { 1325 sc := -1 1326 if iter.Response().Response.Response != nil { 1327 sc = iter.Response().Response.Response.StatusCode 1328 } 1329 tracing.EndSpan(ctx, sc, err) 1330 }() 1331 } 1332 iter.i++ 1333 if iter.i < len(iter.page.Values()) { 1334 return nil 1335 } 1336 err = iter.page.NextWithContext(ctx) 1337 if err != nil { 1338 iter.i-- 1339 return err 1340 } 1341 iter.i = 0 1342 return nil 1343} 1344 1345// Next advances to the next value. If there was an error making 1346// the request the iterator does not advance and the error is returned. 1347// Deprecated: Use NextWithContext() instead. 1348func (iter *ScopeAssignmentListResultIterator) Next() error { 1349 return iter.NextWithContext(context.Background()) 1350} 1351 1352// NotDone returns true if the enumeration should be started or is not yet complete. 1353func (iter ScopeAssignmentListResultIterator) NotDone() bool { 1354 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1355} 1356 1357// Response returns the raw server response from the last page request. 1358func (iter ScopeAssignmentListResultIterator) Response() ScopeAssignmentListResult { 1359 return iter.page.Response() 1360} 1361 1362// Value returns the current value or a zero-initialized value if the 1363// iterator has advanced beyond the end of the collection. 1364func (iter ScopeAssignmentListResultIterator) Value() ScopeAssignment { 1365 if !iter.page.NotDone() { 1366 return ScopeAssignment{} 1367 } 1368 return iter.page.Values()[iter.i] 1369} 1370 1371// Creates a new instance of the ScopeAssignmentListResultIterator type. 1372func NewScopeAssignmentListResultIterator(page ScopeAssignmentListResultPage) ScopeAssignmentListResultIterator { 1373 return ScopeAssignmentListResultIterator{page: page} 1374} 1375 1376// IsEmpty returns true if the ListResult contains no values. 1377func (salr ScopeAssignmentListResult) IsEmpty() bool { 1378 return salr.Value == nil || len(*salr.Value) == 0 1379} 1380 1381// hasNextLink returns true if the NextLink is not empty. 1382func (salr ScopeAssignmentListResult) hasNextLink() bool { 1383 return salr.NextLink != nil && len(*salr.NextLink) != 0 1384} 1385 1386// scopeAssignmentListResultPreparer prepares a request to retrieve the next set of results. 1387// It returns nil if no more results exist. 1388func (salr ScopeAssignmentListResult) scopeAssignmentListResultPreparer(ctx context.Context) (*http.Request, error) { 1389 if !salr.hasNextLink() { 1390 return nil, nil 1391 } 1392 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1393 autorest.AsJSON(), 1394 autorest.AsGet(), 1395 autorest.WithBaseURL(to.String(salr.NextLink))) 1396} 1397 1398// ScopeAssignmentListResultPage contains a page of ScopeAssignment values. 1399type ScopeAssignmentListResultPage struct { 1400 fn func(context.Context, ScopeAssignmentListResult) (ScopeAssignmentListResult, error) 1401 salr ScopeAssignmentListResult 1402} 1403 1404// NextWithContext advances to the next page of values. If there was an error making 1405// the request the page does not advance and the error is returned. 1406func (page *ScopeAssignmentListResultPage) NextWithContext(ctx context.Context) (err error) { 1407 if tracing.IsEnabled() { 1408 ctx = tracing.StartSpan(ctx, fqdn+"/ScopeAssignmentListResultPage.NextWithContext") 1409 defer func() { 1410 sc := -1 1411 if page.Response().Response.Response != nil { 1412 sc = page.Response().Response.Response.StatusCode 1413 } 1414 tracing.EndSpan(ctx, sc, err) 1415 }() 1416 } 1417 for { 1418 next, err := page.fn(ctx, page.salr) 1419 if err != nil { 1420 return err 1421 } 1422 page.salr = next 1423 if !next.hasNextLink() || !next.IsEmpty() { 1424 break 1425 } 1426 } 1427 return nil 1428} 1429 1430// Next 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. 1432// Deprecated: Use NextWithContext() instead. 1433func (page *ScopeAssignmentListResultPage) Next() error { 1434 return page.NextWithContext(context.Background()) 1435} 1436 1437// NotDone returns true if the page enumeration should be started or is not yet complete. 1438func (page ScopeAssignmentListResultPage) NotDone() bool { 1439 return !page.salr.IsEmpty() 1440} 1441 1442// Response returns the raw server response from the last page request. 1443func (page ScopeAssignmentListResultPage) Response() ScopeAssignmentListResult { 1444 return page.salr 1445} 1446 1447// Values returns the slice of values for the current page or nil if there are no values. 1448func (page ScopeAssignmentListResultPage) Values() []ScopeAssignment { 1449 if page.salr.IsEmpty() { 1450 return nil 1451 } 1452 return *page.salr.Value 1453} 1454 1455// Creates a new instance of the ScopeAssignmentListResultPage type. 1456func NewScopeAssignmentListResultPage(cur ScopeAssignmentListResult, getNextPage func(context.Context, ScopeAssignmentListResult) (ScopeAssignmentListResult, error)) ScopeAssignmentListResultPage { 1457 return ScopeAssignmentListResultPage{ 1458 fn: getNextPage, 1459 salr: cur, 1460 } 1461} 1462 1463// ScopeAssignmentProperties properties of Managed Network 1464type ScopeAssignmentProperties struct { 1465 // AssignedManagedNetwork - The managed network ID with scope will be assigned to. 1466 AssignedManagedNetwork *string `json:"assignedManagedNetwork,omitempty"` 1467 // ProvisioningState - READ-ONLY; Provisioning state of the ManagedNetwork resource. Possible values include: 'Updating', 'Deleting', 'Failed', 'Succeeded' 1468 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1469 // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. 1470 Etag *string `json:"etag,omitempty"` 1471} 1472 1473// MarshalJSON is the custom marshaler for ScopeAssignmentProperties. 1474func (sap ScopeAssignmentProperties) MarshalJSON() ([]byte, error) { 1475 objectMap := make(map[string]interface{}) 1476 if sap.AssignedManagedNetwork != nil { 1477 objectMap["assignedManagedNetwork"] = sap.AssignedManagedNetwork 1478 } 1479 return json.Marshal(objectMap) 1480} 1481 1482// TrackedResource the resource model definition for a ARM tracked top level resource 1483type TrackedResource struct { 1484 // Tags - Resource tags 1485 Tags map[string]*string `json:"tags"` 1486 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1487 ID *string `json:"id,omitempty"` 1488 // Name - READ-ONLY; The name of the resource 1489 Name *string `json:"name,omitempty"` 1490 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1491 Type *string `json:"type,omitempty"` 1492 // Location - The geo-location where the resource lives 1493 Location *string `json:"location,omitempty"` 1494} 1495 1496// MarshalJSON is the custom marshaler for TrackedResource. 1497func (tr TrackedResource) MarshalJSON() ([]byte, error) { 1498 objectMap := make(map[string]interface{}) 1499 if tr.Tags != nil { 1500 objectMap["tags"] = tr.Tags 1501 } 1502 if tr.Location != nil { 1503 objectMap["location"] = tr.Location 1504 } 1505 return json.Marshal(objectMap) 1506} 1507 1508// Update update Tags of Managed Network 1509type Update struct { 1510 // Tags - Resource tags 1511 Tags map[string]*string `json:"tags"` 1512} 1513 1514// MarshalJSON is the custom marshaler for Update. 1515func (u Update) MarshalJSON() ([]byte, error) { 1516 objectMap := make(map[string]interface{}) 1517 if u.Tags != nil { 1518 objectMap["tags"] = u.Tags 1519 } 1520 return json.Marshal(objectMap) 1521} 1522