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 "encoding/json" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/date" 25 "github.com/Azure/go-autorest/autorest/to" 26 "net/http" 27) 28 29// InheritedPermissions enumerates the values for inherited permissions. 30type InheritedPermissions string 31 32const ( 33 // Delete ... 34 Delete InheritedPermissions = "delete" 35 // Edit ... 36 Edit InheritedPermissions = "edit" 37 // Noaccess ... 38 Noaccess InheritedPermissions = "noaccess" 39 // View ... 40 View InheritedPermissions = "view" 41) 42 43// PossibleInheritedPermissionsValues returns an array of possible values for the InheritedPermissions const type. 44func PossibleInheritedPermissionsValues() []InheritedPermissions { 45 return []InheritedPermissions{Delete, Edit, Noaccess, View} 46} 47 48// Permissions enumerates the values for permissions. 49type Permissions string 50 51const ( 52 // PermissionsDelete ... 53 PermissionsDelete Permissions = "delete" 54 // PermissionsEdit ... 55 PermissionsEdit Permissions = "edit" 56 // PermissionsNoaccess ... 57 PermissionsNoaccess Permissions = "noaccess" 58 // PermissionsView ... 59 PermissionsView Permissions = "view" 60) 61 62// PossiblePermissionsValues returns an array of possible values for the Permissions const type. 63func PossiblePermissionsValues() []Permissions { 64 return []Permissions{PermissionsDelete, PermissionsEdit, PermissionsNoaccess, PermissionsView} 65} 66 67// Permissions1 enumerates the values for permissions 1. 68type Permissions1 string 69 70const ( 71 // Permissions1Delete ... 72 Permissions1Delete Permissions1 = "delete" 73 // Permissions1Edit ... 74 Permissions1Edit Permissions1 = "edit" 75 // Permissions1Noaccess ... 76 Permissions1Noaccess Permissions1 = "noaccess" 77 // Permissions1View ... 78 Permissions1View Permissions1 = "view" 79) 80 81// PossiblePermissions1Values returns an array of possible values for the Permissions1 const type. 82func PossiblePermissions1Values() []Permissions1 { 83 return []Permissions1{Permissions1Delete, Permissions1Edit, Permissions1Noaccess, Permissions1View} 84} 85 86// ProvisioningState enumerates the values for provisioning state. 87type ProvisioningState string 88 89const ( 90 // Updating ... 91 Updating ProvisioningState = "Updating" 92) 93 94// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. 95func PossibleProvisioningStateValues() []ProvisioningState { 96 return []ProvisioningState{Updating} 97} 98 99// Reason enumerates the values for reason. 100type Reason string 101 102const ( 103 // AlreadyExists ... 104 AlreadyExists Reason = "AlreadyExists" 105 // Invalid ... 106 Invalid Reason = "Invalid" 107) 108 109// PossibleReasonValues returns an array of possible values for the Reason const type. 110func PossibleReasonValues() []Reason { 111 return []Reason{AlreadyExists, Invalid} 112} 113 114// Status enumerates the values for status. 115type Status string 116 117const ( 118 // Cancelled ... 119 Cancelled Status = "Cancelled" 120 // Completed ... 121 Completed Status = "Completed" 122 // Failed ... 123 Failed Status = "Failed" 124 // NotStarted ... 125 NotStarted Status = "NotStarted" 126 // NotStartedButGroupsExist ... 127 NotStartedButGroupsExist Status = "NotStartedButGroupsExist" 128 // Started ... 129 Started Status = "Started" 130) 131 132// PossibleStatusValues returns an array of possible values for the Status const type. 133func PossibleStatusValues() []Status { 134 return []Status{Cancelled, Completed, Failed, NotStarted, NotStartedButGroupsExist, Started} 135} 136 137// Type enumerates the values for type. 138type Type string 139 140const ( 141 // ProvidersMicrosoftManagementmanagementGroups ... 142 ProvidersMicrosoftManagementmanagementGroups Type = "/providers/Microsoft.Management/managementGroups" 143) 144 145// PossibleTypeValues returns an array of possible values for the Type const type. 146func PossibleTypeValues() []Type { 147 return []Type{ProvidersMicrosoftManagementmanagementGroups} 148} 149 150// Type1 enumerates the values for type 1. 151type Type1 string 152 153const ( 154 // Type1ProvidersMicrosoftManagementmanagementGroups ... 155 Type1ProvidersMicrosoftManagementmanagementGroups Type1 = "/providers/Microsoft.Management/managementGroups" 156 // Type1Subscriptions ... 157 Type1Subscriptions Type1 = "/subscriptions" 158) 159 160// PossibleType1Values returns an array of possible values for the Type1 const type. 161func PossibleType1Values() []Type1 { 162 return []Type1{Type1ProvidersMicrosoftManagementmanagementGroups, Type1Subscriptions} 163} 164 165// Type2 enumerates the values for type 2. 166type Type2 string 167 168const ( 169 // Type2ProvidersMicrosoftManagementmanagementGroups ... 170 Type2ProvidersMicrosoftManagementmanagementGroups Type2 = "/providers/Microsoft.Management/managementGroups" 171 // Type2Subscriptions ... 172 Type2Subscriptions Type2 = "/subscriptions" 173) 174 175// PossibleType2Values returns an array of possible values for the Type2 const type. 176func PossibleType2Values() []Type2 { 177 return []Type2{Type2ProvidersMicrosoftManagementmanagementGroups, Type2Subscriptions} 178} 179 180// CheckNameAvailabilityRequest management group name availability check parameters. 181type CheckNameAvailabilityRequest struct { 182 // Name - the name to check for availability 183 Name *string `json:"name,omitempty"` 184 // Type - fully qualified resource type which includes provider namespace. Possible values include: 'ProvidersMicrosoftManagementmanagementGroups' 185 Type Type `json:"type,omitempty"` 186} 187 188// CheckNameAvailabilityResult describes the result of the request to check management group name availability. 189type CheckNameAvailabilityResult struct { 190 autorest.Response `json:"-"` 191 // NameAvailable - Required. True indicates name is valid and available. False indicates the name is invalid, unavailable, or both. 192 NameAvailable *bool `json:"nameAvailable,omitempty"` 193 // Reason - 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' 194 Reason Reason `json:"reason,omitempty"` 195 // Message - 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. 196 Message *string `json:"message,omitempty"` 197} 198 199// ChildInfo the child information of a management group. 200type ChildInfo struct { 201 // Type - The fully qualified resource type which includes provider namespace (e.g. /providers/Microsoft.Management/managementGroups). Possible values include: 'Type1ProvidersMicrosoftManagementmanagementGroups', 'Type1Subscriptions' 202 Type Type1 `json:"type,omitempty"` 203 // ID - The fully qualified ID for the child resource (management group or subscription). For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 204 ID *string `json:"id,omitempty"` 205 // Name - The name of the child entity. 206 Name *string `json:"name,omitempty"` 207 // DisplayName - The friendly name of the child resource. 208 DisplayName *string `json:"displayName,omitempty"` 209 // Roles - The roles definitions associated with the management group. 210 Roles *[]string `json:"roles,omitempty"` 211 // Children - The list of children. 212 Children *[]ChildInfo `json:"children,omitempty"` 213} 214 215// CreateManagementGroupChildInfo the child information of a management group used during creation. 216type CreateManagementGroupChildInfo struct { 217 // Type - The fully qualified resource type which includes provider namespace (e.g. /providers/Microsoft.Management/managementGroups). Possible values include: 'Type2ProvidersMicrosoftManagementmanagementGroups', 'Type2Subscriptions' 218 Type Type2 `json:"type,omitempty"` 219 // ID - The fully qualified ID for the child resource (management group or subscription). For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 220 ID *string `json:"id,omitempty"` 221 // Name - The name of the child entity. 222 Name *string `json:"name,omitempty"` 223 // DisplayName - The friendly name of the child resource. 224 DisplayName *string `json:"displayName,omitempty"` 225 // Roles - The roles definitions associated with the management group. 226 Roles *[]string `json:"roles,omitempty"` 227 // Children - The list of children. 228 Children *[]CreateManagementGroupChildInfo `json:"children,omitempty"` 229} 230 231// CreateManagementGroupDetails the details of a management group used during creation. 232type CreateManagementGroupDetails struct { 233 // Version - The version number of the object. 234 Version *float64 `json:"version,omitempty"` 235 // UpdatedTime - The date and time when this object was last updated. 236 UpdatedTime *date.Time `json:"updatedTime,omitempty"` 237 // UpdatedBy - The identity of the principal or process that updated the object. 238 UpdatedBy *string `json:"updatedBy,omitempty"` 239 Parent *CreateParentGroupInfo `json:"parent,omitempty"` 240} 241 242// CreateManagementGroupProperties the generic properties of a management group used during creation. 243type CreateManagementGroupProperties struct { 244 // TenantID - The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 245 TenantID *string `json:"tenantId,omitempty"` 246 // DisplayName - The friendly name of the management group. If no value is passed then this field will be set to the groupId. 247 DisplayName *string `json:"displayName,omitempty"` 248 // Roles - The roles definitions associated with the management group. 249 Roles *[]string `json:"roles,omitempty"` 250 Details *CreateManagementGroupDetails `json:"details,omitempty"` 251 // Children - The list of children. 252 Children *[]CreateManagementGroupChildInfo `json:"children,omitempty"` 253} 254 255// CreateManagementGroupRequest management group creation parameters. 256type CreateManagementGroupRequest struct { 257 // ID - The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 258 ID *string `json:"id,omitempty"` 259 // Type - The type of the resource. For example, /providers/Microsoft.Management/managementGroups 260 Type *string `json:"type,omitempty"` 261 // Name - The name of the management group. For example, 00000000-0000-0000-0000-000000000000 262 Name *string `json:"name,omitempty"` 263 *CreateManagementGroupProperties `json:"properties,omitempty"` 264} 265 266// MarshalJSON is the custom marshaler for CreateManagementGroupRequest. 267func (cmgr CreateManagementGroupRequest) MarshalJSON() ([]byte, error) { 268 objectMap := make(map[string]interface{}) 269 if cmgr.ID != nil { 270 objectMap["id"] = cmgr.ID 271 } 272 if cmgr.Type != nil { 273 objectMap["type"] = cmgr.Type 274 } 275 if cmgr.Name != nil { 276 objectMap["name"] = cmgr.Name 277 } 278 if cmgr.CreateManagementGroupProperties != nil { 279 objectMap["properties"] = cmgr.CreateManagementGroupProperties 280 } 281 return json.Marshal(objectMap) 282} 283 284// UnmarshalJSON is the custom unmarshaler for CreateManagementGroupRequest struct. 285func (cmgr *CreateManagementGroupRequest) UnmarshalJSON(body []byte) error { 286 var m map[string]*json.RawMessage 287 err := json.Unmarshal(body, &m) 288 if err != nil { 289 return err 290 } 291 for k, v := range m { 292 switch k { 293 case "id": 294 if v != nil { 295 var ID string 296 err = json.Unmarshal(*v, &ID) 297 if err != nil { 298 return err 299 } 300 cmgr.ID = &ID 301 } 302 case "type": 303 if v != nil { 304 var typeVar string 305 err = json.Unmarshal(*v, &typeVar) 306 if err != nil { 307 return err 308 } 309 cmgr.Type = &typeVar 310 } 311 case "name": 312 if v != nil { 313 var name string 314 err = json.Unmarshal(*v, &name) 315 if err != nil { 316 return err 317 } 318 cmgr.Name = &name 319 } 320 case "properties": 321 if v != nil { 322 var createManagementGroupProperties CreateManagementGroupProperties 323 err = json.Unmarshal(*v, &createManagementGroupProperties) 324 if err != nil { 325 return err 326 } 327 cmgr.CreateManagementGroupProperties = &createManagementGroupProperties 328 } 329 } 330 } 331 332 return nil 333} 334 335// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 336type CreateOrUpdateFuture struct { 337 azure.Future 338} 339 340// Result returns the result of the asynchronous operation. 341// If the operation has not completed it will return an error. 342func (future *CreateOrUpdateFuture) Result(client Client) (so SetObject, err error) { 343 var done bool 344 done, err = future.Done(client) 345 if err != nil { 346 err = autorest.NewErrorWithError(err, "managementgroups.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 347 return 348 } 349 if !done { 350 err = azure.NewAsyncOpIncompleteError("managementgroups.CreateOrUpdateFuture") 351 return 352 } 353 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 354 if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { 355 so, err = client.CreateOrUpdateResponder(so.Response.Response) 356 if err != nil { 357 err = autorest.NewErrorWithError(err, "managementgroups.CreateOrUpdateFuture", "Result", so.Response.Response, "Failure responding to request") 358 } 359 } 360 return 361} 362 363// CreateParentGroupInfo (Optional) The ID of the parent management group used during creation. 364type CreateParentGroupInfo struct { 365 // ID - The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 366 ID *string `json:"id,omitempty"` 367 // Name - The name of the parent management group 368 Name *string `json:"name,omitempty"` 369 // DisplayName - The friendly name of the parent management group. 370 DisplayName *string `json:"displayName,omitempty"` 371} 372 373// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 374type DeleteFuture struct { 375 azure.Future 376} 377 378// Result returns the result of the asynchronous operation. 379// If the operation has not completed it will return an error. 380func (future *DeleteFuture) Result(client Client) (or OperationResults, err error) { 381 var done bool 382 done, err = future.Done(client) 383 if err != nil { 384 err = autorest.NewErrorWithError(err, "managementgroups.DeleteFuture", "Result", future.Response(), "Polling failure") 385 return 386 } 387 if !done { 388 err = azure.NewAsyncOpIncompleteError("managementgroups.DeleteFuture") 389 return 390 } 391 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 392 if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { 393 or, err = client.DeleteResponder(or.Response.Response) 394 if err != nil { 395 err = autorest.NewErrorWithError(err, "managementgroups.DeleteFuture", "Result", or.Response.Response, "Failure responding to request") 396 } 397 } 398 return 399} 400 401// Details the details of a management group. 402type Details struct { 403 // Version - The version number of the object. 404 Version *float64 `json:"version,omitempty"` 405 // UpdatedTime - The date and time when this object was last updated. 406 UpdatedTime *date.Time `json:"updatedTime,omitempty"` 407 // UpdatedBy - The identity of the principal or process that updated the object. 408 UpdatedBy *string `json:"updatedBy,omitempty"` 409 Parent *ParentGroupInfo `json:"parent,omitempty"` 410} 411 412// EntityHierarchyItem the management group details for the hierarchy view. 413type EntityHierarchyItem struct { 414 // ID - The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 415 ID *string `json:"id,omitempty"` 416 // Type - The type of the resource. For example, /providers/Microsoft.Management/managementGroups 417 Type *string `json:"type,omitempty"` 418 // Name - The name of the management group. For example, 00000000-0000-0000-0000-000000000000 419 Name *string `json:"name,omitempty"` 420 *EntityHierarchyItemProperties `json:"properties,omitempty"` 421} 422 423// MarshalJSON is the custom marshaler for EntityHierarchyItem. 424func (ehi EntityHierarchyItem) MarshalJSON() ([]byte, error) { 425 objectMap := make(map[string]interface{}) 426 if ehi.ID != nil { 427 objectMap["id"] = ehi.ID 428 } 429 if ehi.Type != nil { 430 objectMap["type"] = ehi.Type 431 } 432 if ehi.Name != nil { 433 objectMap["name"] = ehi.Name 434 } 435 if ehi.EntityHierarchyItemProperties != nil { 436 objectMap["properties"] = ehi.EntityHierarchyItemProperties 437 } 438 return json.Marshal(objectMap) 439} 440 441// UnmarshalJSON is the custom unmarshaler for EntityHierarchyItem struct. 442func (ehi *EntityHierarchyItem) UnmarshalJSON(body []byte) error { 443 var m map[string]*json.RawMessage 444 err := json.Unmarshal(body, &m) 445 if err != nil { 446 return err 447 } 448 for k, v := range m { 449 switch k { 450 case "id": 451 if v != nil { 452 var ID string 453 err = json.Unmarshal(*v, &ID) 454 if err != nil { 455 return err 456 } 457 ehi.ID = &ID 458 } 459 case "type": 460 if v != nil { 461 var typeVar string 462 err = json.Unmarshal(*v, &typeVar) 463 if err != nil { 464 return err 465 } 466 ehi.Type = &typeVar 467 } 468 case "name": 469 if v != nil { 470 var name string 471 err = json.Unmarshal(*v, &name) 472 if err != nil { 473 return err 474 } 475 ehi.Name = &name 476 } 477 case "properties": 478 if v != nil { 479 var entityHierarchyItemProperties EntityHierarchyItemProperties 480 err = json.Unmarshal(*v, &entityHierarchyItemProperties) 481 if err != nil { 482 return err 483 } 484 ehi.EntityHierarchyItemProperties = &entityHierarchyItemProperties 485 } 486 } 487 } 488 489 return nil 490} 491 492// EntityHierarchyItemProperties the generic properties of a management group. 493type EntityHierarchyItemProperties struct { 494 // DisplayName - The friendly name of the management group. 495 DisplayName *string `json:"displayName,omitempty"` 496 // Permissions - Possible values include: 'Permissions1Noaccess', 'Permissions1View', 'Permissions1Edit', 'Permissions1Delete' 497 Permissions Permissions1 `json:"permissions,omitempty"` 498 // Children - The list of children. 499 Children *[]EntityHierarchyItem `json:"children,omitempty"` 500} 501 502// EntityInfo the entity. 503type EntityInfo struct { 504 // ID - The fully qualified ID for the entity. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 505 ID *string `json:"id,omitempty"` 506 // Type - The type of the resource. For example, /providers/Microsoft.Management/managementGroups 507 Type *string `json:"type,omitempty"` 508 // Name - The name of the entity. For example, 00000000-0000-0000-0000-000000000000 509 Name *string `json:"name,omitempty"` 510 *EntityInfoProperties `json:"properties,omitempty"` 511} 512 513// MarshalJSON is the custom marshaler for EntityInfo. 514func (ei EntityInfo) MarshalJSON() ([]byte, error) { 515 objectMap := make(map[string]interface{}) 516 if ei.ID != nil { 517 objectMap["id"] = ei.ID 518 } 519 if ei.Type != nil { 520 objectMap["type"] = ei.Type 521 } 522 if ei.Name != nil { 523 objectMap["name"] = ei.Name 524 } 525 if ei.EntityInfoProperties != nil { 526 objectMap["properties"] = ei.EntityInfoProperties 527 } 528 return json.Marshal(objectMap) 529} 530 531// UnmarshalJSON is the custom unmarshaler for EntityInfo struct. 532func (ei *EntityInfo) UnmarshalJSON(body []byte) error { 533 var m map[string]*json.RawMessage 534 err := json.Unmarshal(body, &m) 535 if err != nil { 536 return err 537 } 538 for k, v := range m { 539 switch k { 540 case "id": 541 if v != nil { 542 var ID string 543 err = json.Unmarshal(*v, &ID) 544 if err != nil { 545 return err 546 } 547 ei.ID = &ID 548 } 549 case "type": 550 if v != nil { 551 var typeVar string 552 err = json.Unmarshal(*v, &typeVar) 553 if err != nil { 554 return err 555 } 556 ei.Type = &typeVar 557 } 558 case "name": 559 if v != nil { 560 var name string 561 err = json.Unmarshal(*v, &name) 562 if err != nil { 563 return err 564 } 565 ei.Name = &name 566 } 567 case "properties": 568 if v != nil { 569 var entityInfoProperties EntityInfoProperties 570 err = json.Unmarshal(*v, &entityInfoProperties) 571 if err != nil { 572 return err 573 } 574 ei.EntityInfoProperties = &entityInfoProperties 575 } 576 } 577 } 578 579 return nil 580} 581 582// EntityInfoProperties the generic properties of an entity. 583type EntityInfoProperties struct { 584 // TenantID - The AAD Tenant ID associated with the entity. For example, 00000000-0000-0000-0000-000000000000 585 TenantID *string `json:"tenantId,omitempty"` 586 // DisplayName - The friendly name of the management group. 587 DisplayName *string `json:"displayName,omitempty"` 588 Parent *EntityParentGroupInfo `json:"parent,omitempty"` 589 // Permissions - Possible values include: 'PermissionsNoaccess', 'PermissionsView', 'PermissionsEdit', 'PermissionsDelete' 590 Permissions Permissions `json:"permissions,omitempty"` 591 // InheritedPermissions - Possible values include: 'Noaccess', 'View', 'Edit', 'Delete' 592 InheritedPermissions InheritedPermissions `json:"inheritedPermissions,omitempty"` 593 NumberOfDescendants *int32 `json:"numberOfDescendants,omitempty"` 594 // NumberOfChildren - Number of children is the number of Groups and Subscriptions that are exactly one level underneath the current Group. 595 NumberOfChildren *int32 `json:"numberOfChildren,omitempty"` 596 // NumberOfChildGroups - Number of child groups is the number of Groups that are exactly one level underneath the current Group. 597 NumberOfChildGroups *int32 `json:"numberOfChildGroups,omitempty"` 598 // ParentDisplayNameChain - The parent display name chain from the root group to the immediate parent 599 ParentDisplayNameChain *[]string `json:"parentDisplayNameChain,omitempty"` 600 // ParentNameChain - The parent name chain from the root group to the immediate parent 601 ParentNameChain *[]string `json:"parentNameChain,omitempty"` 602} 603 604// EntityListResult describes the result of the request to view entities. 605type EntityListResult struct { 606 autorest.Response `json:"-"` 607 // Value - The list of entities. 608 Value *[]EntityInfo `json:"value,omitempty"` 609 // Count - Total count of records that match the filter 610 Count *int32 `json:"count,omitempty"` 611 // NextLink - The URL to use for getting the next set of results. 612 NextLink *string `json:"nextLink,omitempty"` 613} 614 615// EntityListResultIterator provides access to a complete listing of EntityInfo values. 616type EntityListResultIterator struct { 617 i int 618 page EntityListResultPage 619} 620 621// Next advances to the next value. If there was an error making 622// the request the iterator does not advance and the error is returned. 623func (iter *EntityListResultIterator) Next() error { 624 iter.i++ 625 if iter.i < len(iter.page.Values()) { 626 return nil 627 } 628 err := iter.page.Next() 629 if err != nil { 630 iter.i-- 631 return err 632 } 633 iter.i = 0 634 return nil 635} 636 637// NotDone returns true if the enumeration should be started or is not yet complete. 638func (iter EntityListResultIterator) NotDone() bool { 639 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 640} 641 642// Response returns the raw server response from the last page request. 643func (iter EntityListResultIterator) Response() EntityListResult { 644 return iter.page.Response() 645} 646 647// Value returns the current value or a zero-initialized value if the 648// iterator has advanced beyond the end of the collection. 649func (iter EntityListResultIterator) Value() EntityInfo { 650 if !iter.page.NotDone() { 651 return EntityInfo{} 652 } 653 return iter.page.Values()[iter.i] 654} 655 656// IsEmpty returns true if the ListResult contains no values. 657func (elr EntityListResult) IsEmpty() bool { 658 return elr.Value == nil || len(*elr.Value) == 0 659} 660 661// entityListResultPreparer prepares a request to retrieve the next set of results. 662// It returns nil if no more results exist. 663func (elr EntityListResult) entityListResultPreparer() (*http.Request, error) { 664 if elr.NextLink == nil || len(to.String(elr.NextLink)) < 1 { 665 return nil, nil 666 } 667 return autorest.Prepare(&http.Request{}, 668 autorest.AsJSON(), 669 autorest.AsGet(), 670 autorest.WithBaseURL(to.String(elr.NextLink))) 671} 672 673// EntityListResultPage contains a page of EntityInfo values. 674type EntityListResultPage struct { 675 fn func(EntityListResult) (EntityListResult, error) 676 elr EntityListResult 677} 678 679// Next advances to the next page of values. If there was an error making 680// the request the page does not advance and the error is returned. 681func (page *EntityListResultPage) Next() error { 682 next, err := page.fn(page.elr) 683 if err != nil { 684 return err 685 } 686 page.elr = next 687 return nil 688} 689 690// NotDone returns true if the page enumeration should be started or is not yet complete. 691func (page EntityListResultPage) NotDone() bool { 692 return !page.elr.IsEmpty() 693} 694 695// Response returns the raw server response from the last page request. 696func (page EntityListResultPage) Response() EntityListResult { 697 return page.elr 698} 699 700// Values returns the slice of values for the current page or nil if there are no values. 701func (page EntityListResultPage) Values() []EntityInfo { 702 if page.elr.IsEmpty() { 703 return nil 704 } 705 return *page.elr.Value 706} 707 708// EntityParentGroupInfo (Optional) The ID of the parent management group. 709type EntityParentGroupInfo struct { 710 // ID - The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 711 ID *string `json:"id,omitempty"` 712} 713 714// ErrorDetails the details of the error. 715type ErrorDetails struct { 716 // Code - One of a server-defined set of error codes. 717 Code *string `json:"code,omitempty"` 718 // Message - A human-readable representation of the error. 719 Message *string `json:"message,omitempty"` 720 // Details - A human-readable representation of the error's details. 721 Details *string `json:"details,omitempty"` 722} 723 724// ErrorResponse the error object. 725type ErrorResponse struct { 726 Error *ErrorDetails `json:"error,omitempty"` 727} 728 729// Info the management group resource. 730type Info struct { 731 // ID - The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 732 ID *string `json:"id,omitempty"` 733 // Type - The type of the resource. For example, /providers/Microsoft.Management/managementGroups 734 Type *string `json:"type,omitempty"` 735 // Name - The name of the management group. For example, 00000000-0000-0000-0000-000000000000 736 Name *string `json:"name,omitempty"` 737 *InfoProperties `json:"properties,omitempty"` 738} 739 740// MarshalJSON is the custom marshaler for Info. 741func (i Info) MarshalJSON() ([]byte, error) { 742 objectMap := make(map[string]interface{}) 743 if i.ID != nil { 744 objectMap["id"] = i.ID 745 } 746 if i.Type != nil { 747 objectMap["type"] = i.Type 748 } 749 if i.Name != nil { 750 objectMap["name"] = i.Name 751 } 752 if i.InfoProperties != nil { 753 objectMap["properties"] = i.InfoProperties 754 } 755 return json.Marshal(objectMap) 756} 757 758// UnmarshalJSON is the custom unmarshaler for Info struct. 759func (i *Info) UnmarshalJSON(body []byte) error { 760 var m map[string]*json.RawMessage 761 err := json.Unmarshal(body, &m) 762 if err != nil { 763 return err 764 } 765 for k, v := range m { 766 switch k { 767 case "id": 768 if v != nil { 769 var ID string 770 err = json.Unmarshal(*v, &ID) 771 if err != nil { 772 return err 773 } 774 i.ID = &ID 775 } 776 case "type": 777 if v != nil { 778 var typeVar string 779 err = json.Unmarshal(*v, &typeVar) 780 if err != nil { 781 return err 782 } 783 i.Type = &typeVar 784 } 785 case "name": 786 if v != nil { 787 var name string 788 err = json.Unmarshal(*v, &name) 789 if err != nil { 790 return err 791 } 792 i.Name = &name 793 } 794 case "properties": 795 if v != nil { 796 var infoProperties InfoProperties 797 err = json.Unmarshal(*v, &infoProperties) 798 if err != nil { 799 return err 800 } 801 i.InfoProperties = &infoProperties 802 } 803 } 804 } 805 806 return nil 807} 808 809// InfoProperties the generic properties of a management group. 810type InfoProperties struct { 811 // TenantID - The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 812 TenantID *string `json:"tenantId,omitempty"` 813 // DisplayName - The friendly name of the management group. 814 DisplayName *string `json:"displayName,omitempty"` 815} 816 817// ListResult describes the result of the request to list management groups. 818type ListResult struct { 819 autorest.Response `json:"-"` 820 // Value - The list of management groups. 821 Value *[]Info `json:"value,omitempty"` 822 // NextLink - The URL to use for getting the next set of results. 823 NextLink *string `json:"nextLink,omitempty"` 824} 825 826// ListResultIterator provides access to a complete listing of Info values. 827type ListResultIterator struct { 828 i int 829 page ListResultPage 830} 831 832// Next advances to the next value. If there was an error making 833// the request the iterator does not advance and the error is returned. 834func (iter *ListResultIterator) Next() error { 835 iter.i++ 836 if iter.i < len(iter.page.Values()) { 837 return nil 838 } 839 err := iter.page.Next() 840 if err != nil { 841 iter.i-- 842 return err 843 } 844 iter.i = 0 845 return nil 846} 847 848// NotDone returns true if the enumeration should be started or is not yet complete. 849func (iter ListResultIterator) NotDone() bool { 850 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 851} 852 853// Response returns the raw server response from the last page request. 854func (iter ListResultIterator) Response() ListResult { 855 return iter.page.Response() 856} 857 858// Value returns the current value or a zero-initialized value if the 859// iterator has advanced beyond the end of the collection. 860func (iter ListResultIterator) Value() Info { 861 if !iter.page.NotDone() { 862 return Info{} 863 } 864 return iter.page.Values()[iter.i] 865} 866 867// IsEmpty returns true if the ListResult contains no values. 868func (lr ListResult) IsEmpty() bool { 869 return lr.Value == nil || len(*lr.Value) == 0 870} 871 872// listResultPreparer prepares a request to retrieve the next set of results. 873// It returns nil if no more results exist. 874func (lr ListResult) listResultPreparer() (*http.Request, error) { 875 if lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 { 876 return nil, nil 877 } 878 return autorest.Prepare(&http.Request{}, 879 autorest.AsJSON(), 880 autorest.AsGet(), 881 autorest.WithBaseURL(to.String(lr.NextLink))) 882} 883 884// ListResultPage contains a page of Info values. 885type ListResultPage struct { 886 fn func(ListResult) (ListResult, error) 887 lr ListResult 888} 889 890// Next advances to the next page of values. If there was an error making 891// the request the page does not advance and the error is returned. 892func (page *ListResultPage) Next() error { 893 next, err := page.fn(page.lr) 894 if err != nil { 895 return err 896 } 897 page.lr = next 898 return nil 899} 900 901// NotDone returns true if the page enumeration should be started or is not yet complete. 902func (page ListResultPage) NotDone() bool { 903 return !page.lr.IsEmpty() 904} 905 906// Response returns the raw server response from the last page request. 907func (page ListResultPage) Response() ListResult { 908 return page.lr 909} 910 911// Values returns the slice of values for the current page or nil if there are no values. 912func (page ListResultPage) Values() []Info { 913 if page.lr.IsEmpty() { 914 return nil 915 } 916 return *page.lr.Value 917} 918 919// ManagementGroup the management group details. 920type ManagementGroup struct { 921 autorest.Response `json:"-"` 922 // ID - The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 923 ID *string `json:"id,omitempty"` 924 // Type - The type of the resource. For example, /providers/Microsoft.Management/managementGroups 925 Type *string `json:"type,omitempty"` 926 // Name - The name of the management group. For example, 00000000-0000-0000-0000-000000000000 927 Name *string `json:"name,omitempty"` 928 *Properties `json:"properties,omitempty"` 929} 930 931// MarshalJSON is the custom marshaler for ManagementGroup. 932func (mg ManagementGroup) MarshalJSON() ([]byte, error) { 933 objectMap := make(map[string]interface{}) 934 if mg.ID != nil { 935 objectMap["id"] = mg.ID 936 } 937 if mg.Type != nil { 938 objectMap["type"] = mg.Type 939 } 940 if mg.Name != nil { 941 objectMap["name"] = mg.Name 942 } 943 if mg.Properties != nil { 944 objectMap["properties"] = mg.Properties 945 } 946 return json.Marshal(objectMap) 947} 948 949// UnmarshalJSON is the custom unmarshaler for ManagementGroup struct. 950func (mg *ManagementGroup) UnmarshalJSON(body []byte) error { 951 var m map[string]*json.RawMessage 952 err := json.Unmarshal(body, &m) 953 if err != nil { 954 return err 955 } 956 for k, v := range m { 957 switch k { 958 case "id": 959 if v != nil { 960 var ID string 961 err = json.Unmarshal(*v, &ID) 962 if err != nil { 963 return err 964 } 965 mg.ID = &ID 966 } 967 case "type": 968 if v != nil { 969 var typeVar string 970 err = json.Unmarshal(*v, &typeVar) 971 if err != nil { 972 return err 973 } 974 mg.Type = &typeVar 975 } 976 case "name": 977 if v != nil { 978 var name string 979 err = json.Unmarshal(*v, &name) 980 if err != nil { 981 return err 982 } 983 mg.Name = &name 984 } 985 case "properties": 986 if v != nil { 987 var properties Properties 988 err = json.Unmarshal(*v, &properties) 989 if err != nil { 990 return err 991 } 992 mg.Properties = &properties 993 } 994 } 995 } 996 997 return nil 998} 999 1000// Operation operation supported by the Microsoft.Management resource provider. 1001type Operation struct { 1002 // Name - Operation name: {provider}/{resource}/{operation}. 1003 Name *string `json:"name,omitempty"` 1004 Display *OperationDisplayProperties `json:"display,omitempty"` 1005} 1006 1007// OperationDisplayProperties the object that represents the operation. 1008type OperationDisplayProperties struct { 1009 // Provider - The name of the provider. 1010 Provider *string `json:"provider,omitempty"` 1011 // Resource - The resource on which the operation is performed. 1012 Resource *string `json:"resource,omitempty"` 1013 // Operation - The operation that can be performed. 1014 Operation *string `json:"operation,omitempty"` 1015 // Description - Operation description. 1016 Description *string `json:"description,omitempty"` 1017} 1018 1019// OperationListResult describes the result of the request to list Microsoft.Management operations. 1020type OperationListResult struct { 1021 autorest.Response `json:"-"` 1022 // Value - List of operations supported by the Microsoft.Management resource provider. 1023 Value *[]Operation `json:"value,omitempty"` 1024 // NextLink - URL to get the next set of operation list results if there are any. 1025 NextLink *string `json:"nextLink,omitempty"` 1026} 1027 1028// OperationListResultIterator provides access to a complete listing of Operation values. 1029type OperationListResultIterator struct { 1030 i int 1031 page OperationListResultPage 1032} 1033 1034// Next advances to the next value. If there was an error making 1035// the request the iterator does not advance and the error is returned. 1036func (iter *OperationListResultIterator) Next() error { 1037 iter.i++ 1038 if iter.i < len(iter.page.Values()) { 1039 return nil 1040 } 1041 err := iter.page.Next() 1042 if err != nil { 1043 iter.i-- 1044 return err 1045 } 1046 iter.i = 0 1047 return nil 1048} 1049 1050// NotDone returns true if the enumeration should be started or is not yet complete. 1051func (iter OperationListResultIterator) NotDone() bool { 1052 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1053} 1054 1055// Response returns the raw server response from the last page request. 1056func (iter OperationListResultIterator) Response() OperationListResult { 1057 return iter.page.Response() 1058} 1059 1060// Value returns the current value or a zero-initialized value if the 1061// iterator has advanced beyond the end of the collection. 1062func (iter OperationListResultIterator) Value() Operation { 1063 if !iter.page.NotDone() { 1064 return Operation{} 1065 } 1066 return iter.page.Values()[iter.i] 1067} 1068 1069// IsEmpty returns true if the ListResult contains no values. 1070func (olr OperationListResult) IsEmpty() bool { 1071 return olr.Value == nil || len(*olr.Value) == 0 1072} 1073 1074// operationListResultPreparer prepares a request to retrieve the next set of results. 1075// It returns nil if no more results exist. 1076func (olr OperationListResult) operationListResultPreparer() (*http.Request, error) { 1077 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 1078 return nil, nil 1079 } 1080 return autorest.Prepare(&http.Request{}, 1081 autorest.AsJSON(), 1082 autorest.AsGet(), 1083 autorest.WithBaseURL(to.String(olr.NextLink))) 1084} 1085 1086// OperationListResultPage contains a page of Operation values. 1087type OperationListResultPage struct { 1088 fn func(OperationListResult) (OperationListResult, error) 1089 olr OperationListResult 1090} 1091 1092// Next advances to the next page of values. If there was an error making 1093// the request the page does not advance and the error is returned. 1094func (page *OperationListResultPage) Next() error { 1095 next, err := page.fn(page.olr) 1096 if err != nil { 1097 return err 1098 } 1099 page.olr = next 1100 return nil 1101} 1102 1103// NotDone returns true if the page enumeration should be started or is not yet complete. 1104func (page OperationListResultPage) NotDone() bool { 1105 return !page.olr.IsEmpty() 1106} 1107 1108// Response returns the raw server response from the last page request. 1109func (page OperationListResultPage) Response() OperationListResult { 1110 return page.olr 1111} 1112 1113// Values returns the slice of values for the current page or nil if there are no values. 1114func (page OperationListResultPage) Values() []Operation { 1115 if page.olr.IsEmpty() { 1116 return nil 1117 } 1118 return *page.olr.Value 1119} 1120 1121// OperationResults the results of an asynchronous operation. 1122type OperationResults struct { 1123 autorest.Response `json:"-"` 1124 // ID - The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 1125 ID *string `json:"id,omitempty"` 1126 // Type - The type of the resource. For example, /providers/Microsoft.Management/managementGroups 1127 Type *string `json:"type,omitempty"` 1128 // Name - The name of the management group. For example, 00000000-0000-0000-0000-000000000000 1129 Name *string `json:"name,omitempty"` 1130 *OperationResultsProperties `json:"properties,omitempty"` 1131} 1132 1133// MarshalJSON is the custom marshaler for OperationResults. 1134func (or OperationResults) MarshalJSON() ([]byte, error) { 1135 objectMap := make(map[string]interface{}) 1136 if or.ID != nil { 1137 objectMap["id"] = or.ID 1138 } 1139 if or.Type != nil { 1140 objectMap["type"] = or.Type 1141 } 1142 if or.Name != nil { 1143 objectMap["name"] = or.Name 1144 } 1145 if or.OperationResultsProperties != nil { 1146 objectMap["properties"] = or.OperationResultsProperties 1147 } 1148 return json.Marshal(objectMap) 1149} 1150 1151// UnmarshalJSON is the custom unmarshaler for OperationResults struct. 1152func (or *OperationResults) UnmarshalJSON(body []byte) error { 1153 var m map[string]*json.RawMessage 1154 err := json.Unmarshal(body, &m) 1155 if err != nil { 1156 return err 1157 } 1158 for k, v := range m { 1159 switch k { 1160 case "id": 1161 if v != nil { 1162 var ID string 1163 err = json.Unmarshal(*v, &ID) 1164 if err != nil { 1165 return err 1166 } 1167 or.ID = &ID 1168 } 1169 case "type": 1170 if v != nil { 1171 var typeVar string 1172 err = json.Unmarshal(*v, &typeVar) 1173 if err != nil { 1174 return err 1175 } 1176 or.Type = &typeVar 1177 } 1178 case "name": 1179 if v != nil { 1180 var name string 1181 err = json.Unmarshal(*v, &name) 1182 if err != nil { 1183 return err 1184 } 1185 or.Name = &name 1186 } 1187 case "properties": 1188 if v != nil { 1189 var operationResultsProperties OperationResultsProperties 1190 err = json.Unmarshal(*v, &operationResultsProperties) 1191 if err != nil { 1192 return err 1193 } 1194 or.OperationResultsProperties = &operationResultsProperties 1195 } 1196 } 1197 } 1198 1199 return nil 1200} 1201 1202// OperationResultsProperties ... 1203type OperationResultsProperties struct { 1204 // ProvisioningState - Possible values include: 'Updating' 1205 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1206} 1207 1208// ParentGroupInfo (Optional) The ID of the parent management group. 1209type ParentGroupInfo struct { 1210 // ID - The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 1211 ID *string `json:"id,omitempty"` 1212 // Name - The name of the parent management group 1213 Name *string `json:"name,omitempty"` 1214 // DisplayName - The friendly name of the parent management group. 1215 DisplayName *string `json:"displayName,omitempty"` 1216} 1217 1218// PatchManagementGroupRequest management group patch parameters. 1219type PatchManagementGroupRequest struct { 1220 // DisplayName - The friendly name of the management group. 1221 DisplayName *string `json:"displayName,omitempty"` 1222 // ParentID - (Optional) The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 1223 ParentID *string `json:"parentId,omitempty"` 1224} 1225 1226// Properties the generic properties of a management group. 1227type Properties struct { 1228 // TenantID - The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 1229 TenantID *string `json:"tenantId,omitempty"` 1230 // DisplayName - The friendly name of the management group. 1231 DisplayName *string `json:"displayName,omitempty"` 1232 // Roles - The role definitions associated with the management group. 1233 Roles *[]string `json:"roles,omitempty"` 1234 Details *Details `json:"details,omitempty"` 1235 // Children - The list of children. 1236 Children *[]ChildInfo `json:"children,omitempty"` 1237} 1238 1239// SetObject ... 1240type SetObject struct { 1241 autorest.Response `json:"-"` 1242 Value interface{} `json:"value,omitempty"` 1243} 1244 1245// TenantBackfillStatusResult the tenant backfill status 1246type TenantBackfillStatusResult struct { 1247 autorest.Response `json:"-"` 1248 // TenantID - The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 1249 TenantID *string `json:"tenantId,omitempty"` 1250 // Status - The status of the Tenant Backfill. Possible values include: 'NotStarted', 'NotStartedButGroupsExist', 'Started', 'Failed', 'Cancelled', 'Completed' 1251 Status Status `json:"status,omitempty"` 1252} 1253