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