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/2020-02-01/managementgroups" 33 34// InheritedPermissions enumerates the values for inherited permissions. 35type InheritedPermissions string 36 37const ( 38 // Delete ... 39 Delete InheritedPermissions = "delete" 40 // Edit ... 41 Edit InheritedPermissions = "edit" 42 // Noaccess ... 43 Noaccess InheritedPermissions = "noaccess" 44 // View ... 45 View InheritedPermissions = "view" 46) 47 48// PossibleInheritedPermissionsValues returns an array of possible values for the InheritedPermissions const type. 49func PossibleInheritedPermissionsValues() []InheritedPermissions { 50 return []InheritedPermissions{Delete, Edit, Noaccess, View} 51} 52 53// Permissions enumerates the values for permissions. 54type Permissions string 55 56const ( 57 // PermissionsDelete ... 58 PermissionsDelete Permissions = "delete" 59 // PermissionsEdit ... 60 PermissionsEdit Permissions = "edit" 61 // PermissionsNoaccess ... 62 PermissionsNoaccess Permissions = "noaccess" 63 // PermissionsView ... 64 PermissionsView Permissions = "view" 65) 66 67// PossiblePermissionsValues returns an array of possible values for the Permissions const type. 68func PossiblePermissionsValues() []Permissions { 69 return []Permissions{PermissionsDelete, PermissionsEdit, PermissionsNoaccess, PermissionsView} 70} 71 72// Permissions1 enumerates the values for permissions 1. 73type Permissions1 string 74 75const ( 76 // Permissions1Delete ... 77 Permissions1Delete Permissions1 = "delete" 78 // Permissions1Edit ... 79 Permissions1Edit Permissions1 = "edit" 80 // Permissions1Noaccess ... 81 Permissions1Noaccess Permissions1 = "noaccess" 82 // Permissions1View ... 83 Permissions1View Permissions1 = "view" 84) 85 86// PossiblePermissions1Values returns an array of possible values for the Permissions1 const type. 87func PossiblePermissions1Values() []Permissions1 { 88 return []Permissions1{Permissions1Delete, Permissions1Edit, Permissions1Noaccess, Permissions1View} 89} 90 91// Reason enumerates the values for reason. 92type Reason string 93 94const ( 95 // AlreadyExists ... 96 AlreadyExists Reason = "AlreadyExists" 97 // Invalid ... 98 Invalid Reason = "Invalid" 99) 100 101// PossibleReasonValues returns an array of possible values for the Reason const type. 102func PossibleReasonValues() []Reason { 103 return []Reason{AlreadyExists, Invalid} 104} 105 106// Status enumerates the values for status. 107type Status string 108 109const ( 110 // Cancelled ... 111 Cancelled Status = "Cancelled" 112 // Completed ... 113 Completed Status = "Completed" 114 // Failed ... 115 Failed Status = "Failed" 116 // NotStarted ... 117 NotStarted Status = "NotStarted" 118 // NotStartedButGroupsExist ... 119 NotStartedButGroupsExist Status = "NotStartedButGroupsExist" 120 // Started ... 121 Started Status = "Started" 122) 123 124// PossibleStatusValues returns an array of possible values for the Status const type. 125func PossibleStatusValues() []Status { 126 return []Status{Cancelled, Completed, Failed, NotStarted, NotStartedButGroupsExist, Started} 127} 128 129// Type enumerates the values for type. 130type Type string 131 132const ( 133 // MicrosoftManagementmanagementGroup ... 134 MicrosoftManagementmanagementGroup Type = "Microsoft.Management/managementGroup" 135) 136 137// PossibleTypeValues returns an array of possible values for the Type const type. 138func PossibleTypeValues() []Type { 139 return []Type{MicrosoftManagementmanagementGroup} 140} 141 142// Type1 enumerates the values for type 1. 143type Type1 string 144 145const ( 146 // MicrosoftManagementmanagementGroups ... 147 MicrosoftManagementmanagementGroups Type1 = "Microsoft.Management/managementGroups" 148 // Subscriptions ... 149 Subscriptions Type1 = "/subscriptions" 150) 151 152// PossibleType1Values returns an array of possible values for the Type1 const type. 153func PossibleType1Values() []Type1 { 154 return []Type1{MicrosoftManagementmanagementGroups, Subscriptions} 155} 156 157// Type2 enumerates the values for type 2. 158type Type2 string 159 160const ( 161 // Type2MicrosoftManagementmanagementGroups ... 162 Type2MicrosoftManagementmanagementGroups Type2 = "Microsoft.Management/managementGroups" 163 // Type2Subscriptions ... 164 Type2Subscriptions Type2 = "/subscriptions" 165) 166 167// PossibleType2Values returns an array of possible values for the Type2 const type. 168func PossibleType2Values() []Type2 { 169 return []Type2{Type2MicrosoftManagementmanagementGroups, Type2Subscriptions} 170} 171 172// AzureAsyncOperationResults the results of Azure-AsyncOperation. 173type AzureAsyncOperationResults struct { 174 autorest.Response `json:"-"` 175 // ID - READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 176 ID *string `json:"id,omitempty"` 177 // Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups 178 Type *string `json:"type,omitempty"` 179 // Name - READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 180 Name *string `json:"name,omitempty"` 181 // Status - READ-ONLY; The current status of the asynchronous operation performed . For example, Running, Succeeded, Failed 182 Status *string `json:"status,omitempty"` 183 *InfoProperties `json:"properties,omitempty"` 184} 185 186// MarshalJSON is the custom marshaler for AzureAsyncOperationResults. 187func (aaor AzureAsyncOperationResults) MarshalJSON() ([]byte, error) { 188 objectMap := make(map[string]interface{}) 189 if aaor.InfoProperties != nil { 190 objectMap["properties"] = aaor.InfoProperties 191 } 192 return json.Marshal(objectMap) 193} 194 195// UnmarshalJSON is the custom unmarshaler for AzureAsyncOperationResults struct. 196func (aaor *AzureAsyncOperationResults) UnmarshalJSON(body []byte) error { 197 var m map[string]*json.RawMessage 198 err := json.Unmarshal(body, &m) 199 if err != nil { 200 return err 201 } 202 for k, v := range m { 203 switch k { 204 case "id": 205 if v != nil { 206 var ID string 207 err = json.Unmarshal(*v, &ID) 208 if err != nil { 209 return err 210 } 211 aaor.ID = &ID 212 } 213 case "type": 214 if v != nil { 215 var typeVar string 216 err = json.Unmarshal(*v, &typeVar) 217 if err != nil { 218 return err 219 } 220 aaor.Type = &typeVar 221 } 222 case "name": 223 if v != nil { 224 var name string 225 err = json.Unmarshal(*v, &name) 226 if err != nil { 227 return err 228 } 229 aaor.Name = &name 230 } 231 case "status": 232 if v != nil { 233 var status string 234 err = json.Unmarshal(*v, &status) 235 if err != nil { 236 return err 237 } 238 aaor.Status = &status 239 } 240 case "properties": 241 if v != nil { 242 var infoProperties InfoProperties 243 err = json.Unmarshal(*v, &infoProperties) 244 if err != nil { 245 return err 246 } 247 aaor.InfoProperties = &infoProperties 248 } 249 } 250 } 251 252 return nil 253} 254 255// CheckNameAvailabilityRequest management group name availability check parameters. 256type CheckNameAvailabilityRequest struct { 257 // Name - the name to check for availability 258 Name *string `json:"name,omitempty"` 259 // Type - fully qualified resource type which includes provider namespace. Possible values include: 'MicrosoftManagementmanagementGroup' 260 Type Type `json:"type,omitempty"` 261} 262 263// CheckNameAvailabilityResult describes the result of the request to check management group name 264// availability. 265type CheckNameAvailabilityResult struct { 266 autorest.Response `json:"-"` 267 // NameAvailable - READ-ONLY; Required. True indicates name is valid and available. False indicates the name is invalid, unavailable, or both. 268 NameAvailable *bool `json:"nameAvailable,omitempty"` 269 // 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' 270 Reason Reason `json:"reason,omitempty"` 271 // 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. 272 Message *string `json:"message,omitempty"` 273} 274 275// ChildInfo the child information of a management group. 276type ChildInfo struct { 277 // Type - The fully qualified resource type which includes provider namespace (e.g. Microsoft.Management/managementGroups). Possible values include: 'MicrosoftManagementmanagementGroups', 'Subscriptions' 278 Type Type1 `json:"type,omitempty"` 279 // ID - The fully qualified ID for the child resource (management group or subscription). For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 280 ID *string `json:"id,omitempty"` 281 // Name - The name of the child entity. 282 Name *string `json:"name,omitempty"` 283 // DisplayName - The friendly name of the child resource. 284 DisplayName *string `json:"displayName,omitempty"` 285 // Roles - The roles definitions associated with the management group. 286 Roles *[]string `json:"roles,omitempty"` 287 // Children - The list of children. 288 Children *[]ChildInfo `json:"children,omitempty"` 289} 290 291// CreateManagementGroupChildInfo the child information of a management group used during creation. 292type CreateManagementGroupChildInfo struct { 293 // Type - READ-ONLY; The fully qualified resource type which includes provider namespace (e.g. Microsoft.Management/managementGroups). Possible values include: 'Type2MicrosoftManagementmanagementGroups', 'Type2Subscriptions' 294 Type Type2 `json:"type,omitempty"` 295 // 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 296 ID *string `json:"id,omitempty"` 297 // Name - READ-ONLY; The name of the child entity. 298 Name *string `json:"name,omitempty"` 299 // DisplayName - READ-ONLY; The friendly name of the child resource. 300 DisplayName *string `json:"displayName,omitempty"` 301 // Roles - READ-ONLY; The roles definitions associated with the management group. 302 Roles *[]string `json:"roles,omitempty"` 303 // Children - READ-ONLY; The list of children. 304 Children *[]CreateManagementGroupChildInfo `json:"children,omitempty"` 305} 306 307// CreateManagementGroupDetails the details of a management group used during creation. 308type CreateManagementGroupDetails struct { 309 // Version - READ-ONLY; The version number of the object. 310 Version *float64 `json:"version,omitempty"` 311 // UpdatedTime - READ-ONLY; The date and time when this object was last updated. 312 UpdatedTime *date.Time `json:"updatedTime,omitempty"` 313 // UpdatedBy - READ-ONLY; The identity of the principal or process that updated the object. 314 UpdatedBy *string `json:"updatedBy,omitempty"` 315 Parent *CreateParentGroupInfo `json:"parent,omitempty"` 316} 317 318// CreateManagementGroupProperties the generic properties of a management group used during creation. 319type CreateManagementGroupProperties struct { 320 // TenantID - READ-ONLY; The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 321 TenantID *string `json:"tenantId,omitempty"` 322 // DisplayName - The friendly name of the management group. If no value is passed then this field will be set to the groupId. 323 DisplayName *string `json:"displayName,omitempty"` 324 // Roles - READ-ONLY; The roles definitions associated with the management group. 325 Roles *[]string `json:"roles,omitempty"` 326 Details *CreateManagementGroupDetails `json:"details,omitempty"` 327 // Children - READ-ONLY; The list of children. 328 Children *[]CreateManagementGroupChildInfo `json:"children,omitempty"` 329} 330 331// CreateManagementGroupRequest management group creation parameters. 332type CreateManagementGroupRequest struct { 333 // ID - READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 334 ID *string `json:"id,omitempty"` 335 // Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups 336 Type *string `json:"type,omitempty"` 337 // Name - The name of the management group. For example, 00000000-0000-0000-0000-000000000000 338 Name *string `json:"name,omitempty"` 339 *CreateManagementGroupProperties `json:"properties,omitempty"` 340} 341 342// MarshalJSON is the custom marshaler for CreateManagementGroupRequest. 343func (cmgr CreateManagementGroupRequest) MarshalJSON() ([]byte, error) { 344 objectMap := make(map[string]interface{}) 345 if cmgr.Name != nil { 346 objectMap["name"] = cmgr.Name 347 } 348 if cmgr.CreateManagementGroupProperties != nil { 349 objectMap["properties"] = cmgr.CreateManagementGroupProperties 350 } 351 return json.Marshal(objectMap) 352} 353 354// UnmarshalJSON is the custom unmarshaler for CreateManagementGroupRequest struct. 355func (cmgr *CreateManagementGroupRequest) UnmarshalJSON(body []byte) error { 356 var m map[string]*json.RawMessage 357 err := json.Unmarshal(body, &m) 358 if err != nil { 359 return err 360 } 361 for k, v := range m { 362 switch k { 363 case "id": 364 if v != nil { 365 var ID string 366 err = json.Unmarshal(*v, &ID) 367 if err != nil { 368 return err 369 } 370 cmgr.ID = &ID 371 } 372 case "type": 373 if v != nil { 374 var typeVar string 375 err = json.Unmarshal(*v, &typeVar) 376 if err != nil { 377 return err 378 } 379 cmgr.Type = &typeVar 380 } 381 case "name": 382 if v != nil { 383 var name string 384 err = json.Unmarshal(*v, &name) 385 if err != nil { 386 return err 387 } 388 cmgr.Name = &name 389 } 390 case "properties": 391 if v != nil { 392 var createManagementGroupProperties CreateManagementGroupProperties 393 err = json.Unmarshal(*v, &createManagementGroupProperties) 394 if err != nil { 395 return err 396 } 397 cmgr.CreateManagementGroupProperties = &createManagementGroupProperties 398 } 399 } 400 } 401 402 return nil 403} 404 405// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 406// operation. 407type CreateOrUpdateFuture struct { 408 azure.Future 409} 410 411// Result returns the result of the asynchronous operation. 412// If the operation has not completed it will return an error. 413func (future *CreateOrUpdateFuture) Result(client Client) (so SetObject, err error) { 414 var done bool 415 done, err = future.DoneWithContext(context.Background(), client) 416 if err != nil { 417 err = autorest.NewErrorWithError(err, "managementgroups.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 418 return 419 } 420 if !done { 421 err = azure.NewAsyncOpIncompleteError("managementgroups.CreateOrUpdateFuture") 422 return 423 } 424 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 425 if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { 426 so, err = client.CreateOrUpdateResponder(so.Response.Response) 427 if err != nil { 428 err = autorest.NewErrorWithError(err, "managementgroups.CreateOrUpdateFuture", "Result", so.Response.Response, "Failure responding to request") 429 } 430 } 431 return 432} 433 434// CreateOrUpdateSettingsProperties the properties of the request to create or update Management Group 435// settings 436type CreateOrUpdateSettingsProperties struct { 437 // RequireAuthorizationForGroupCreation - Indicates whether RBAC access is required upon group creation under the root Management Group. If set to true, user will require Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are given access. 438 RequireAuthorizationForGroupCreation *bool `json:"requireAuthorizationForGroupCreation,omitempty"` 439 // DefaultManagementGroup - Settings that sets the default Management Group under which new subscriptions get added in this tenant. For example, /providers/Microsoft.Management/managementGroups/defaultGroup 440 DefaultManagementGroup *string `json:"defaultManagementGroup,omitempty"` 441} 442 443// CreateOrUpdateSettingsRequest parameters for creating or updating Management Group settings 444type CreateOrUpdateSettingsRequest struct { 445 *CreateOrUpdateSettingsProperties `json:"properties,omitempty"` 446} 447 448// MarshalJSON is the custom marshaler for CreateOrUpdateSettingsRequest. 449func (cousr CreateOrUpdateSettingsRequest) MarshalJSON() ([]byte, error) { 450 objectMap := make(map[string]interface{}) 451 if cousr.CreateOrUpdateSettingsProperties != nil { 452 objectMap["properties"] = cousr.CreateOrUpdateSettingsProperties 453 } 454 return json.Marshal(objectMap) 455} 456 457// UnmarshalJSON is the custom unmarshaler for CreateOrUpdateSettingsRequest struct. 458func (cousr *CreateOrUpdateSettingsRequest) UnmarshalJSON(body []byte) error { 459 var m map[string]*json.RawMessage 460 err := json.Unmarshal(body, &m) 461 if err != nil { 462 return err 463 } 464 for k, v := range m { 465 switch k { 466 case "properties": 467 if v != nil { 468 var createOrUpdateSettingsProperties CreateOrUpdateSettingsProperties 469 err = json.Unmarshal(*v, &createOrUpdateSettingsProperties) 470 if err != nil { 471 return err 472 } 473 cousr.CreateOrUpdateSettingsProperties = &createOrUpdateSettingsProperties 474 } 475 } 476 } 477 478 return nil 479} 480 481// CreateParentGroupInfo (Optional) The ID of the parent management group used during creation. 482type CreateParentGroupInfo struct { 483 // ID - The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 484 ID *string `json:"id,omitempty"` 485 // Name - READ-ONLY; The name of the parent management group 486 Name *string `json:"name,omitempty"` 487 // DisplayName - READ-ONLY; The friendly name of the parent management group. 488 DisplayName *string `json:"displayName,omitempty"` 489} 490 491// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 492type DeleteFuture struct { 493 azure.Future 494} 495 496// Result returns the result of the asynchronous operation. 497// If the operation has not completed it will return an error. 498func (future *DeleteFuture) Result(client Client) (aaor AzureAsyncOperationResults, err error) { 499 var done bool 500 done, err = future.DoneWithContext(context.Background(), client) 501 if err != nil { 502 err = autorest.NewErrorWithError(err, "managementgroups.DeleteFuture", "Result", future.Response(), "Polling failure") 503 return 504 } 505 if !done { 506 err = azure.NewAsyncOpIncompleteError("managementgroups.DeleteFuture") 507 return 508 } 509 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 510 if aaor.Response.Response, err = future.GetResult(sender); err == nil && aaor.Response.Response.StatusCode != http.StatusNoContent { 511 aaor, err = client.DeleteResponder(aaor.Response.Response) 512 if err != nil { 513 err = autorest.NewErrorWithError(err, "managementgroups.DeleteFuture", "Result", aaor.Response.Response, "Failure responding to request") 514 } 515 } 516 return 517} 518 519// DescendantInfo the descendant. 520type DescendantInfo struct { 521 // 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 522 ID *string `json:"id,omitempty"` 523 // Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups or /subscriptions 524 Type *string `json:"type,omitempty"` 525 // Name - READ-ONLY; The name of the descendant. For example, 00000000-0000-0000-0000-000000000000 526 Name *string `json:"name,omitempty"` 527 *DescendantInfoProperties `json:"properties,omitempty"` 528} 529 530// MarshalJSON is the custom marshaler for DescendantInfo. 531func (di DescendantInfo) MarshalJSON() ([]byte, error) { 532 objectMap := make(map[string]interface{}) 533 if di.DescendantInfoProperties != nil { 534 objectMap["properties"] = di.DescendantInfoProperties 535 } 536 return json.Marshal(objectMap) 537} 538 539// UnmarshalJSON is the custom unmarshaler for DescendantInfo struct. 540func (di *DescendantInfo) UnmarshalJSON(body []byte) error { 541 var m map[string]*json.RawMessage 542 err := json.Unmarshal(body, &m) 543 if err != nil { 544 return err 545 } 546 for k, v := range m { 547 switch k { 548 case "id": 549 if v != nil { 550 var ID string 551 err = json.Unmarshal(*v, &ID) 552 if err != nil { 553 return err 554 } 555 di.ID = &ID 556 } 557 case "type": 558 if v != nil { 559 var typeVar string 560 err = json.Unmarshal(*v, &typeVar) 561 if err != nil { 562 return err 563 } 564 di.Type = &typeVar 565 } 566 case "name": 567 if v != nil { 568 var name string 569 err = json.Unmarshal(*v, &name) 570 if err != nil { 571 return err 572 } 573 di.Name = &name 574 } 575 case "properties": 576 if v != nil { 577 var descendantInfoProperties DescendantInfoProperties 578 err = json.Unmarshal(*v, &descendantInfoProperties) 579 if err != nil { 580 return err 581 } 582 di.DescendantInfoProperties = &descendantInfoProperties 583 } 584 } 585 } 586 587 return nil 588} 589 590// DescendantInfoProperties the generic properties of an descendant. 591type DescendantInfoProperties struct { 592 // DisplayName - The friendly name of the management group. 593 DisplayName *string `json:"displayName,omitempty"` 594 Parent *DescendantParentGroupInfo `json:"parent,omitempty"` 595} 596 597// DescendantListResult describes the result of the request to view descendants. 598type DescendantListResult struct { 599 autorest.Response `json:"-"` 600 // Value - The list of descendants. 601 Value *[]DescendantInfo `json:"value,omitempty"` 602 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 603 NextLink *string `json:"nextLink,omitempty"` 604} 605 606// DescendantListResultIterator provides access to a complete listing of DescendantInfo values. 607type DescendantListResultIterator struct { 608 i int 609 page DescendantListResultPage 610} 611 612// NextWithContext advances to the next value. If there was an error making 613// the request the iterator does not advance and the error is returned. 614func (iter *DescendantListResultIterator) NextWithContext(ctx context.Context) (err error) { 615 if tracing.IsEnabled() { 616 ctx = tracing.StartSpan(ctx, fqdn+"/DescendantListResultIterator.NextWithContext") 617 defer func() { 618 sc := -1 619 if iter.Response().Response.Response != nil { 620 sc = iter.Response().Response.Response.StatusCode 621 } 622 tracing.EndSpan(ctx, sc, err) 623 }() 624 } 625 iter.i++ 626 if iter.i < len(iter.page.Values()) { 627 return nil 628 } 629 err = iter.page.NextWithContext(ctx) 630 if err != nil { 631 iter.i-- 632 return err 633 } 634 iter.i = 0 635 return nil 636} 637 638// Next advances to the next value. If there was an error making 639// the request the iterator does not advance and the error is returned. 640// Deprecated: Use NextWithContext() instead. 641func (iter *DescendantListResultIterator) Next() error { 642 return iter.NextWithContext(context.Background()) 643} 644 645// NotDone returns true if the enumeration should be started or is not yet complete. 646func (iter DescendantListResultIterator) NotDone() bool { 647 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 648} 649 650// Response returns the raw server response from the last page request. 651func (iter DescendantListResultIterator) Response() DescendantListResult { 652 return iter.page.Response() 653} 654 655// Value returns the current value or a zero-initialized value if the 656// iterator has advanced beyond the end of the collection. 657func (iter DescendantListResultIterator) Value() DescendantInfo { 658 if !iter.page.NotDone() { 659 return DescendantInfo{} 660 } 661 return iter.page.Values()[iter.i] 662} 663 664// Creates a new instance of the DescendantListResultIterator type. 665func NewDescendantListResultIterator(page DescendantListResultPage) DescendantListResultIterator { 666 return DescendantListResultIterator{page: page} 667} 668 669// IsEmpty returns true if the ListResult contains no values. 670func (dlr DescendantListResult) IsEmpty() bool { 671 return dlr.Value == nil || len(*dlr.Value) == 0 672} 673 674// descendantListResultPreparer prepares a request to retrieve the next set of results. 675// It returns nil if no more results exist. 676func (dlr DescendantListResult) descendantListResultPreparer(ctx context.Context) (*http.Request, error) { 677 if dlr.NextLink == nil || len(to.String(dlr.NextLink)) < 1 { 678 return nil, nil 679 } 680 return autorest.Prepare((&http.Request{}).WithContext(ctx), 681 autorest.AsJSON(), 682 autorest.AsGet(), 683 autorest.WithBaseURL(to.String(dlr.NextLink))) 684} 685 686// DescendantListResultPage contains a page of DescendantInfo values. 687type DescendantListResultPage struct { 688 fn func(context.Context, DescendantListResult) (DescendantListResult, error) 689 dlr DescendantListResult 690} 691 692// NextWithContext advances to the next page of values. If there was an error making 693// the request the page does not advance and the error is returned. 694func (page *DescendantListResultPage) NextWithContext(ctx context.Context) (err error) { 695 if tracing.IsEnabled() { 696 ctx = tracing.StartSpan(ctx, fqdn+"/DescendantListResultPage.NextWithContext") 697 defer func() { 698 sc := -1 699 if page.Response().Response.Response != nil { 700 sc = page.Response().Response.Response.StatusCode 701 } 702 tracing.EndSpan(ctx, sc, err) 703 }() 704 } 705 next, err := page.fn(ctx, page.dlr) 706 if err != nil { 707 return err 708 } 709 page.dlr = next 710 return nil 711} 712 713// Next advances to the next page of values. If there was an error making 714// the request the page does not advance and the error is returned. 715// Deprecated: Use NextWithContext() instead. 716func (page *DescendantListResultPage) Next() error { 717 return page.NextWithContext(context.Background()) 718} 719 720// NotDone returns true if the page enumeration should be started or is not yet complete. 721func (page DescendantListResultPage) NotDone() bool { 722 return !page.dlr.IsEmpty() 723} 724 725// Response returns the raw server response from the last page request. 726func (page DescendantListResultPage) Response() DescendantListResult { 727 return page.dlr 728} 729 730// Values returns the slice of values for the current page or nil if there are no values. 731func (page DescendantListResultPage) Values() []DescendantInfo { 732 if page.dlr.IsEmpty() { 733 return nil 734 } 735 return *page.dlr.Value 736} 737 738// Creates a new instance of the DescendantListResultPage type. 739func NewDescendantListResultPage(getNextPage func(context.Context, DescendantListResult) (DescendantListResult, error)) DescendantListResultPage { 740 return DescendantListResultPage{fn: getNextPage} 741} 742 743// DescendantParentGroupInfo the ID of the parent management group. 744type DescendantParentGroupInfo struct { 745 // ID - The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 746 ID *string `json:"id,omitempty"` 747} 748 749// Details the details of a management group. 750type Details struct { 751 // Version - The version number of the object. 752 Version *float64 `json:"version,omitempty"` 753 // UpdatedTime - The date and time when this object was last updated. 754 UpdatedTime *date.Time `json:"updatedTime,omitempty"` 755 // UpdatedBy - The identity of the principal or process that updated the object. 756 UpdatedBy *string `json:"updatedBy,omitempty"` 757 Parent *ParentGroupInfo `json:"parent,omitempty"` 758} 759 760// EntityHierarchyItem the management group details for the hierarchy view. 761type EntityHierarchyItem struct { 762 // ID - READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 763 ID *string `json:"id,omitempty"` 764 // Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups 765 Type *string `json:"type,omitempty"` 766 // Name - READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 767 Name *string `json:"name,omitempty"` 768 *EntityHierarchyItemProperties `json:"properties,omitempty"` 769} 770 771// MarshalJSON is the custom marshaler for EntityHierarchyItem. 772func (ehi EntityHierarchyItem) MarshalJSON() ([]byte, error) { 773 objectMap := make(map[string]interface{}) 774 if ehi.EntityHierarchyItemProperties != nil { 775 objectMap["properties"] = ehi.EntityHierarchyItemProperties 776 } 777 return json.Marshal(objectMap) 778} 779 780// UnmarshalJSON is the custom unmarshaler for EntityHierarchyItem struct. 781func (ehi *EntityHierarchyItem) UnmarshalJSON(body []byte) error { 782 var m map[string]*json.RawMessage 783 err := json.Unmarshal(body, &m) 784 if err != nil { 785 return err 786 } 787 for k, v := range m { 788 switch k { 789 case "id": 790 if v != nil { 791 var ID string 792 err = json.Unmarshal(*v, &ID) 793 if err != nil { 794 return err 795 } 796 ehi.ID = &ID 797 } 798 case "type": 799 if v != nil { 800 var typeVar string 801 err = json.Unmarshal(*v, &typeVar) 802 if err != nil { 803 return err 804 } 805 ehi.Type = &typeVar 806 } 807 case "name": 808 if v != nil { 809 var name string 810 err = json.Unmarshal(*v, &name) 811 if err != nil { 812 return err 813 } 814 ehi.Name = &name 815 } 816 case "properties": 817 if v != nil { 818 var entityHierarchyItemProperties EntityHierarchyItemProperties 819 err = json.Unmarshal(*v, &entityHierarchyItemProperties) 820 if err != nil { 821 return err 822 } 823 ehi.EntityHierarchyItemProperties = &entityHierarchyItemProperties 824 } 825 } 826 } 827 828 return nil 829} 830 831// EntityHierarchyItemProperties the generic properties of a management group. 832type EntityHierarchyItemProperties struct { 833 // DisplayName - The friendly name of the management group. 834 DisplayName *string `json:"displayName,omitempty"` 835 // Permissions - Possible values include: 'Permissions1Noaccess', 'Permissions1View', 'Permissions1Edit', 'Permissions1Delete' 836 Permissions Permissions1 `json:"permissions,omitempty"` 837 // Children - The list of children. 838 Children *[]EntityHierarchyItem `json:"children,omitempty"` 839} 840 841// EntityInfo the entity. 842type EntityInfo struct { 843 // ID - READ-ONLY; The fully qualified ID for the entity. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 844 ID *string `json:"id,omitempty"` 845 // Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups 846 Type *string `json:"type,omitempty"` 847 // Name - READ-ONLY; The name of the entity. For example, 00000000-0000-0000-0000-000000000000 848 Name *string `json:"name,omitempty"` 849 *EntityInfoProperties `json:"properties,omitempty"` 850} 851 852// MarshalJSON is the custom marshaler for EntityInfo. 853func (ei EntityInfo) MarshalJSON() ([]byte, error) { 854 objectMap := make(map[string]interface{}) 855 if ei.EntityInfoProperties != nil { 856 objectMap["properties"] = ei.EntityInfoProperties 857 } 858 return json.Marshal(objectMap) 859} 860 861// UnmarshalJSON is the custom unmarshaler for EntityInfo struct. 862func (ei *EntityInfo) UnmarshalJSON(body []byte) error { 863 var m map[string]*json.RawMessage 864 err := json.Unmarshal(body, &m) 865 if err != nil { 866 return err 867 } 868 for k, v := range m { 869 switch k { 870 case "id": 871 if v != nil { 872 var ID string 873 err = json.Unmarshal(*v, &ID) 874 if err != nil { 875 return err 876 } 877 ei.ID = &ID 878 } 879 case "type": 880 if v != nil { 881 var typeVar string 882 err = json.Unmarshal(*v, &typeVar) 883 if err != nil { 884 return err 885 } 886 ei.Type = &typeVar 887 } 888 case "name": 889 if v != nil { 890 var name string 891 err = json.Unmarshal(*v, &name) 892 if err != nil { 893 return err 894 } 895 ei.Name = &name 896 } 897 case "properties": 898 if v != nil { 899 var entityInfoProperties EntityInfoProperties 900 err = json.Unmarshal(*v, &entityInfoProperties) 901 if err != nil { 902 return err 903 } 904 ei.EntityInfoProperties = &entityInfoProperties 905 } 906 } 907 } 908 909 return nil 910} 911 912// EntityInfoProperties the generic properties of an entity. 913type EntityInfoProperties struct { 914 // TenantID - The AAD Tenant ID associated with the entity. For example, 00000000-0000-0000-0000-000000000000 915 TenantID *string `json:"tenantId,omitempty"` 916 // DisplayName - The friendly name of the management group. 917 DisplayName *string `json:"displayName,omitempty"` 918 Parent *EntityParentGroupInfo `json:"parent,omitempty"` 919 // Permissions - Possible values include: 'PermissionsNoaccess', 'PermissionsView', 'PermissionsEdit', 'PermissionsDelete' 920 Permissions Permissions `json:"permissions,omitempty"` 921 // InheritedPermissions - Possible values include: 'Noaccess', 'View', 'Edit', 'Delete' 922 InheritedPermissions InheritedPermissions `json:"inheritedPermissions,omitempty"` 923 NumberOfDescendants *int32 `json:"numberOfDescendants,omitempty"` 924 // NumberOfChildren - Number of children is the number of Groups and Subscriptions that are exactly one level underneath the current Group. 925 NumberOfChildren *int32 `json:"numberOfChildren,omitempty"` 926 // NumberOfChildGroups - Number of children is the number of Groups that are exactly one level underneath the current Group. 927 NumberOfChildGroups *int32 `json:"numberOfChildGroups,omitempty"` 928 // ParentDisplayNameChain - The parent display name chain from the root group to the immediate parent 929 ParentDisplayNameChain *[]string `json:"parentDisplayNameChain,omitempty"` 930 // ParentNameChain - The parent name chain from the root group to the immediate parent 931 ParentNameChain *[]string `json:"parentNameChain,omitempty"` 932} 933 934// EntityListResult describes the result of the request to view entities. 935type EntityListResult struct { 936 autorest.Response `json:"-"` 937 // Value - The list of entities. 938 Value *[]EntityInfo `json:"value,omitempty"` 939 // Count - READ-ONLY; Total count of records that match the filter 940 Count *int32 `json:"count,omitempty"` 941 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 942 NextLink *string `json:"nextLink,omitempty"` 943} 944 945// EntityListResultIterator provides access to a complete listing of EntityInfo values. 946type EntityListResultIterator struct { 947 i int 948 page EntityListResultPage 949} 950 951// NextWithContext advances to the next value. If there was an error making 952// the request the iterator does not advance and the error is returned. 953func (iter *EntityListResultIterator) NextWithContext(ctx context.Context) (err error) { 954 if tracing.IsEnabled() { 955 ctx = tracing.StartSpan(ctx, fqdn+"/EntityListResultIterator.NextWithContext") 956 defer func() { 957 sc := -1 958 if iter.Response().Response.Response != nil { 959 sc = iter.Response().Response.Response.StatusCode 960 } 961 tracing.EndSpan(ctx, sc, err) 962 }() 963 } 964 iter.i++ 965 if iter.i < len(iter.page.Values()) { 966 return nil 967 } 968 err = iter.page.NextWithContext(ctx) 969 if err != nil { 970 iter.i-- 971 return err 972 } 973 iter.i = 0 974 return nil 975} 976 977// Next advances to the next value. If there was an error making 978// the request the iterator does not advance and the error is returned. 979// Deprecated: Use NextWithContext() instead. 980func (iter *EntityListResultIterator) Next() error { 981 return iter.NextWithContext(context.Background()) 982} 983 984// NotDone returns true if the enumeration should be started or is not yet complete. 985func (iter EntityListResultIterator) NotDone() bool { 986 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 987} 988 989// Response returns the raw server response from the last page request. 990func (iter EntityListResultIterator) Response() EntityListResult { 991 return iter.page.Response() 992} 993 994// Value returns the current value or a zero-initialized value if the 995// iterator has advanced beyond the end of the collection. 996func (iter EntityListResultIterator) Value() EntityInfo { 997 if !iter.page.NotDone() { 998 return EntityInfo{} 999 } 1000 return iter.page.Values()[iter.i] 1001} 1002 1003// Creates a new instance of the EntityListResultIterator type. 1004func NewEntityListResultIterator(page EntityListResultPage) EntityListResultIterator { 1005 return EntityListResultIterator{page: page} 1006} 1007 1008// IsEmpty returns true if the ListResult contains no values. 1009func (elr EntityListResult) IsEmpty() bool { 1010 return elr.Value == nil || len(*elr.Value) == 0 1011} 1012 1013// entityListResultPreparer prepares a request to retrieve the next set of results. 1014// It returns nil if no more results exist. 1015func (elr EntityListResult) entityListResultPreparer(ctx context.Context) (*http.Request, error) { 1016 if elr.NextLink == nil || len(to.String(elr.NextLink)) < 1 { 1017 return nil, nil 1018 } 1019 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1020 autorest.AsJSON(), 1021 autorest.AsGet(), 1022 autorest.WithBaseURL(to.String(elr.NextLink))) 1023} 1024 1025// EntityListResultPage contains a page of EntityInfo values. 1026type EntityListResultPage struct { 1027 fn func(context.Context, EntityListResult) (EntityListResult, error) 1028 elr EntityListResult 1029} 1030 1031// NextWithContext advances to the next page of values. If there was an error making 1032// the request the page does not advance and the error is returned. 1033func (page *EntityListResultPage) NextWithContext(ctx context.Context) (err error) { 1034 if tracing.IsEnabled() { 1035 ctx = tracing.StartSpan(ctx, fqdn+"/EntityListResultPage.NextWithContext") 1036 defer func() { 1037 sc := -1 1038 if page.Response().Response.Response != nil { 1039 sc = page.Response().Response.Response.StatusCode 1040 } 1041 tracing.EndSpan(ctx, sc, err) 1042 }() 1043 } 1044 next, err := page.fn(ctx, page.elr) 1045 if err != nil { 1046 return err 1047 } 1048 page.elr = next 1049 return nil 1050} 1051 1052// Next advances to the next page of values. If there was an error making 1053// the request the page does not advance and the error is returned. 1054// Deprecated: Use NextWithContext() instead. 1055func (page *EntityListResultPage) Next() error { 1056 return page.NextWithContext(context.Background()) 1057} 1058 1059// NotDone returns true if the page enumeration should be started or is not yet complete. 1060func (page EntityListResultPage) NotDone() bool { 1061 return !page.elr.IsEmpty() 1062} 1063 1064// Response returns the raw server response from the last page request. 1065func (page EntityListResultPage) Response() EntityListResult { 1066 return page.elr 1067} 1068 1069// Values returns the slice of values for the current page or nil if there are no values. 1070func (page EntityListResultPage) Values() []EntityInfo { 1071 if page.elr.IsEmpty() { 1072 return nil 1073 } 1074 return *page.elr.Value 1075} 1076 1077// Creates a new instance of the EntityListResultPage type. 1078func NewEntityListResultPage(getNextPage func(context.Context, EntityListResult) (EntityListResult, error)) EntityListResultPage { 1079 return EntityListResultPage{fn: getNextPage} 1080} 1081 1082// EntityParentGroupInfo (Optional) The ID of the parent management group. 1083type EntityParentGroupInfo struct { 1084 // ID - The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 1085 ID *string `json:"id,omitempty"` 1086} 1087 1088// ErrorDetails the details of the error. 1089type ErrorDetails struct { 1090 // Code - One of a server-defined set of error codes. 1091 Code *string `json:"code,omitempty"` 1092 // Message - A human-readable representation of the error. 1093 Message *string `json:"message,omitempty"` 1094 // Details - A human-readable representation of the error's details. 1095 Details *string `json:"details,omitempty"` 1096} 1097 1098// ErrorResponse the error object. 1099type ErrorResponse struct { 1100 Error *ErrorDetails `json:"error,omitempty"` 1101} 1102 1103// HierarchySettings settings defined at the Management Group scope. 1104type HierarchySettings struct { 1105 autorest.Response `json:"-"` 1106 // ID - READ-ONLY; The fully qualified ID for the settings object. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. 1107 ID *string `json:"id,omitempty"` 1108 // Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups/settings. 1109 Type *string `json:"type,omitempty"` 1110 // Name - READ-ONLY; The name of the object. In this case, default. 1111 Name *string `json:"name,omitempty"` 1112 *HierarchySettingsProperties `json:"properties,omitempty"` 1113} 1114 1115// MarshalJSON is the custom marshaler for HierarchySettings. 1116func (hs HierarchySettings) MarshalJSON() ([]byte, error) { 1117 objectMap := make(map[string]interface{}) 1118 if hs.HierarchySettingsProperties != nil { 1119 objectMap["properties"] = hs.HierarchySettingsProperties 1120 } 1121 return json.Marshal(objectMap) 1122} 1123 1124// UnmarshalJSON is the custom unmarshaler for HierarchySettings struct. 1125func (hs *HierarchySettings) UnmarshalJSON(body []byte) error { 1126 var m map[string]*json.RawMessage 1127 err := json.Unmarshal(body, &m) 1128 if err != nil { 1129 return err 1130 } 1131 for k, v := range m { 1132 switch k { 1133 case "id": 1134 if v != nil { 1135 var ID string 1136 err = json.Unmarshal(*v, &ID) 1137 if err != nil { 1138 return err 1139 } 1140 hs.ID = &ID 1141 } 1142 case "type": 1143 if v != nil { 1144 var typeVar string 1145 err = json.Unmarshal(*v, &typeVar) 1146 if err != nil { 1147 return err 1148 } 1149 hs.Type = &typeVar 1150 } 1151 case "name": 1152 if v != nil { 1153 var name string 1154 err = json.Unmarshal(*v, &name) 1155 if err != nil { 1156 return err 1157 } 1158 hs.Name = &name 1159 } 1160 case "properties": 1161 if v != nil { 1162 var hierarchySettingsProperties HierarchySettingsProperties 1163 err = json.Unmarshal(*v, &hierarchySettingsProperties) 1164 if err != nil { 1165 return err 1166 } 1167 hs.HierarchySettingsProperties = &hierarchySettingsProperties 1168 } 1169 } 1170 } 1171 1172 return nil 1173} 1174 1175// HierarchySettingsInfo the hierarchy settings resource. 1176type HierarchySettingsInfo struct { 1177 // ID - READ-ONLY; The fully qualified ID for the settings object. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. 1178 ID *string `json:"id,omitempty"` 1179 // Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups/settings. 1180 Type *string `json:"type,omitempty"` 1181 // Name - READ-ONLY; The name of the object. In this case, default. 1182 Name *string `json:"name,omitempty"` 1183 *HierarchySettingsProperties `json:"properties,omitempty"` 1184} 1185 1186// MarshalJSON is the custom marshaler for HierarchySettingsInfo. 1187func (hsi HierarchySettingsInfo) MarshalJSON() ([]byte, error) { 1188 objectMap := make(map[string]interface{}) 1189 if hsi.HierarchySettingsProperties != nil { 1190 objectMap["properties"] = hsi.HierarchySettingsProperties 1191 } 1192 return json.Marshal(objectMap) 1193} 1194 1195// UnmarshalJSON is the custom unmarshaler for HierarchySettingsInfo struct. 1196func (hsi *HierarchySettingsInfo) UnmarshalJSON(body []byte) error { 1197 var m map[string]*json.RawMessage 1198 err := json.Unmarshal(body, &m) 1199 if err != nil { 1200 return err 1201 } 1202 for k, v := range m { 1203 switch k { 1204 case "id": 1205 if v != nil { 1206 var ID string 1207 err = json.Unmarshal(*v, &ID) 1208 if err != nil { 1209 return err 1210 } 1211 hsi.ID = &ID 1212 } 1213 case "type": 1214 if v != nil { 1215 var typeVar string 1216 err = json.Unmarshal(*v, &typeVar) 1217 if err != nil { 1218 return err 1219 } 1220 hsi.Type = &typeVar 1221 } 1222 case "name": 1223 if v != nil { 1224 var name string 1225 err = json.Unmarshal(*v, &name) 1226 if err != nil { 1227 return err 1228 } 1229 hsi.Name = &name 1230 } 1231 case "properties": 1232 if v != nil { 1233 var hierarchySettingsProperties HierarchySettingsProperties 1234 err = json.Unmarshal(*v, &hierarchySettingsProperties) 1235 if err != nil { 1236 return err 1237 } 1238 hsi.HierarchySettingsProperties = &hierarchySettingsProperties 1239 } 1240 } 1241 } 1242 1243 return nil 1244} 1245 1246// HierarchySettingsList lists all hierarchy settings. 1247type HierarchySettingsList struct { 1248 autorest.Response `json:"-"` 1249 // Value - The list of hierarchy settings. 1250 Value *[]HierarchySettingsInfo `json:"value,omitempty"` 1251 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 1252 NextLink *string `json:"nextLink,omitempty"` 1253} 1254 1255// HierarchySettingsProperties the generic properties of hierarchy settings. 1256type HierarchySettingsProperties struct { 1257 // TenantID - The AAD Tenant ID associated with the hierarchy settings. For example, 00000000-0000-0000-0000-000000000000 1258 TenantID *string `json:"tenantId,omitempty"` 1259 // RequireAuthorizationForGroupCreation - Indicates whether RBAC access is required upon group creation under the root Management Group. If set to true, user will require Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are given access. 1260 RequireAuthorizationForGroupCreation *bool `json:"requireAuthorizationForGroupCreation,omitempty"` 1261 // DefaultManagementGroup - Settings that sets the default Management Group under which new subscriptions get added in this tenant. For example, /providers/Microsoft.Management/managementGroups/defaultGroup 1262 DefaultManagementGroup *string `json:"defaultManagementGroup,omitempty"` 1263} 1264 1265// Info the management group resource. 1266type Info struct { 1267 // ID - READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 1268 ID *string `json:"id,omitempty"` 1269 // Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups 1270 Type *string `json:"type,omitempty"` 1271 // Name - READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 1272 Name *string `json:"name,omitempty"` 1273 *InfoProperties `json:"properties,omitempty"` 1274} 1275 1276// MarshalJSON is the custom marshaler for Info. 1277func (i Info) MarshalJSON() ([]byte, error) { 1278 objectMap := make(map[string]interface{}) 1279 if i.InfoProperties != nil { 1280 objectMap["properties"] = i.InfoProperties 1281 } 1282 return json.Marshal(objectMap) 1283} 1284 1285// UnmarshalJSON is the custom unmarshaler for Info struct. 1286func (i *Info) UnmarshalJSON(body []byte) error { 1287 var m map[string]*json.RawMessage 1288 err := json.Unmarshal(body, &m) 1289 if err != nil { 1290 return err 1291 } 1292 for k, v := range m { 1293 switch k { 1294 case "id": 1295 if v != nil { 1296 var ID string 1297 err = json.Unmarshal(*v, &ID) 1298 if err != nil { 1299 return err 1300 } 1301 i.ID = &ID 1302 } 1303 case "type": 1304 if v != nil { 1305 var typeVar string 1306 err = json.Unmarshal(*v, &typeVar) 1307 if err != nil { 1308 return err 1309 } 1310 i.Type = &typeVar 1311 } 1312 case "name": 1313 if v != nil { 1314 var name string 1315 err = json.Unmarshal(*v, &name) 1316 if err != nil { 1317 return err 1318 } 1319 i.Name = &name 1320 } 1321 case "properties": 1322 if v != nil { 1323 var infoProperties InfoProperties 1324 err = json.Unmarshal(*v, &infoProperties) 1325 if err != nil { 1326 return err 1327 } 1328 i.InfoProperties = &infoProperties 1329 } 1330 } 1331 } 1332 1333 return nil 1334} 1335 1336// InfoProperties the generic properties of a management group. 1337type InfoProperties struct { 1338 // TenantID - The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 1339 TenantID *string `json:"tenantId,omitempty"` 1340 // DisplayName - The friendly name of the management group. 1341 DisplayName *string `json:"displayName,omitempty"` 1342} 1343 1344// ListResult describes the result of the request to list management groups. 1345type ListResult struct { 1346 autorest.Response `json:"-"` 1347 // Value - The list of management groups. 1348 Value *[]Info `json:"value,omitempty"` 1349 // NextLink - READ-ONLY; The URL to use for getting the next set of results. 1350 NextLink *string `json:"nextLink,omitempty"` 1351} 1352 1353// ListResultIterator provides access to a complete listing of Info values. 1354type ListResultIterator struct { 1355 i int 1356 page ListResultPage 1357} 1358 1359// NextWithContext advances to the next value. If there was an error making 1360// the request the iterator does not advance and the error is returned. 1361func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { 1362 if tracing.IsEnabled() { 1363 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") 1364 defer func() { 1365 sc := -1 1366 if iter.Response().Response.Response != nil { 1367 sc = iter.Response().Response.Response.StatusCode 1368 } 1369 tracing.EndSpan(ctx, sc, err) 1370 }() 1371 } 1372 iter.i++ 1373 if iter.i < len(iter.page.Values()) { 1374 return nil 1375 } 1376 err = iter.page.NextWithContext(ctx) 1377 if err != nil { 1378 iter.i-- 1379 return err 1380 } 1381 iter.i = 0 1382 return nil 1383} 1384 1385// Next advances to the next value. If there was an error making 1386// the request the iterator does not advance and the error is returned. 1387// Deprecated: Use NextWithContext() instead. 1388func (iter *ListResultIterator) Next() error { 1389 return iter.NextWithContext(context.Background()) 1390} 1391 1392// NotDone returns true if the enumeration should be started or is not yet complete. 1393func (iter ListResultIterator) NotDone() bool { 1394 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1395} 1396 1397// Response returns the raw server response from the last page request. 1398func (iter ListResultIterator) Response() ListResult { 1399 return iter.page.Response() 1400} 1401 1402// Value returns the current value or a zero-initialized value if the 1403// iterator has advanced beyond the end of the collection. 1404func (iter ListResultIterator) Value() Info { 1405 if !iter.page.NotDone() { 1406 return Info{} 1407 } 1408 return iter.page.Values()[iter.i] 1409} 1410 1411// Creates a new instance of the ListResultIterator type. 1412func NewListResultIterator(page ListResultPage) ListResultIterator { 1413 return ListResultIterator{page: page} 1414} 1415 1416// IsEmpty returns true if the ListResult contains no values. 1417func (lr ListResult) IsEmpty() bool { 1418 return lr.Value == nil || len(*lr.Value) == 0 1419} 1420 1421// listResultPreparer prepares a request to retrieve the next set of results. 1422// It returns nil if no more results exist. 1423func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { 1424 if lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 { 1425 return nil, nil 1426 } 1427 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1428 autorest.AsJSON(), 1429 autorest.AsGet(), 1430 autorest.WithBaseURL(to.String(lr.NextLink))) 1431} 1432 1433// ListResultPage contains a page of Info values. 1434type ListResultPage struct { 1435 fn func(context.Context, ListResult) (ListResult, error) 1436 lr ListResult 1437} 1438 1439// NextWithContext advances to the next page of values. If there was an error making 1440// the request the page does not advance and the error is returned. 1441func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { 1442 if tracing.IsEnabled() { 1443 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") 1444 defer func() { 1445 sc := -1 1446 if page.Response().Response.Response != nil { 1447 sc = page.Response().Response.Response.StatusCode 1448 } 1449 tracing.EndSpan(ctx, sc, err) 1450 }() 1451 } 1452 next, err := page.fn(ctx, page.lr) 1453 if err != nil { 1454 return err 1455 } 1456 page.lr = next 1457 return nil 1458} 1459 1460// Next advances to the next page of values. If there was an error making 1461// the request the page does not advance and the error is returned. 1462// Deprecated: Use NextWithContext() instead. 1463func (page *ListResultPage) Next() error { 1464 return page.NextWithContext(context.Background()) 1465} 1466 1467// NotDone returns true if the page enumeration should be started or is not yet complete. 1468func (page ListResultPage) NotDone() bool { 1469 return !page.lr.IsEmpty() 1470} 1471 1472// Response returns the raw server response from the last page request. 1473func (page ListResultPage) Response() ListResult { 1474 return page.lr 1475} 1476 1477// Values returns the slice of values for the current page or nil if there are no values. 1478func (page ListResultPage) Values() []Info { 1479 if page.lr.IsEmpty() { 1480 return nil 1481 } 1482 return *page.lr.Value 1483} 1484 1485// Creates a new instance of the ListResultPage type. 1486func NewListResultPage(getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { 1487 return ListResultPage{fn: getNextPage} 1488} 1489 1490// ManagementGroup the management group details. 1491type ManagementGroup struct { 1492 autorest.Response `json:"-"` 1493 // ID - READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 1494 ID *string `json:"id,omitempty"` 1495 // Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups 1496 Type *string `json:"type,omitempty"` 1497 // Name - READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 1498 Name *string `json:"name,omitempty"` 1499 *Properties `json:"properties,omitempty"` 1500} 1501 1502// MarshalJSON is the custom marshaler for ManagementGroup. 1503func (mg ManagementGroup) MarshalJSON() ([]byte, error) { 1504 objectMap := make(map[string]interface{}) 1505 if mg.Properties != nil { 1506 objectMap["properties"] = mg.Properties 1507 } 1508 return json.Marshal(objectMap) 1509} 1510 1511// UnmarshalJSON is the custom unmarshaler for ManagementGroup struct. 1512func (mg *ManagementGroup) UnmarshalJSON(body []byte) error { 1513 var m map[string]*json.RawMessage 1514 err := json.Unmarshal(body, &m) 1515 if err != nil { 1516 return err 1517 } 1518 for k, v := range m { 1519 switch k { 1520 case "id": 1521 if v != nil { 1522 var ID string 1523 err = json.Unmarshal(*v, &ID) 1524 if err != nil { 1525 return err 1526 } 1527 mg.ID = &ID 1528 } 1529 case "type": 1530 if v != nil { 1531 var typeVar string 1532 err = json.Unmarshal(*v, &typeVar) 1533 if err != nil { 1534 return err 1535 } 1536 mg.Type = &typeVar 1537 } 1538 case "name": 1539 if v != nil { 1540 var name string 1541 err = json.Unmarshal(*v, &name) 1542 if err != nil { 1543 return err 1544 } 1545 mg.Name = &name 1546 } 1547 case "properties": 1548 if v != nil { 1549 var properties Properties 1550 err = json.Unmarshal(*v, &properties) 1551 if err != nil { 1552 return err 1553 } 1554 mg.Properties = &properties 1555 } 1556 } 1557 } 1558 1559 return nil 1560} 1561 1562// Operation operation supported by the Microsoft.Management resource provider. 1563type Operation struct { 1564 // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}. 1565 Name *string `json:"name,omitempty"` 1566 Display *OperationDisplayProperties `json:"display,omitempty"` 1567} 1568 1569// OperationDisplayProperties the object that represents the operation. 1570type OperationDisplayProperties struct { 1571 // Provider - READ-ONLY; The name of the provider. 1572 Provider *string `json:"provider,omitempty"` 1573 // Resource - READ-ONLY; The resource on which the operation is performed. 1574 Resource *string `json:"resource,omitempty"` 1575 // Operation - READ-ONLY; The operation that can be performed. 1576 Operation *string `json:"operation,omitempty"` 1577 // Description - READ-ONLY; Operation description. 1578 Description *string `json:"description,omitempty"` 1579} 1580 1581// OperationListResult describes the result of the request to list Microsoft.Management operations. 1582type OperationListResult struct { 1583 autorest.Response `json:"-"` 1584 // Value - READ-ONLY; List of operations supported by the Microsoft.Management resource provider. 1585 Value *[]Operation `json:"value,omitempty"` 1586 // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. 1587 NextLink *string `json:"nextLink,omitempty"` 1588} 1589 1590// OperationListResultIterator provides access to a complete listing of Operation values. 1591type OperationListResultIterator struct { 1592 i int 1593 page OperationListResultPage 1594} 1595 1596// NextWithContext advances to the next value. If there was an error making 1597// the request the iterator does not advance and the error is returned. 1598func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1599 if tracing.IsEnabled() { 1600 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1601 defer func() { 1602 sc := -1 1603 if iter.Response().Response.Response != nil { 1604 sc = iter.Response().Response.Response.StatusCode 1605 } 1606 tracing.EndSpan(ctx, sc, err) 1607 }() 1608 } 1609 iter.i++ 1610 if iter.i < len(iter.page.Values()) { 1611 return nil 1612 } 1613 err = iter.page.NextWithContext(ctx) 1614 if err != nil { 1615 iter.i-- 1616 return err 1617 } 1618 iter.i = 0 1619 return nil 1620} 1621 1622// Next advances to the next value. If there was an error making 1623// the request the iterator does not advance and the error is returned. 1624// Deprecated: Use NextWithContext() instead. 1625func (iter *OperationListResultIterator) Next() error { 1626 return iter.NextWithContext(context.Background()) 1627} 1628 1629// NotDone returns true if the enumeration should be started or is not yet complete. 1630func (iter OperationListResultIterator) NotDone() bool { 1631 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1632} 1633 1634// Response returns the raw server response from the last page request. 1635func (iter OperationListResultIterator) Response() OperationListResult { 1636 return iter.page.Response() 1637} 1638 1639// Value returns the current value or a zero-initialized value if the 1640// iterator has advanced beyond the end of the collection. 1641func (iter OperationListResultIterator) Value() Operation { 1642 if !iter.page.NotDone() { 1643 return Operation{} 1644 } 1645 return iter.page.Values()[iter.i] 1646} 1647 1648// Creates a new instance of the OperationListResultIterator type. 1649func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1650 return OperationListResultIterator{page: page} 1651} 1652 1653// IsEmpty returns true if the ListResult contains no values. 1654func (olr OperationListResult) IsEmpty() bool { 1655 return olr.Value == nil || len(*olr.Value) == 0 1656} 1657 1658// operationListResultPreparer prepares a request to retrieve the next set of results. 1659// It returns nil if no more results exist. 1660func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1661 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 1662 return nil, nil 1663 } 1664 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1665 autorest.AsJSON(), 1666 autorest.AsGet(), 1667 autorest.WithBaseURL(to.String(olr.NextLink))) 1668} 1669 1670// OperationListResultPage contains a page of Operation values. 1671type OperationListResultPage struct { 1672 fn func(context.Context, OperationListResult) (OperationListResult, error) 1673 olr OperationListResult 1674} 1675 1676// NextWithContext advances to the next page of values. If there was an error making 1677// the request the page does not advance and the error is returned. 1678func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1679 if tracing.IsEnabled() { 1680 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1681 defer func() { 1682 sc := -1 1683 if page.Response().Response.Response != nil { 1684 sc = page.Response().Response.Response.StatusCode 1685 } 1686 tracing.EndSpan(ctx, sc, err) 1687 }() 1688 } 1689 next, err := page.fn(ctx, page.olr) 1690 if err != nil { 1691 return err 1692 } 1693 page.olr = next 1694 return nil 1695} 1696 1697// Next advances to the next page of values. If there was an error making 1698// the request the page does not advance and the error is returned. 1699// Deprecated: Use NextWithContext() instead. 1700func (page *OperationListResultPage) Next() error { 1701 return page.NextWithContext(context.Background()) 1702} 1703 1704// NotDone returns true if the page enumeration should be started or is not yet complete. 1705func (page OperationListResultPage) NotDone() bool { 1706 return !page.olr.IsEmpty() 1707} 1708 1709// Response returns the raw server response from the last page request. 1710func (page OperationListResultPage) Response() OperationListResult { 1711 return page.olr 1712} 1713 1714// Values returns the slice of values for the current page or nil if there are no values. 1715func (page OperationListResultPage) Values() []Operation { 1716 if page.olr.IsEmpty() { 1717 return nil 1718 } 1719 return *page.olr.Value 1720} 1721 1722// Creates a new instance of the OperationListResultPage type. 1723func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 1724 return OperationListResultPage{fn: getNextPage} 1725} 1726 1727// OperationResults the results of an asynchronous operation. 1728type OperationResults struct { 1729 // ID - READ-ONLY; The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 1730 ID *string `json:"id,omitempty"` 1731 // Type - READ-ONLY; The type of the resource. For example, Microsoft.Management/managementGroups 1732 Type *string `json:"type,omitempty"` 1733 // Name - READ-ONLY; The name of the management group. For example, 00000000-0000-0000-0000-000000000000 1734 Name *string `json:"name,omitempty"` 1735 *InfoProperties `json:"properties,omitempty"` 1736} 1737 1738// MarshalJSON is the custom marshaler for OperationResults. 1739func (or OperationResults) MarshalJSON() ([]byte, error) { 1740 objectMap := make(map[string]interface{}) 1741 if or.InfoProperties != nil { 1742 objectMap["properties"] = or.InfoProperties 1743 } 1744 return json.Marshal(objectMap) 1745} 1746 1747// UnmarshalJSON is the custom unmarshaler for OperationResults struct. 1748func (or *OperationResults) UnmarshalJSON(body []byte) error { 1749 var m map[string]*json.RawMessage 1750 err := json.Unmarshal(body, &m) 1751 if err != nil { 1752 return err 1753 } 1754 for k, v := range m { 1755 switch k { 1756 case "id": 1757 if v != nil { 1758 var ID string 1759 err = json.Unmarshal(*v, &ID) 1760 if err != nil { 1761 return err 1762 } 1763 or.ID = &ID 1764 } 1765 case "type": 1766 if v != nil { 1767 var typeVar string 1768 err = json.Unmarshal(*v, &typeVar) 1769 if err != nil { 1770 return err 1771 } 1772 or.Type = &typeVar 1773 } 1774 case "name": 1775 if v != nil { 1776 var name string 1777 err = json.Unmarshal(*v, &name) 1778 if err != nil { 1779 return err 1780 } 1781 or.Name = &name 1782 } 1783 case "properties": 1784 if v != nil { 1785 var infoProperties InfoProperties 1786 err = json.Unmarshal(*v, &infoProperties) 1787 if err != nil { 1788 return err 1789 } 1790 or.InfoProperties = &infoProperties 1791 } 1792 } 1793 } 1794 1795 return nil 1796} 1797 1798// ParentGroupInfo (Optional) The ID of the parent management group. 1799type ParentGroupInfo struct { 1800 // ID - The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 1801 ID *string `json:"id,omitempty"` 1802 // Name - The name of the parent management group 1803 Name *string `json:"name,omitempty"` 1804 // DisplayName - The friendly name of the parent management group. 1805 DisplayName *string `json:"displayName,omitempty"` 1806} 1807 1808// PatchManagementGroupRequest management group patch parameters. 1809type PatchManagementGroupRequest struct { 1810 // DisplayName - The friendly name of the management group. 1811 DisplayName *string `json:"displayName,omitempty"` 1812 // ParentID - (Optional) The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 1813 ParentID *string `json:"parentId,omitempty"` 1814} 1815 1816// PathElement a path element of a management group ancestors. 1817type PathElement struct { 1818 // Name - The name of the group. 1819 Name *string `json:"name,omitempty"` 1820 // DisplayName - The friendly name of the group. 1821 DisplayName *string `json:"displayName,omitempty"` 1822} 1823 1824// Properties the generic properties of a management group. 1825type Properties struct { 1826 // TenantID - The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 1827 TenantID *string `json:"tenantId,omitempty"` 1828 // DisplayName - The friendly name of the management group. 1829 DisplayName *string `json:"displayName,omitempty"` 1830 // Roles - The role definitions associated with the management group. 1831 Roles *[]string `json:"roles,omitempty"` 1832 Details *Details `json:"details,omitempty"` 1833 // Children - The list of children. 1834 Children *[]ChildInfo `json:"children,omitempty"` 1835 // Path - The path from the root to the current group. 1836 Path *[]PathElement `json:"path,omitempty"` 1837} 1838 1839// SetObject ... 1840type SetObject struct { 1841 autorest.Response `json:"-"` 1842 Value interface{} `json:"value,omitempty"` 1843} 1844 1845// TenantBackfillStatusResult the tenant backfill status 1846type TenantBackfillStatusResult struct { 1847 autorest.Response `json:"-"` 1848 // TenantID - READ-ONLY; The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 1849 TenantID *string `json:"tenantId,omitempty"` 1850 // Status - READ-ONLY; The status of the Tenant Backfill. Possible values include: 'NotStarted', 'NotStartedButGroupsExist', 'Started', 'Failed', 'Cancelled', 'Completed' 1851 Status Status `json:"status,omitempty"` 1852} 1853