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/date" 24 "github.com/Azure/go-autorest/autorest/to" 25 "net/http" 26) 27 28// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 29// ChildType enumerates the values for child type. 30type ChildType string 31 32const ( 33 // ChildTypeManagementGroup ... 34 ChildTypeManagementGroup ChildType = "ManagementGroup" 35 // ChildTypeSubscription ... 36 ChildTypeSubscription ChildType = "Subscription" 37) 38 39// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 40// PossibleChildTypeValues returns an array of possible values for the ChildType const type. 41func PossibleChildTypeValues() []ChildType { 42 return []ChildType{ChildTypeManagementGroup, ChildTypeSubscription} 43} 44 45// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 46// ChildInfo the child information of a management group. 47type ChildInfo struct { 48 // ChildType - Possible values include: 'ChildTypeManagementGroup', 'ChildTypeSubscription' 49 ChildType ChildType `json:"childType,omitempty"` 50 // ChildID - The fully qualified ID for the child resource (management group or subscription). For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 51 ChildID *string `json:"childId,omitempty"` 52 // DisplayName - The friendly name of the child resource. 53 DisplayName *string `json:"displayName,omitempty"` 54 // Children - The list of children. 55 Children *[]ChildInfo `json:"children,omitempty"` 56} 57 58// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 59// CreateManagementGroupRequest management group creation parameters. 60type CreateManagementGroupRequest struct { 61 // DisplayName - The friendly name of the management group. 62 DisplayName *string `json:"displayName,omitempty"` 63 // ParentID - (Optional) The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 64 ParentID *string `json:"parentId,omitempty"` 65} 66 67// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 68// Details the details of a management group. 69type Details struct { 70 // Version - The version number of the object. 71 Version *float64 `json:"version,omitempty"` 72 // UpdatedTime - The date and time when this object was last updated. 73 UpdatedTime *date.Time `json:"updatedTime,omitempty"` 74 // UpdatedBy - The identity of the principal or process that updated the object. 75 UpdatedBy *string `json:"updatedBy,omitempty"` 76 Parent *ParentGroupInfo `json:"parent,omitempty"` 77} 78 79// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 80// ErrorDetails the details of the error. 81type ErrorDetails struct { 82 // Code - One of a server-defined set of error codes. 83 Code *string `json:"code,omitempty"` 84 // Message - A human-readable representation of the error. 85 Message *string `json:"message,omitempty"` 86} 87 88// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 89// ErrorResponse the error object. 90type ErrorResponse struct { 91 Error *ErrorDetails `json:"error,omitempty"` 92} 93 94// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 95// Info the management group resource. 96type Info struct { 97 // ID - The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 98 ID *string `json:"id,omitempty"` 99 // Type - The type of the resource. For example, /providers/Microsoft.Management/managementGroups 100 Type *string `json:"type,omitempty"` 101 // Name - The name of the management group. For example, 00000000-0000-0000-0000-000000000000 102 Name *string `json:"name,omitempty"` 103 *InfoProperties `json:"properties,omitempty"` 104} 105 106// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 107// MarshalJSON is the custom marshaler for Info. 108func (i Info) MarshalJSON() ([]byte, error) { 109 objectMap := make(map[string]interface{}) 110 if i.ID != nil { 111 objectMap["id"] = i.ID 112 } 113 if i.Type != nil { 114 objectMap["type"] = i.Type 115 } 116 if i.Name != nil { 117 objectMap["name"] = i.Name 118 } 119 if i.InfoProperties != nil { 120 objectMap["properties"] = i.InfoProperties 121 } 122 return json.Marshal(objectMap) 123} 124 125// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 126// UnmarshalJSON is the custom unmarshaler for Info struct. 127func (i *Info) UnmarshalJSON(body []byte) error { 128 var m map[string]*json.RawMessage 129 err := json.Unmarshal(body, &m) 130 if err != nil { 131 return err 132 } 133 for k, v := range m { 134 switch k { 135 case "id": 136 if v != nil { 137 var ID string 138 err = json.Unmarshal(*v, &ID) 139 if err != nil { 140 return err 141 } 142 i.ID = &ID 143 } 144 case "type": 145 if v != nil { 146 var typeVar string 147 err = json.Unmarshal(*v, &typeVar) 148 if err != nil { 149 return err 150 } 151 i.Type = &typeVar 152 } 153 case "name": 154 if v != nil { 155 var name string 156 err = json.Unmarshal(*v, &name) 157 if err != nil { 158 return err 159 } 160 i.Name = &name 161 } 162 case "properties": 163 if v != nil { 164 var infoProperties InfoProperties 165 err = json.Unmarshal(*v, &infoProperties) 166 if err != nil { 167 return err 168 } 169 i.InfoProperties = &infoProperties 170 } 171 } 172 } 173 174 return nil 175} 176 177// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 178// InfoProperties the generic properties of a management group. 179type InfoProperties struct { 180 // TenantID - The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 181 TenantID *string `json:"tenantId,omitempty"` 182 // DisplayName - The friendly name of the management group. 183 DisplayName *string `json:"displayName,omitempty"` 184} 185 186// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 187// ListResult describes the result of the request to list management groups. 188type ListResult struct { 189 autorest.Response `json:"-"` 190 // Value - The list of management groups. 191 Value *[]Info `json:"value,omitempty"` 192 // NextLink - The URL to use for getting the next set of results. 193 NextLink *string `json:"nextLink,omitempty"` 194} 195 196// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 197// ListResultIterator provides access to a complete listing of Info values. 198type ListResultIterator struct { 199 i int 200 page ListResultPage 201} 202 203// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 204// Next advances to the next value. If there was an error making 205// the request the iterator does not advance and the error is returned. 206func (iter *ListResultIterator) Next() error { 207 iter.i++ 208 if iter.i < len(iter.page.Values()) { 209 return nil 210 } 211 err := iter.page.Next() 212 if err != nil { 213 iter.i-- 214 return err 215 } 216 iter.i = 0 217 return nil 218} 219 220// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 221// NotDone returns true if the enumeration should be started or is not yet complete. 222func (iter ListResultIterator) NotDone() bool { 223 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 224} 225 226// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 227// Response returns the raw server response from the last page request. 228func (iter ListResultIterator) Response() ListResult { 229 return iter.page.Response() 230} 231 232// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 233// Value returns the current value or a zero-initialized value if the 234// iterator has advanced beyond the end of the collection. 235func (iter ListResultIterator) Value() Info { 236 if !iter.page.NotDone() { 237 return Info{} 238 } 239 return iter.page.Values()[iter.i] 240} 241 242// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 243// IsEmpty returns true if the ListResult contains no values. 244func (lr ListResult) IsEmpty() bool { 245 return lr.Value == nil || len(*lr.Value) == 0 246} 247 248// listResultPreparer prepares a request to retrieve the next set of results. 249// It returns nil if no more results exist. 250func (lr ListResult) listResultPreparer() (*http.Request, error) { 251 if lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 { 252 return nil, nil 253 } 254 return autorest.Prepare(&http.Request{}, 255 autorest.AsJSON(), 256 autorest.AsGet(), 257 autorest.WithBaseURL(to.String(lr.NextLink))) 258} 259 260// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 261// ListResultPage contains a page of Info values. 262type ListResultPage struct { 263 fn func(ListResult) (ListResult, error) 264 lr ListResult 265} 266 267// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 268// Next advances to the next page of values. If there was an error making 269// the request the page does not advance and the error is returned. 270func (page *ListResultPage) Next() error { 271 next, err := page.fn(page.lr) 272 if err != nil { 273 return err 274 } 275 page.lr = next 276 return nil 277} 278 279// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 280// NotDone returns true if the page enumeration should be started or is not yet complete. 281func (page ListResultPage) NotDone() bool { 282 return !page.lr.IsEmpty() 283} 284 285// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 286// Response returns the raw server response from the last page request. 287func (page ListResultPage) Response() ListResult { 288 return page.lr 289} 290 291// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 292// Values returns the slice of values for the current page or nil if there are no values. 293func (page ListResultPage) Values() []Info { 294 if page.lr.IsEmpty() { 295 return nil 296 } 297 return *page.lr.Value 298} 299 300// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 301// ManagementGroup the management group details. 302type ManagementGroup struct { 303 autorest.Response `json:"-"` 304 // ID - The fully qualified ID for the management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 305 ID *string `json:"id,omitempty"` 306 // Type - The type of the resource. For example, /providers/Microsoft.Management/managementGroups 307 Type *string `json:"type,omitempty"` 308 // Name - The name of the management group. For example, 00000000-0000-0000-0000-000000000000 309 Name *string `json:"name,omitempty"` 310 *Properties `json:"properties,omitempty"` 311} 312 313// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 314// MarshalJSON is the custom marshaler for ManagementGroup. 315func (mg ManagementGroup) MarshalJSON() ([]byte, error) { 316 objectMap := make(map[string]interface{}) 317 if mg.ID != nil { 318 objectMap["id"] = mg.ID 319 } 320 if mg.Type != nil { 321 objectMap["type"] = mg.Type 322 } 323 if mg.Name != nil { 324 objectMap["name"] = mg.Name 325 } 326 if mg.Properties != nil { 327 objectMap["properties"] = mg.Properties 328 } 329 return json.Marshal(objectMap) 330} 331 332// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 333// UnmarshalJSON is the custom unmarshaler for ManagementGroup struct. 334func (mg *ManagementGroup) UnmarshalJSON(body []byte) error { 335 var m map[string]*json.RawMessage 336 err := json.Unmarshal(body, &m) 337 if err != nil { 338 return err 339 } 340 for k, v := range m { 341 switch k { 342 case "id": 343 if v != nil { 344 var ID string 345 err = json.Unmarshal(*v, &ID) 346 if err != nil { 347 return err 348 } 349 mg.ID = &ID 350 } 351 case "type": 352 if v != nil { 353 var typeVar string 354 err = json.Unmarshal(*v, &typeVar) 355 if err != nil { 356 return err 357 } 358 mg.Type = &typeVar 359 } 360 case "name": 361 if v != nil { 362 var name string 363 err = json.Unmarshal(*v, &name) 364 if err != nil { 365 return err 366 } 367 mg.Name = &name 368 } 369 case "properties": 370 if v != nil { 371 var properties Properties 372 err = json.Unmarshal(*v, &properties) 373 if err != nil { 374 return err 375 } 376 mg.Properties = &properties 377 } 378 } 379 } 380 381 return nil 382} 383 384// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 385// Operation operation supported by the Microsoft.Management resource provider. 386type Operation struct { 387 // Name - Operation name: {provider}/{resource}/{operation}. 388 Name *string `json:"name,omitempty"` 389 // Display - The object that represents the operation. 390 Display *OperationDisplay `json:"display,omitempty"` 391} 392 393// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 394// OperationDisplay the object that represents the operation. 395type OperationDisplay struct { 396 // Provider - The name of the provider. 397 Provider *string `json:"provider,omitempty"` 398 // Resource - The resource on which the operation is performed. 399 Resource *string `json:"resource,omitempty"` 400 // Operation - The operation that can be performed. 401 Operation *string `json:"operation,omitempty"` 402 // Description - Operation description. 403 Description *string `json:"description,omitempty"` 404} 405 406// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 407// OperationListResult describes the result of the request to list Microsoft.Management operations. 408type OperationListResult struct { 409 autorest.Response `json:"-"` 410 // Value - List of operations supported by the Microsoft.Management resource provider. 411 Value *[]Operation `json:"value,omitempty"` 412 // NextLink - URL to get the next set of operation list results if there are any. 413 NextLink *string `json:"nextLink,omitempty"` 414} 415 416// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 417// OperationListResultIterator provides access to a complete listing of Operation values. 418type OperationListResultIterator struct { 419 i int 420 page OperationListResultPage 421} 422 423// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 424// Next advances to the next value. If there was an error making 425// the request the iterator does not advance and the error is returned. 426func (iter *OperationListResultIterator) Next() error { 427 iter.i++ 428 if iter.i < len(iter.page.Values()) { 429 return nil 430 } 431 err := iter.page.Next() 432 if err != nil { 433 iter.i-- 434 return err 435 } 436 iter.i = 0 437 return nil 438} 439 440// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 441// NotDone returns true if the enumeration should be started or is not yet complete. 442func (iter OperationListResultIterator) NotDone() bool { 443 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 444} 445 446// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 447// Response returns the raw server response from the last page request. 448func (iter OperationListResultIterator) Response() OperationListResult { 449 return iter.page.Response() 450} 451 452// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 453// Value returns the current value or a zero-initialized value if the 454// iterator has advanced beyond the end of the collection. 455func (iter OperationListResultIterator) Value() Operation { 456 if !iter.page.NotDone() { 457 return Operation{} 458 } 459 return iter.page.Values()[iter.i] 460} 461 462// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 463// IsEmpty returns true if the ListResult contains no values. 464func (olr OperationListResult) IsEmpty() bool { 465 return olr.Value == nil || len(*olr.Value) == 0 466} 467 468// operationListResultPreparer prepares a request to retrieve the next set of results. 469// It returns nil if no more results exist. 470func (olr OperationListResult) operationListResultPreparer() (*http.Request, error) { 471 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 472 return nil, nil 473 } 474 return autorest.Prepare(&http.Request{}, 475 autorest.AsJSON(), 476 autorest.AsGet(), 477 autorest.WithBaseURL(to.String(olr.NextLink))) 478} 479 480// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 481// OperationListResultPage contains a page of Operation values. 482type OperationListResultPage struct { 483 fn func(OperationListResult) (OperationListResult, error) 484 olr OperationListResult 485} 486 487// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 488// Next advances to the next page of values. If there was an error making 489// the request the page does not advance and the error is returned. 490func (page *OperationListResultPage) Next() error { 491 next, err := page.fn(page.olr) 492 if err != nil { 493 return err 494 } 495 page.olr = next 496 return nil 497} 498 499// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 500// NotDone returns true if the page enumeration should be started or is not yet complete. 501func (page OperationListResultPage) NotDone() bool { 502 return !page.olr.IsEmpty() 503} 504 505// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 506// Response returns the raw server response from the last page request. 507func (page OperationListResultPage) Response() OperationListResult { 508 return page.olr 509} 510 511// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 512// Values returns the slice of values for the current page or nil if there are no values. 513func (page OperationListResultPage) Values() []Operation { 514 if page.olr.IsEmpty() { 515 return nil 516 } 517 return *page.olr.Value 518} 519 520// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 521// ParentGroupInfo (Optional) The ID of the parent management group. 522type ParentGroupInfo struct { 523 // ParentID - The fully qualified ID for the parent management group. For example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 524 ParentID *string `json:"parentId,omitempty"` 525 // DisplayName - The friendly name of the parent management group. 526 DisplayName *string `json:"displayName,omitempty"` 527} 528 529// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2017-11-01-preview/management instead. 530// Properties the generic properties of a management group. 531type Properties struct { 532 // TenantID - The AAD Tenant ID associated with the management group. For example, 00000000-0000-0000-0000-000000000000 533 TenantID *string `json:"tenantId,omitempty"` 534 // DisplayName - The friendly name of the management group. 535 DisplayName *string `json:"displayName,omitempty"` 536 Details *Details `json:"details,omitempty"` 537 // Children - The list of children. 538 Children *[]ChildInfo `json:"children,omitempty"` 539} 540