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