1package subscription 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "github.com/Azure/go-autorest/autorest/to" 15 "github.com/Azure/go-autorest/tracing" 16 "net/http" 17) 18 19// The package's fully qualified name. 20const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/subscription/mgmt/2019-10-01-preview/subscription" 21 22// AdPrincipal active Directory Principal who’ll get owner access on the new subscription. 23type AdPrincipal struct { 24 // ObjectID - Object id of the Principal 25 ObjectID *string `json:"objectId,omitempty"` 26} 27 28// CanceledSubscriptionID the ID of the canceled subscription 29type CanceledSubscriptionID struct { 30 autorest.Response `json:"-"` 31 // Value - READ-ONLY; The ID of the canceled subscription 32 Value *string `json:"value,omitempty"` 33} 34 35// MarshalJSON is the custom marshaler for CanceledSubscriptionID. 36func (csi CanceledSubscriptionID) MarshalJSON() ([]byte, error) { 37 objectMap := make(map[string]interface{}) 38 return json.Marshal(objectMap) 39} 40 41// CreateAliasFuture an abstraction for monitoring and retrieving the results of a long-running operation. 42type CreateAliasFuture struct { 43 azure.FutureAPI 44 // Result returns the result of the asynchronous operation. 45 // If the operation has not completed it will return an error. 46 Result func(Client) (PutAliasResponse, error) 47} 48 49// UnmarshalJSON is the custom unmarshaller for CreateFuture. 50func (future *CreateAliasFuture) UnmarshalJSON(body []byte) error { 51 var azFuture azure.Future 52 if err := json.Unmarshal(body, &azFuture); err != nil { 53 return err 54 } 55 future.FutureAPI = &azFuture 56 future.Result = future.result 57 return nil 58} 59 60// result is the default implementation for CreateAliasFuture.Result. 61func (future *CreateAliasFuture) result(client Client) (par PutAliasResponse, err error) { 62 var done bool 63 done, err = future.DoneWithContext(context.Background(), client) 64 if err != nil { 65 err = autorest.NewErrorWithError(err, "subscription.CreateAliasFuture", "Result", future.Response(), "Polling failure") 66 return 67 } 68 if !done { 69 par.Response.Response = future.Response() 70 err = azure.NewAsyncOpIncompleteError("subscription.CreateAliasFuture") 71 return 72 } 73 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 74 if par.Response.Response, err = future.GetResult(sender); err == nil && par.Response.Response.StatusCode != http.StatusNoContent { 75 par, err = client.CreateAliasResponder(par.Response.Response) 76 if err != nil { 77 err = autorest.NewErrorWithError(err, "subscription.CreateAliasFuture", "Result", par.Response.Response, "Failure responding to request") 78 } 79 } 80 return 81} 82 83// CreateCspSubscriptionFuture an abstraction for monitoring and retrieving the results of a long-running 84// operation. 85type CreateCspSubscriptionFuture struct { 86 azure.FutureAPI 87 // Result returns the result of the asynchronous operation. 88 // If the operation has not completed it will return an error. 89 Result func(Client) (CreationResult, error) 90} 91 92// UnmarshalJSON is the custom unmarshaller for CreateFuture. 93func (future *CreateCspSubscriptionFuture) UnmarshalJSON(body []byte) error { 94 var azFuture azure.Future 95 if err := json.Unmarshal(body, &azFuture); err != nil { 96 return err 97 } 98 future.FutureAPI = &azFuture 99 future.Result = future.result 100 return nil 101} 102 103// result is the default implementation for CreateCspSubscriptionFuture.Result. 104func (future *CreateCspSubscriptionFuture) result(client Client) (cr CreationResult, err error) { 105 var done bool 106 done, err = future.DoneWithContext(context.Background(), client) 107 if err != nil { 108 err = autorest.NewErrorWithError(err, "subscription.CreateCspSubscriptionFuture", "Result", future.Response(), "Polling failure") 109 return 110 } 111 if !done { 112 cr.Response.Response = future.Response() 113 err = azure.NewAsyncOpIncompleteError("subscription.CreateCspSubscriptionFuture") 114 return 115 } 116 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 117 if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { 118 cr, err = client.CreateCspSubscriptionResponder(cr.Response.Response) 119 if err != nil { 120 err = autorest.NewErrorWithError(err, "subscription.CreateCspSubscriptionFuture", "Result", cr.Response.Response, "Failure responding to request") 121 } 122 } 123 return 124} 125 126// CreateSubscriptionFuture an abstraction for monitoring and retrieving the results of a long-running 127// operation. 128type CreateSubscriptionFuture struct { 129 azure.FutureAPI 130 // Result returns the result of the asynchronous operation. 131 // If the operation has not completed it will return an error. 132 Result func(Client) (CreationResult, error) 133} 134 135// UnmarshalJSON is the custom unmarshaller for CreateFuture. 136func (future *CreateSubscriptionFuture) UnmarshalJSON(body []byte) error { 137 var azFuture azure.Future 138 if err := json.Unmarshal(body, &azFuture); err != nil { 139 return err 140 } 141 future.FutureAPI = &azFuture 142 future.Result = future.result 143 return nil 144} 145 146// result is the default implementation for CreateSubscriptionFuture.Result. 147func (future *CreateSubscriptionFuture) result(client Client) (cr CreationResult, err error) { 148 var done bool 149 done, err = future.DoneWithContext(context.Background(), client) 150 if err != nil { 151 err = autorest.NewErrorWithError(err, "subscription.CreateSubscriptionFuture", "Result", future.Response(), "Polling failure") 152 return 153 } 154 if !done { 155 cr.Response.Response = future.Response() 156 err = azure.NewAsyncOpIncompleteError("subscription.CreateSubscriptionFuture") 157 return 158 } 159 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 160 if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { 161 cr, err = client.CreateSubscriptionResponder(cr.Response.Response) 162 if err != nil { 163 err = autorest.NewErrorWithError(err, "subscription.CreateSubscriptionFuture", "Result", cr.Response.Response, "Failure responding to request") 164 } 165 } 166 return 167} 168 169// CreateSubscriptionInEnrollmentAccountFuture an abstraction for monitoring and retrieving the results of 170// a long-running operation. 171type CreateSubscriptionInEnrollmentAccountFuture struct { 172 azure.FutureAPI 173 // Result returns the result of the asynchronous operation. 174 // If the operation has not completed it will return an error. 175 Result func(Client) (CreationResult, error) 176} 177 178// UnmarshalJSON is the custom unmarshaller for CreateFuture. 179func (future *CreateSubscriptionInEnrollmentAccountFuture) UnmarshalJSON(body []byte) error { 180 var azFuture azure.Future 181 if err := json.Unmarshal(body, &azFuture); err != nil { 182 return err 183 } 184 future.FutureAPI = &azFuture 185 future.Result = future.result 186 return nil 187} 188 189// result is the default implementation for CreateSubscriptionInEnrollmentAccountFuture.Result. 190func (future *CreateSubscriptionInEnrollmentAccountFuture) result(client Client) (cr CreationResult, err error) { 191 var done bool 192 done, err = future.DoneWithContext(context.Background(), client) 193 if err != nil { 194 err = autorest.NewErrorWithError(err, "subscription.CreateSubscriptionInEnrollmentAccountFuture", "Result", future.Response(), "Polling failure") 195 return 196 } 197 if !done { 198 cr.Response.Response = future.Response() 199 err = azure.NewAsyncOpIncompleteError("subscription.CreateSubscriptionInEnrollmentAccountFuture") 200 return 201 } 202 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 203 if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { 204 cr, err = client.CreateSubscriptionInEnrollmentAccountResponder(cr.Response.Response) 205 if err != nil { 206 err = autorest.NewErrorWithError(err, "subscription.CreateSubscriptionInEnrollmentAccountFuture", "Result", cr.Response.Response, "Failure responding to request") 207 } 208 } 209 return 210} 211 212// CreationParameters subscription Creation Parameters required to create a new Azure subscription. 213type CreationParameters struct { 214 // DisplayName - The display name of the subscription. 215 DisplayName *string `json:"displayName,omitempty"` 216 // ManagementGroupID - The Management Group Id. 217 ManagementGroupID *string `json:"managementGroupId,omitempty"` 218 // Owners - The list of principals that should be granted Owner access on the subscription. Principals should be of type User, Service Principal or Security Group. 219 Owners *[]AdPrincipal `json:"owners,omitempty"` 220 // OfferType - The offer type of the subscription. For example, MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P (EnterpriseAgreement devTest) are available. Only valid when creating a subscription in a enrollment account scope. Possible values include: 'MSAZR0017P', 'MSAZR0148P' 221 OfferType OfferType `json:"offerType,omitempty"` 222 // AdditionalParameters - Additional, untyped parameters to support custom subscription creation scenarios. 223 AdditionalParameters map[string]interface{} `json:"additionalParameters"` 224} 225 226// MarshalJSON is the custom marshaler for CreationParameters. 227func (cp CreationParameters) MarshalJSON() ([]byte, error) { 228 objectMap := make(map[string]interface{}) 229 if cp.DisplayName != nil { 230 objectMap["displayName"] = cp.DisplayName 231 } 232 if cp.ManagementGroupID != nil { 233 objectMap["managementGroupId"] = cp.ManagementGroupID 234 } 235 if cp.Owners != nil { 236 objectMap["owners"] = cp.Owners 237 } 238 if cp.OfferType != "" { 239 objectMap["offerType"] = cp.OfferType 240 } 241 if cp.AdditionalParameters != nil { 242 objectMap["additionalParameters"] = cp.AdditionalParameters 243 } 244 return json.Marshal(objectMap) 245} 246 247// CreationResult the created subscription object. 248type CreationResult struct { 249 autorest.Response `json:"-"` 250 // SubscriptionLink - The link to the new subscription. Use this link to check the status of subscription creation operation. 251 SubscriptionLink *string `json:"subscriptionLink,omitempty"` 252} 253 254// EnabledSubscriptionID the ID of the subscriptions that is being enabled 255type EnabledSubscriptionID struct { 256 autorest.Response `json:"-"` 257 // Value - READ-ONLY; The ID of the subscriptions that is being enabled 258 Value *string `json:"value,omitempty"` 259} 260 261// MarshalJSON is the custom marshaler for EnabledSubscriptionID. 262func (esi EnabledSubscriptionID) MarshalJSON() ([]byte, error) { 263 objectMap := make(map[string]interface{}) 264 return json.Marshal(objectMap) 265} 266 267// ErrorResponse describes the format of Error response. 268type ErrorResponse struct { 269 // Code - Error code 270 Code *string `json:"code,omitempty"` 271 // Message - Error message indicating why the operation failed. 272 Message *string `json:"message,omitempty"` 273} 274 275// ErrorResponseBody error response indicates that the service is not able to process the incoming request. 276// The reason is provided in the error message. 277type ErrorResponseBody struct { 278 // Error - The details of the error. 279 Error *ErrorResponse `json:"error,omitempty"` 280} 281 282// ListResult subscription list operation response. 283type ListResult struct { 284 autorest.Response `json:"-"` 285 // Value - An array of subscriptions. 286 Value *[]Model `json:"value,omitempty"` 287 // NextLink - The URL to get the next set of results. 288 NextLink *string `json:"nextLink,omitempty"` 289} 290 291// ListResultIterator provides access to a complete listing of Model values. 292type ListResultIterator struct { 293 i int 294 page ListResultPage 295} 296 297// NextWithContext advances to the next value. If there was an error making 298// the request the iterator does not advance and the error is returned. 299func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { 300 if tracing.IsEnabled() { 301 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") 302 defer func() { 303 sc := -1 304 if iter.Response().Response.Response != nil { 305 sc = iter.Response().Response.Response.StatusCode 306 } 307 tracing.EndSpan(ctx, sc, err) 308 }() 309 } 310 iter.i++ 311 if iter.i < len(iter.page.Values()) { 312 return nil 313 } 314 err = iter.page.NextWithContext(ctx) 315 if err != nil { 316 iter.i-- 317 return err 318 } 319 iter.i = 0 320 return nil 321} 322 323// Next advances to the next value. If there was an error making 324// the request the iterator does not advance and the error is returned. 325// Deprecated: Use NextWithContext() instead. 326func (iter *ListResultIterator) Next() error { 327 return iter.NextWithContext(context.Background()) 328} 329 330// NotDone returns true if the enumeration should be started or is not yet complete. 331func (iter ListResultIterator) NotDone() bool { 332 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 333} 334 335// Response returns the raw server response from the last page request. 336func (iter ListResultIterator) Response() ListResult { 337 return iter.page.Response() 338} 339 340// Value returns the current value or a zero-initialized value if the 341// iterator has advanced beyond the end of the collection. 342func (iter ListResultIterator) Value() Model { 343 if !iter.page.NotDone() { 344 return Model{} 345 } 346 return iter.page.Values()[iter.i] 347} 348 349// Creates a new instance of the ListResultIterator type. 350func NewListResultIterator(page ListResultPage) ListResultIterator { 351 return ListResultIterator{page: page} 352} 353 354// IsEmpty returns true if the ListResult contains no values. 355func (lr ListResult) IsEmpty() bool { 356 return lr.Value == nil || len(*lr.Value) == 0 357} 358 359// hasNextLink returns true if the NextLink is not empty. 360func (lr ListResult) hasNextLink() bool { 361 return lr.NextLink != nil && len(*lr.NextLink) != 0 362} 363 364// listResultPreparer prepares a request to retrieve the next set of results. 365// It returns nil if no more results exist. 366func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { 367 if !lr.hasNextLink() { 368 return nil, nil 369 } 370 return autorest.Prepare((&http.Request{}).WithContext(ctx), 371 autorest.AsJSON(), 372 autorest.AsGet(), 373 autorest.WithBaseURL(to.String(lr.NextLink))) 374} 375 376// ListResultPage contains a page of Model values. 377type ListResultPage struct { 378 fn func(context.Context, ListResult) (ListResult, error) 379 lr ListResult 380} 381 382// NextWithContext advances to the next page of values. If there was an error making 383// the request the page does not advance and the error is returned. 384func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { 385 if tracing.IsEnabled() { 386 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") 387 defer func() { 388 sc := -1 389 if page.Response().Response.Response != nil { 390 sc = page.Response().Response.Response.StatusCode 391 } 392 tracing.EndSpan(ctx, sc, err) 393 }() 394 } 395 for { 396 next, err := page.fn(ctx, page.lr) 397 if err != nil { 398 return err 399 } 400 page.lr = next 401 if !next.hasNextLink() || !next.IsEmpty() { 402 break 403 } 404 } 405 return nil 406} 407 408// Next advances to the next page of values. If there was an error making 409// the request the page does not advance and the error is returned. 410// Deprecated: Use NextWithContext() instead. 411func (page *ListResultPage) Next() error { 412 return page.NextWithContext(context.Background()) 413} 414 415// NotDone returns true if the page enumeration should be started or is not yet complete. 416func (page ListResultPage) NotDone() bool { 417 return !page.lr.IsEmpty() 418} 419 420// Response returns the raw server response from the last page request. 421func (page ListResultPage) Response() ListResult { 422 return page.lr 423} 424 425// Values returns the slice of values for the current page or nil if there are no values. 426func (page ListResultPage) Values() []Model { 427 if page.lr.IsEmpty() { 428 return nil 429 } 430 return *page.lr.Value 431} 432 433// Creates a new instance of the ListResultPage type. 434func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { 435 return ListResultPage{ 436 fn: getNextPage, 437 lr: cur, 438 } 439} 440 441// Location location information. 442type Location struct { 443 // ID - READ-ONLY; The fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. 444 ID *string `json:"id,omitempty"` 445 // SubscriptionID - READ-ONLY; The subscription ID. 446 SubscriptionID *string `json:"subscriptionId,omitempty"` 447 // Name - READ-ONLY; The location name. 448 Name *string `json:"name,omitempty"` 449 // DisplayName - READ-ONLY; The display name of the location. 450 DisplayName *string `json:"displayName,omitempty"` 451 // Latitude - READ-ONLY; The latitude of the location. 452 Latitude *string `json:"latitude,omitempty"` 453 // Longitude - READ-ONLY; The longitude of the location. 454 Longitude *string `json:"longitude,omitempty"` 455} 456 457// MarshalJSON is the custom marshaler for Location. 458func (l Location) MarshalJSON() ([]byte, error) { 459 objectMap := make(map[string]interface{}) 460 return json.Marshal(objectMap) 461} 462 463// LocationListResult location list operation response. 464type LocationListResult struct { 465 autorest.Response `json:"-"` 466 // Value - An array of locations. 467 Value *[]Location `json:"value,omitempty"` 468} 469 470// Model subscription information. 471type Model struct { 472 autorest.Response `json:"-"` 473 // ID - READ-ONLY; The fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000. 474 ID *string `json:"id,omitempty"` 475 // SubscriptionID - READ-ONLY; The subscription ID. 476 SubscriptionID *string `json:"subscriptionId,omitempty"` 477 // DisplayName - READ-ONLY; The subscription display name. 478 DisplayName *string `json:"displayName,omitempty"` 479 // State - READ-ONLY; The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. Possible values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted' 480 State State `json:"state,omitempty"` 481 // SubscriptionPolicies - The subscription policies. 482 SubscriptionPolicies *Policies `json:"subscriptionPolicies,omitempty"` 483 // AuthorizationSource - The authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. 484 AuthorizationSource *string `json:"authorizationSource,omitempty"` 485} 486 487// MarshalJSON is the custom marshaler for Model. 488func (mVar Model) MarshalJSON() ([]byte, error) { 489 objectMap := make(map[string]interface{}) 490 if mVar.SubscriptionPolicies != nil { 491 objectMap["subscriptionPolicies"] = mVar.SubscriptionPolicies 492 } 493 if mVar.AuthorizationSource != nil { 494 objectMap["authorizationSource"] = mVar.AuthorizationSource 495 } 496 return json.Marshal(objectMap) 497} 498 499// ModernCspSubscriptionCreationParameters the parameters required to create a new CSP subscription. 500type ModernCspSubscriptionCreationParameters struct { 501 // DisplayName - The friendly name of the subscription. 502 DisplayName *string `json:"displayName,omitempty"` 503 // SkuID - The SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of the subscription. Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for DevTest. 504 SkuID *string `json:"skuId,omitempty"` 505 // ResellerID - Reseller ID, basically MPN Id. 506 ResellerID *string `json:"resellerId,omitempty"` 507} 508 509// ModernSubscriptionCreationParameters the parameters required to create a new subscription. 510type ModernSubscriptionCreationParameters struct { 511 // DisplayName - The friendly name of the subscription. 512 DisplayName *string `json:"displayName,omitempty"` 513 // SkuID - The SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of the subscription. Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for DevTest. 514 SkuID *string `json:"skuId,omitempty"` 515 // CostCenter - If set, the cost center will show up on the Azure usage and charges file. 516 CostCenter *string `json:"costCenter,omitempty"` 517 // Owner - If specified, the AD principal will get owner access to the subscription, along with the user who is performing the create subscription operation 518 Owner *AdPrincipal `json:"owner,omitempty"` 519 // ManagementGroupID - The identifier of the management group to which this subscription will be associated. 520 ManagementGroupID *string `json:"managementGroupId,omitempty"` 521 // AdditionalParameters - Additional, untyped parameters to support custom subscription creation scenarios. 522 AdditionalParameters map[string]interface{} `json:"additionalParameters"` 523} 524 525// MarshalJSON is the custom marshaler for ModernSubscriptionCreationParameters. 526func (mscp ModernSubscriptionCreationParameters) MarshalJSON() ([]byte, error) { 527 objectMap := make(map[string]interface{}) 528 if mscp.DisplayName != nil { 529 objectMap["displayName"] = mscp.DisplayName 530 } 531 if mscp.SkuID != nil { 532 objectMap["skuId"] = mscp.SkuID 533 } 534 if mscp.CostCenter != nil { 535 objectMap["costCenter"] = mscp.CostCenter 536 } 537 if mscp.Owner != nil { 538 objectMap["owner"] = mscp.Owner 539 } 540 if mscp.ManagementGroupID != nil { 541 objectMap["managementGroupId"] = mscp.ManagementGroupID 542 } 543 if mscp.AdditionalParameters != nil { 544 objectMap["additionalParameters"] = mscp.AdditionalParameters 545 } 546 return json.Marshal(objectMap) 547} 548 549// Name the new name of the subscription. 550type Name struct { 551 // SubscriptionName - New subscription name 552 SubscriptionName *string `json:"subscriptionName,omitempty"` 553} 554 555// Operation REST API operation 556type Operation struct { 557 // Name - Operation name: {provider}/{resource}/{operation} 558 Name *string `json:"name,omitempty"` 559 // Display - The object that represents the operation. 560 Display *OperationDisplay `json:"display,omitempty"` 561} 562 563// OperationDisplay the object that represents the operation. 564type OperationDisplay struct { 565 // Provider - Service provider: Microsoft.Subscription 566 Provider *string `json:"provider,omitempty"` 567 // Resource - Resource on which the operation is performed: Profile, endpoint, etc. 568 Resource *string `json:"resource,omitempty"` 569 // Operation - Operation type: Read, write, delete, etc. 570 Operation *string `json:"operation,omitempty"` 571} 572 573// OperationListResult result of the request to list operations. It contains a list of operations and a URL 574// link to get the next set of results. 575type OperationListResult struct { 576 autorest.Response `json:"-"` 577 // Value - List of operations. 578 Value *[]Operation `json:"value,omitempty"` 579 // NextLink - URL to get the next set of operation list results if there are any. 580 NextLink *string `json:"nextLink,omitempty"` 581} 582 583// Policies subscription policies. 584type Policies struct { 585 // LocationPlacementID - READ-ONLY; The subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. 586 LocationPlacementID *string `json:"locationPlacementId,omitempty"` 587 // QuotaID - READ-ONLY; The subscription quota ID. 588 QuotaID *string `json:"quotaId,omitempty"` 589 // SpendingLimit - READ-ONLY; The subscription spending limit. Possible values include: 'On', 'Off', 'CurrentPeriodOff' 590 SpendingLimit SpendingLimit `json:"spendingLimit,omitempty"` 591} 592 593// MarshalJSON is the custom marshaler for Policies. 594func (p Policies) MarshalJSON() ([]byte, error) { 595 objectMap := make(map[string]interface{}) 596 return json.Marshal(objectMap) 597} 598 599// PutAliasListResult the list of aliases. 600type PutAliasListResult struct { 601 autorest.Response `json:"-"` 602 // Value - READ-ONLY; The list of alias. 603 Value *[]PutAliasResponse `json:"value,omitempty"` 604 // NextLink - READ-ONLY; The link (url) to the next page of results. 605 NextLink *string `json:"nextLink,omitempty"` 606} 607 608// MarshalJSON is the custom marshaler for PutAliasListResult. 609func (palr PutAliasListResult) MarshalJSON() ([]byte, error) { 610 objectMap := make(map[string]interface{}) 611 return json.Marshal(objectMap) 612} 613 614// PutAliasRequest the parameters required to create a new subscription. 615type PutAliasRequest struct { 616 // Properties - Put alias request properties. 617 Properties *PutAliasRequestProperties `json:"properties,omitempty"` 618} 619 620// PutAliasRequestProperties put subscription properties. 621type PutAliasRequestProperties struct { 622 // DisplayName - The friendly name of the subscription. 623 DisplayName *string `json:"displayName,omitempty"` 624 // Workload - The workload type of the subscription. It can be either Production or DevTest. Possible values include: 'Production', 'DevTest' 625 Workload Workload `json:"workload,omitempty"` 626 // BillingScope - Determines whether subscription is fieldLed, partnerLed or LegacyEA 627 BillingScope *string `json:"billingScope,omitempty"` 628 // SubscriptionID - This parameter can be used to create alias for existing subscription Id 629 SubscriptionID *string `json:"subscriptionId,omitempty"` 630} 631 632// PutAliasResponse subscription Information with the alias. 633type PutAliasResponse struct { 634 autorest.Response `json:"-"` 635 // ID - READ-ONLY; Fully qualified ID for the alias resource. 636 ID *string `json:"id,omitempty"` 637 // Name - READ-ONLY; Alias ID. 638 Name *string `json:"name,omitempty"` 639 // Type - READ-ONLY; Resource type, Microsoft.Subscription/aliases. 640 Type *string `json:"type,omitempty"` 641 // Properties - Put Alias response properties. 642 Properties *PutAliasResponseProperties `json:"properties,omitempty"` 643} 644 645// MarshalJSON is the custom marshaler for PutAliasResponse. 646func (par PutAliasResponse) MarshalJSON() ([]byte, error) { 647 objectMap := make(map[string]interface{}) 648 if par.Properties != nil { 649 objectMap["properties"] = par.Properties 650 } 651 return json.Marshal(objectMap) 652} 653 654// PutAliasResponseProperties put subscription creation result properties. 655type PutAliasResponseProperties struct { 656 // SubscriptionID - READ-ONLY; Newly created subscription Id. 657 SubscriptionID *string `json:"subscriptionId,omitempty"` 658 // ProvisioningState - The provisioning state of the resource. Possible values include: 'Accepted', 'Succeeded', 'Failed' 659 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 660} 661 662// MarshalJSON is the custom marshaler for PutAliasResponseProperties. 663func (parp PutAliasResponseProperties) MarshalJSON() ([]byte, error) { 664 objectMap := make(map[string]interface{}) 665 if parp.ProvisioningState != "" { 666 objectMap["provisioningState"] = parp.ProvisioningState 667 } 668 return json.Marshal(objectMap) 669} 670 671// RenamedSubscriptionID the ID of the subscriptions that is being renamed 672type RenamedSubscriptionID struct { 673 autorest.Response `json:"-"` 674 // Value - READ-ONLY; The ID of the subscriptions that is being renamed 675 Value *string `json:"value,omitempty"` 676} 677 678// MarshalJSON is the custom marshaler for RenamedSubscriptionID. 679func (rsi RenamedSubscriptionID) MarshalJSON() ([]byte, error) { 680 objectMap := make(map[string]interface{}) 681 return json.Marshal(objectMap) 682} 683 684// TenantIDDescription tenant Id information. 685type TenantIDDescription struct { 686 // ID - READ-ONLY; The fully qualified ID of the tenant. For example, /tenants/00000000-0000-0000-0000-000000000000. 687 ID *string `json:"id,omitempty"` 688 // TenantID - READ-ONLY; The tenant ID. For example, 00000000-0000-0000-0000-000000000000. 689 TenantID *string `json:"tenantId,omitempty"` 690} 691 692// MarshalJSON is the custom marshaler for TenantIDDescription. 693func (tid TenantIDDescription) MarshalJSON() ([]byte, error) { 694 objectMap := make(map[string]interface{}) 695 return json.Marshal(objectMap) 696} 697 698// TenantListResult tenant Ids information. 699type TenantListResult struct { 700 autorest.Response `json:"-"` 701 // Value - An array of tenants. 702 Value *[]TenantIDDescription `json:"value,omitempty"` 703 // NextLink - The URL to use for getting the next set of results. 704 NextLink *string `json:"nextLink,omitempty"` 705} 706 707// TenantListResultIterator provides access to a complete listing of TenantIDDescription values. 708type TenantListResultIterator struct { 709 i int 710 page TenantListResultPage 711} 712 713// NextWithContext advances to the next value. If there was an error making 714// the request the iterator does not advance and the error is returned. 715func (iter *TenantListResultIterator) NextWithContext(ctx context.Context) (err error) { 716 if tracing.IsEnabled() { 717 ctx = tracing.StartSpan(ctx, fqdn+"/TenantListResultIterator.NextWithContext") 718 defer func() { 719 sc := -1 720 if iter.Response().Response.Response != nil { 721 sc = iter.Response().Response.Response.StatusCode 722 } 723 tracing.EndSpan(ctx, sc, err) 724 }() 725 } 726 iter.i++ 727 if iter.i < len(iter.page.Values()) { 728 return nil 729 } 730 err = iter.page.NextWithContext(ctx) 731 if err != nil { 732 iter.i-- 733 return err 734 } 735 iter.i = 0 736 return nil 737} 738 739// Next advances to the next value. If there was an error making 740// the request the iterator does not advance and the error is returned. 741// Deprecated: Use NextWithContext() instead. 742func (iter *TenantListResultIterator) Next() error { 743 return iter.NextWithContext(context.Background()) 744} 745 746// NotDone returns true if the enumeration should be started or is not yet complete. 747func (iter TenantListResultIterator) NotDone() bool { 748 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 749} 750 751// Response returns the raw server response from the last page request. 752func (iter TenantListResultIterator) Response() TenantListResult { 753 return iter.page.Response() 754} 755 756// Value returns the current value or a zero-initialized value if the 757// iterator has advanced beyond the end of the collection. 758func (iter TenantListResultIterator) Value() TenantIDDescription { 759 if !iter.page.NotDone() { 760 return TenantIDDescription{} 761 } 762 return iter.page.Values()[iter.i] 763} 764 765// Creates a new instance of the TenantListResultIterator type. 766func NewTenantListResultIterator(page TenantListResultPage) TenantListResultIterator { 767 return TenantListResultIterator{page: page} 768} 769 770// IsEmpty returns true if the ListResult contains no values. 771func (tlr TenantListResult) IsEmpty() bool { 772 return tlr.Value == nil || len(*tlr.Value) == 0 773} 774 775// hasNextLink returns true if the NextLink is not empty. 776func (tlr TenantListResult) hasNextLink() bool { 777 return tlr.NextLink != nil && len(*tlr.NextLink) != 0 778} 779 780// tenantListResultPreparer prepares a request to retrieve the next set of results. 781// It returns nil if no more results exist. 782func (tlr TenantListResult) tenantListResultPreparer(ctx context.Context) (*http.Request, error) { 783 if !tlr.hasNextLink() { 784 return nil, nil 785 } 786 return autorest.Prepare((&http.Request{}).WithContext(ctx), 787 autorest.AsJSON(), 788 autorest.AsGet(), 789 autorest.WithBaseURL(to.String(tlr.NextLink))) 790} 791 792// TenantListResultPage contains a page of TenantIDDescription values. 793type TenantListResultPage struct { 794 fn func(context.Context, TenantListResult) (TenantListResult, error) 795 tlr TenantListResult 796} 797 798// NextWithContext advances to the next page of values. If there was an error making 799// the request the page does not advance and the error is returned. 800func (page *TenantListResultPage) NextWithContext(ctx context.Context) (err error) { 801 if tracing.IsEnabled() { 802 ctx = tracing.StartSpan(ctx, fqdn+"/TenantListResultPage.NextWithContext") 803 defer func() { 804 sc := -1 805 if page.Response().Response.Response != nil { 806 sc = page.Response().Response.Response.StatusCode 807 } 808 tracing.EndSpan(ctx, sc, err) 809 }() 810 } 811 for { 812 next, err := page.fn(ctx, page.tlr) 813 if err != nil { 814 return err 815 } 816 page.tlr = next 817 if !next.hasNextLink() || !next.IsEmpty() { 818 break 819 } 820 } 821 return nil 822} 823 824// Next advances to the next page of values. If there was an error making 825// the request the page does not advance and the error is returned. 826// Deprecated: Use NextWithContext() instead. 827func (page *TenantListResultPage) Next() error { 828 return page.NextWithContext(context.Background()) 829} 830 831// NotDone returns true if the page enumeration should be started or is not yet complete. 832func (page TenantListResultPage) NotDone() bool { 833 return !page.tlr.IsEmpty() 834} 835 836// Response returns the raw server response from the last page request. 837func (page TenantListResultPage) Response() TenantListResult { 838 return page.tlr 839} 840 841// Values returns the slice of values for the current page or nil if there are no values. 842func (page TenantListResultPage) Values() []TenantIDDescription { 843 if page.tlr.IsEmpty() { 844 return nil 845 } 846 return *page.tlr.Value 847} 848 849// Creates a new instance of the TenantListResultPage type. 850func NewTenantListResultPage(cur TenantListResult, getNextPage func(context.Context, TenantListResult) (TenantListResult, error)) TenantListResultPage { 851 return TenantListResultPage{ 852 fn: getNextPage, 853 tlr: cur, 854 } 855} 856