1package billing 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/date" 15 "github.com/Azure/go-autorest/autorest/to" 16 "github.com/Azure/go-autorest/tracing" 17 "github.com/gofrs/uuid" 18 "net/http" 19) 20 21// The package's fully qualified name. 22const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/billing/mgmt/2018-11-01-preview/billing" 23 24// AcceptTransferProperties request parameters to accept transfer. 25type AcceptTransferProperties struct { 26 // ProductDetails - Request parameters to accept transfer. 27 ProductDetails *[]ProductDetails `json:"productDetails,omitempty"` 28} 29 30// AcceptTransferRequest request parameters to accept transfer. 31type AcceptTransferRequest struct { 32 // AcceptTransferProperties - Request parameters to accept transfer. 33 *AcceptTransferProperties `json:"properties,omitempty"` 34} 35 36// MarshalJSON is the custom marshaler for AcceptTransferRequest. 37func (atr AcceptTransferRequest) MarshalJSON() ([]byte, error) { 38 objectMap := make(map[string]interface{}) 39 if atr.AcceptTransferProperties != nil { 40 objectMap["properties"] = atr.AcceptTransferProperties 41 } 42 return json.Marshal(objectMap) 43} 44 45// UnmarshalJSON is the custom unmarshaler for AcceptTransferRequest struct. 46func (atr *AcceptTransferRequest) UnmarshalJSON(body []byte) error { 47 var m map[string]*json.RawMessage 48 err := json.Unmarshal(body, &m) 49 if err != nil { 50 return err 51 } 52 for k, v := range m { 53 switch k { 54 case "properties": 55 if v != nil { 56 var acceptTransferProperties AcceptTransferProperties 57 err = json.Unmarshal(*v, &acceptTransferProperties) 58 if err != nil { 59 return err 60 } 61 atr.AcceptTransferProperties = &acceptTransferProperties 62 } 63 } 64 } 65 66 return nil 67} 68 69// Account a billing account resource. 70type Account struct { 71 autorest.Response `json:"-"` 72 // AccountProperties - A billing account. 73 *AccountProperties `json:"properties,omitempty"` 74 // ID - READ-ONLY; Resource Id. 75 ID *string `json:"id,omitempty"` 76 // Name - READ-ONLY; Resource name. 77 Name *string `json:"name,omitempty"` 78 // Type - READ-ONLY; Resource type. 79 Type *string `json:"type,omitempty"` 80} 81 82// MarshalJSON is the custom marshaler for Account. 83func (a Account) MarshalJSON() ([]byte, error) { 84 objectMap := make(map[string]interface{}) 85 if a.AccountProperties != nil { 86 objectMap["properties"] = a.AccountProperties 87 } 88 return json.Marshal(objectMap) 89} 90 91// UnmarshalJSON is the custom unmarshaler for Account struct. 92func (a *Account) UnmarshalJSON(body []byte) error { 93 var m map[string]*json.RawMessage 94 err := json.Unmarshal(body, &m) 95 if err != nil { 96 return err 97 } 98 for k, v := range m { 99 switch k { 100 case "properties": 101 if v != nil { 102 var accountProperties AccountProperties 103 err = json.Unmarshal(*v, &accountProperties) 104 if err != nil { 105 return err 106 } 107 a.AccountProperties = &accountProperties 108 } 109 case "id": 110 if v != nil { 111 var ID string 112 err = json.Unmarshal(*v, &ID) 113 if err != nil { 114 return err 115 } 116 a.ID = &ID 117 } 118 case "name": 119 if v != nil { 120 var name string 121 err = json.Unmarshal(*v, &name) 122 if err != nil { 123 return err 124 } 125 a.Name = &name 126 } 127 case "type": 128 if v != nil { 129 var typeVar string 130 err = json.Unmarshal(*v, &typeVar) 131 if err != nil { 132 return err 133 } 134 a.Type = &typeVar 135 } 136 } 137 } 138 139 return nil 140} 141 142// AccountListResult result of listing billing accounts. 143type AccountListResult struct { 144 autorest.Response `json:"-"` 145 // Value - READ-ONLY; The list of billing accounts. 146 Value *[]Account `json:"value,omitempty"` 147 // NextLink - READ-ONLY; The link (url) to the next page of results. 148 NextLink *string `json:"nextLink,omitempty"` 149} 150 151// MarshalJSON is the custom marshaler for AccountListResult. 152func (alr AccountListResult) MarshalJSON() ([]byte, error) { 153 objectMap := make(map[string]interface{}) 154 return json.Marshal(objectMap) 155} 156 157// AccountListResultIterator provides access to a complete listing of Account values. 158type AccountListResultIterator struct { 159 i int 160 page AccountListResultPage 161} 162 163// NextWithContext advances to the next value. If there was an error making 164// the request the iterator does not advance and the error is returned. 165func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) { 166 if tracing.IsEnabled() { 167 ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext") 168 defer func() { 169 sc := -1 170 if iter.Response().Response.Response != nil { 171 sc = iter.Response().Response.Response.StatusCode 172 } 173 tracing.EndSpan(ctx, sc, err) 174 }() 175 } 176 iter.i++ 177 if iter.i < len(iter.page.Values()) { 178 return nil 179 } 180 err = iter.page.NextWithContext(ctx) 181 if err != nil { 182 iter.i-- 183 return err 184 } 185 iter.i = 0 186 return nil 187} 188 189// Next advances to the next value. If there was an error making 190// the request the iterator does not advance and the error is returned. 191// Deprecated: Use NextWithContext() instead. 192func (iter *AccountListResultIterator) Next() error { 193 return iter.NextWithContext(context.Background()) 194} 195 196// NotDone returns true if the enumeration should be started or is not yet complete. 197func (iter AccountListResultIterator) NotDone() bool { 198 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 199} 200 201// Response returns the raw server response from the last page request. 202func (iter AccountListResultIterator) Response() AccountListResult { 203 return iter.page.Response() 204} 205 206// Value returns the current value or a zero-initialized value if the 207// iterator has advanced beyond the end of the collection. 208func (iter AccountListResultIterator) Value() Account { 209 if !iter.page.NotDone() { 210 return Account{} 211 } 212 return iter.page.Values()[iter.i] 213} 214 215// Creates a new instance of the AccountListResultIterator type. 216func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator { 217 return AccountListResultIterator{page: page} 218} 219 220// IsEmpty returns true if the ListResult contains no values. 221func (alr AccountListResult) IsEmpty() bool { 222 return alr.Value == nil || len(*alr.Value) == 0 223} 224 225// hasNextLink returns true if the NextLink is not empty. 226func (alr AccountListResult) hasNextLink() bool { 227 return alr.NextLink != nil && len(*alr.NextLink) != 0 228} 229 230// accountListResultPreparer prepares a request to retrieve the next set of results. 231// It returns nil if no more results exist. 232func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) { 233 if !alr.hasNextLink() { 234 return nil, nil 235 } 236 return autorest.Prepare((&http.Request{}).WithContext(ctx), 237 autorest.AsJSON(), 238 autorest.AsGet(), 239 autorest.WithBaseURL(to.String(alr.NextLink))) 240} 241 242// AccountListResultPage contains a page of Account values. 243type AccountListResultPage struct { 244 fn func(context.Context, AccountListResult) (AccountListResult, error) 245 alr AccountListResult 246} 247 248// NextWithContext advances to the next page of values. If there was an error making 249// the request the page does not advance and the error is returned. 250func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) { 251 if tracing.IsEnabled() { 252 ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext") 253 defer func() { 254 sc := -1 255 if page.Response().Response.Response != nil { 256 sc = page.Response().Response.Response.StatusCode 257 } 258 tracing.EndSpan(ctx, sc, err) 259 }() 260 } 261 for { 262 next, err := page.fn(ctx, page.alr) 263 if err != nil { 264 return err 265 } 266 page.alr = next 267 if !next.hasNextLink() || !next.IsEmpty() { 268 break 269 } 270 } 271 return nil 272} 273 274// Next advances to the next page of values. If there was an error making 275// the request the page does not advance and the error is returned. 276// Deprecated: Use NextWithContext() instead. 277func (page *AccountListResultPage) Next() error { 278 return page.NextWithContext(context.Background()) 279} 280 281// NotDone returns true if the page enumeration should be started or is not yet complete. 282func (page AccountListResultPage) NotDone() bool { 283 return !page.alr.IsEmpty() 284} 285 286// Response returns the raw server response from the last page request. 287func (page AccountListResultPage) Response() AccountListResult { 288 return page.alr 289} 290 291// Values returns the slice of values for the current page or nil if there are no values. 292func (page AccountListResultPage) Values() []Account { 293 if page.alr.IsEmpty() { 294 return nil 295 } 296 return *page.alr.Value 297} 298 299// Creates a new instance of the AccountListResultPage type. 300func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage { 301 return AccountListResultPage{ 302 fn: getNextPage, 303 alr: cur, 304 } 305} 306 307// AccountProperties the properties of the billing account. 308type AccountProperties struct { 309 // DisplayName - READ-ONLY; The billing account name. 310 DisplayName *string `json:"displayName,omitempty"` 311 // AccountType - READ-ONLY; The billing account Type. Possible values include: 'AccountTypeOrganization', 'AccountTypeEnrollment' 312 AccountType AccountType `json:"accountType,omitempty"` 313 // Address - The address associated with billing account. 314 Address *Address `json:"address,omitempty"` 315 // Company - READ-ONLY; Company Name. 316 Company *string `json:"company,omitempty"` 317 // Country - READ-ONLY; Country Name. 318 Country *string `json:"country,omitempty"` 319 // InvoiceSections - The invoice sections associated to the billing account. By default this is not populated, unless it's specified in $expand. 320 InvoiceSections *[]InvoiceSection `json:"invoiceSections,omitempty"` 321 // BillingProfiles - The billing profiles associated to the billing account. By default this is not populated, unless it's specified in $expand. 322 BillingProfiles *[]Profile `json:"billingProfiles,omitempty"` 323 // EnrollmentDetails - READ-ONLY; The details about the associated legacy enrollment. By default this is not populated, unless it's specified in $expand. 324 EnrollmentDetails *Enrollment `json:"enrollmentDetails,omitempty"` 325 // Departments - The departments associated to the enrollment. 326 Departments *[]Department `json:"departments,omitempty"` 327 // EnrollmentAccounts - The accounts associated to the enrollment. 328 EnrollmentAccounts *[]EnrollmentAccount `json:"enrollmentAccounts,omitempty"` 329 // HasReadAccess - READ-ONLY; Specifies whether the user has read access on billing account. 330 HasReadAccess *bool `json:"hasReadAccess,omitempty"` 331} 332 333// MarshalJSON is the custom marshaler for AccountProperties. 334func (ap AccountProperties) MarshalJSON() ([]byte, error) { 335 objectMap := make(map[string]interface{}) 336 if ap.Address != nil { 337 objectMap["address"] = ap.Address 338 } 339 if ap.InvoiceSections != nil { 340 objectMap["invoiceSections"] = ap.InvoiceSections 341 } 342 if ap.BillingProfiles != nil { 343 objectMap["billingProfiles"] = ap.BillingProfiles 344 } 345 if ap.Departments != nil { 346 objectMap["departments"] = ap.Departments 347 } 348 if ap.EnrollmentAccounts != nil { 349 objectMap["enrollmentAccounts"] = ap.EnrollmentAccounts 350 } 351 return json.Marshal(objectMap) 352} 353 354// AccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 355// operation. 356type AccountsUpdateFuture struct { 357 azure.FutureAPI 358 // Result returns the result of the asynchronous operation. 359 // If the operation has not completed it will return an error. 360 Result func(AccountsClient) (Account, error) 361} 362 363// UnmarshalJSON is the custom unmarshaller for CreateFuture. 364func (future *AccountsUpdateFuture) UnmarshalJSON(body []byte) error { 365 var azFuture azure.Future 366 if err := json.Unmarshal(body, &azFuture); err != nil { 367 return err 368 } 369 future.FutureAPI = &azFuture 370 future.Result = future.result 371 return nil 372} 373 374// result is the default implementation for AccountsUpdateFuture.Result. 375func (future *AccountsUpdateFuture) result(client AccountsClient) (a Account, err error) { 376 var done bool 377 done, err = future.DoneWithContext(context.Background(), client) 378 if err != nil { 379 err = autorest.NewErrorWithError(err, "billing.AccountsUpdateFuture", "Result", future.Response(), "Polling failure") 380 return 381 } 382 if !done { 383 a.Response.Response = future.Response() 384 err = azure.NewAsyncOpIncompleteError("billing.AccountsUpdateFuture") 385 return 386 } 387 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 388 if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { 389 a, err = client.UpdateResponder(a.Response.Response) 390 if err != nil { 391 err = autorest.NewErrorWithError(err, "billing.AccountsUpdateFuture", "Result", a.Response.Response, "Failure responding to request") 392 } 393 } 394 return 395} 396 397// AccountUpdateProperties the properties of the billing account that can be updated. 398type AccountUpdateProperties struct { 399 // AccountProperties - A billing property. 400 *AccountProperties `json:"properties,omitempty"` 401} 402 403// MarshalJSON is the custom marshaler for AccountUpdateProperties. 404func (aup AccountUpdateProperties) MarshalJSON() ([]byte, error) { 405 objectMap := make(map[string]interface{}) 406 if aup.AccountProperties != nil { 407 objectMap["properties"] = aup.AccountProperties 408 } 409 return json.Marshal(objectMap) 410} 411 412// UnmarshalJSON is the custom unmarshaler for AccountUpdateProperties struct. 413func (aup *AccountUpdateProperties) UnmarshalJSON(body []byte) error { 414 var m map[string]*json.RawMessage 415 err := json.Unmarshal(body, &m) 416 if err != nil { 417 return err 418 } 419 for k, v := range m { 420 switch k { 421 case "properties": 422 if v != nil { 423 var accountProperties AccountProperties 424 err = json.Unmarshal(*v, &accountProperties) 425 if err != nil { 426 return err 427 } 428 aup.AccountProperties = &accountProperties 429 } 430 } 431 } 432 433 return nil 434} 435 436// Address address details. 437type Address struct { 438 // FirstName - First Name. 439 FirstName *string `json:"firstName,omitempty"` 440 // LastName - Last Name. 441 LastName *string `json:"lastName,omitempty"` 442 // CompanyName - Company Name. 443 CompanyName *string `json:"companyName,omitempty"` 444 // AddressLine1 - Address Line1. 445 AddressLine1 *string `json:"addressLine1,omitempty"` 446 // AddressLine2 - Address Line2. 447 AddressLine2 *string `json:"addressLine2,omitempty"` 448 // AddressLine3 - Address Line3. 449 AddressLine3 *string `json:"addressLine3,omitempty"` 450 // City - Address City. 451 City *string `json:"city,omitempty"` 452 // Region - Address Region. 453 Region *string `json:"region,omitempty"` 454 // Country - Country code uses ISO2, 2-digit format. 455 Country *string `json:"country,omitempty"` 456 // PostalCode - Address Postal Code. 457 PostalCode *string `json:"postalCode,omitempty"` 458} 459 460// Agreement an agreement resource. 461type Agreement struct { 462 autorest.Response `json:"-"` 463 // AgreementProperties - An agreement. 464 *AgreementProperties `json:"properties,omitempty"` 465 // ID - READ-ONLY; Resource Id. 466 ID *string `json:"id,omitempty"` 467 // Name - READ-ONLY; Resource name. 468 Name *string `json:"name,omitempty"` 469 // Type - READ-ONLY; Resource type. 470 Type *string `json:"type,omitempty"` 471} 472 473// MarshalJSON is the custom marshaler for Agreement. 474func (a Agreement) MarshalJSON() ([]byte, error) { 475 objectMap := make(map[string]interface{}) 476 if a.AgreementProperties != nil { 477 objectMap["properties"] = a.AgreementProperties 478 } 479 return json.Marshal(objectMap) 480} 481 482// UnmarshalJSON is the custom unmarshaler for Agreement struct. 483func (a *Agreement) UnmarshalJSON(body []byte) error { 484 var m map[string]*json.RawMessage 485 err := json.Unmarshal(body, &m) 486 if err != nil { 487 return err 488 } 489 for k, v := range m { 490 switch k { 491 case "properties": 492 if v != nil { 493 var agreementProperties AgreementProperties 494 err = json.Unmarshal(*v, &agreementProperties) 495 if err != nil { 496 return err 497 } 498 a.AgreementProperties = &agreementProperties 499 } 500 case "id": 501 if v != nil { 502 var ID string 503 err = json.Unmarshal(*v, &ID) 504 if err != nil { 505 return err 506 } 507 a.ID = &ID 508 } 509 case "name": 510 if v != nil { 511 var name string 512 err = json.Unmarshal(*v, &name) 513 if err != nil { 514 return err 515 } 516 a.Name = &name 517 } 518 case "type": 519 if v != nil { 520 var typeVar string 521 err = json.Unmarshal(*v, &typeVar) 522 if err != nil { 523 return err 524 } 525 a.Type = &typeVar 526 } 527 } 528 } 529 530 return nil 531} 532 533// AgreementListResult result of listing agreements. 534type AgreementListResult struct { 535 autorest.Response `json:"-"` 536 // Value - READ-ONLY; The list of agreements. 537 Value *[]Agreement `json:"value,omitempty"` 538 // NextLink - READ-ONLY; The link (url) to the next page of results. 539 NextLink *string `json:"nextLink,omitempty"` 540} 541 542// MarshalJSON is the custom marshaler for AgreementListResult. 543func (alr AgreementListResult) MarshalJSON() ([]byte, error) { 544 objectMap := make(map[string]interface{}) 545 return json.Marshal(objectMap) 546} 547 548// AgreementListResultIterator provides access to a complete listing of Agreement values. 549type AgreementListResultIterator struct { 550 i int 551 page AgreementListResultPage 552} 553 554// NextWithContext advances to the next value. If there was an error making 555// the request the iterator does not advance and the error is returned. 556func (iter *AgreementListResultIterator) NextWithContext(ctx context.Context) (err error) { 557 if tracing.IsEnabled() { 558 ctx = tracing.StartSpan(ctx, fqdn+"/AgreementListResultIterator.NextWithContext") 559 defer func() { 560 sc := -1 561 if iter.Response().Response.Response != nil { 562 sc = iter.Response().Response.Response.StatusCode 563 } 564 tracing.EndSpan(ctx, sc, err) 565 }() 566 } 567 iter.i++ 568 if iter.i < len(iter.page.Values()) { 569 return nil 570 } 571 err = iter.page.NextWithContext(ctx) 572 if err != nil { 573 iter.i-- 574 return err 575 } 576 iter.i = 0 577 return nil 578} 579 580// Next advances to the next value. If there was an error making 581// the request the iterator does not advance and the error is returned. 582// Deprecated: Use NextWithContext() instead. 583func (iter *AgreementListResultIterator) Next() error { 584 return iter.NextWithContext(context.Background()) 585} 586 587// NotDone returns true if the enumeration should be started or is not yet complete. 588func (iter AgreementListResultIterator) NotDone() bool { 589 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 590} 591 592// Response returns the raw server response from the last page request. 593func (iter AgreementListResultIterator) Response() AgreementListResult { 594 return iter.page.Response() 595} 596 597// Value returns the current value or a zero-initialized value if the 598// iterator has advanced beyond the end of the collection. 599func (iter AgreementListResultIterator) Value() Agreement { 600 if !iter.page.NotDone() { 601 return Agreement{} 602 } 603 return iter.page.Values()[iter.i] 604} 605 606// Creates a new instance of the AgreementListResultIterator type. 607func NewAgreementListResultIterator(page AgreementListResultPage) AgreementListResultIterator { 608 return AgreementListResultIterator{page: page} 609} 610 611// IsEmpty returns true if the ListResult contains no values. 612func (alr AgreementListResult) IsEmpty() bool { 613 return alr.Value == nil || len(*alr.Value) == 0 614} 615 616// hasNextLink returns true if the NextLink is not empty. 617func (alr AgreementListResult) hasNextLink() bool { 618 return alr.NextLink != nil && len(*alr.NextLink) != 0 619} 620 621// agreementListResultPreparer prepares a request to retrieve the next set of results. 622// It returns nil if no more results exist. 623func (alr AgreementListResult) agreementListResultPreparer(ctx context.Context) (*http.Request, error) { 624 if !alr.hasNextLink() { 625 return nil, nil 626 } 627 return autorest.Prepare((&http.Request{}).WithContext(ctx), 628 autorest.AsJSON(), 629 autorest.AsGet(), 630 autorest.WithBaseURL(to.String(alr.NextLink))) 631} 632 633// AgreementListResultPage contains a page of Agreement values. 634type AgreementListResultPage struct { 635 fn func(context.Context, AgreementListResult) (AgreementListResult, error) 636 alr AgreementListResult 637} 638 639// NextWithContext advances to the next page of values. If there was an error making 640// the request the page does not advance and the error is returned. 641func (page *AgreementListResultPage) NextWithContext(ctx context.Context) (err error) { 642 if tracing.IsEnabled() { 643 ctx = tracing.StartSpan(ctx, fqdn+"/AgreementListResultPage.NextWithContext") 644 defer func() { 645 sc := -1 646 if page.Response().Response.Response != nil { 647 sc = page.Response().Response.Response.StatusCode 648 } 649 tracing.EndSpan(ctx, sc, err) 650 }() 651 } 652 for { 653 next, err := page.fn(ctx, page.alr) 654 if err != nil { 655 return err 656 } 657 page.alr = next 658 if !next.hasNextLink() || !next.IsEmpty() { 659 break 660 } 661 } 662 return nil 663} 664 665// Next advances to the next page of values. If there was an error making 666// the request the page does not advance and the error is returned. 667// Deprecated: Use NextWithContext() instead. 668func (page *AgreementListResultPage) Next() error { 669 return page.NextWithContext(context.Background()) 670} 671 672// NotDone returns true if the page enumeration should be started or is not yet complete. 673func (page AgreementListResultPage) NotDone() bool { 674 return !page.alr.IsEmpty() 675} 676 677// Response returns the raw server response from the last page request. 678func (page AgreementListResultPage) Response() AgreementListResult { 679 return page.alr 680} 681 682// Values returns the slice of values for the current page or nil if there are no values. 683func (page AgreementListResultPage) Values() []Agreement { 684 if page.alr.IsEmpty() { 685 return nil 686 } 687 return *page.alr.Value 688} 689 690// Creates a new instance of the AgreementListResultPage type. 691func NewAgreementListResultPage(cur AgreementListResult, getNextPage func(context.Context, AgreementListResult) (AgreementListResult, error)) AgreementListResultPage { 692 return AgreementListResultPage{ 693 fn: getNextPage, 694 alr: cur, 695 } 696} 697 698// AgreementProperties the properties of the agreement. 699type AgreementProperties struct { 700 // AgreementLink - READ-ONLY; The link to the agreement. 701 AgreementLink *string `json:"agreementLink,omitempty"` 702 // EffectiveDate - READ-ONLY; Effective date. 703 EffectiveDate *date.Time `json:"effectiveDate,omitempty"` 704 // ExpirationDate - READ-ONLY; Expiration date. 705 ExpirationDate *date.Time `json:"expirationDate,omitempty"` 706 // Participants - Participants or signer of the agreement. 707 Participants *[]Participants `json:"participants,omitempty"` 708 // Status - READ-ONLY; The agreement status 709 Status *string `json:"status,omitempty"` 710} 711 712// MarshalJSON is the custom marshaler for AgreementProperties. 713func (ap AgreementProperties) MarshalJSON() ([]byte, error) { 714 objectMap := make(map[string]interface{}) 715 if ap.Participants != nil { 716 objectMap["participants"] = ap.Participants 717 } 718 return json.Marshal(objectMap) 719} 720 721// Amount the Amount. 722type Amount struct { 723 // Currency - READ-ONLY; The currency for the amount value. 724 Currency *string `json:"currency,omitempty"` 725 // Value - Amount value. 726 Value *float64 `json:"value,omitempty"` 727} 728 729// MarshalJSON is the custom marshaler for Amount. 730func (a Amount) MarshalJSON() ([]byte, error) { 731 objectMap := make(map[string]interface{}) 732 if a.Value != nil { 733 objectMap["value"] = a.Value 734 } 735 return json.Marshal(objectMap) 736} 737 738// AvailableBalance latest available balance on Monetary Credit PI. 739type AvailableBalance struct { 740 autorest.Response `json:"-"` 741 *AvailableBalanceProperties `json:"properties,omitempty"` 742 // ID - READ-ONLY; Resource Id. 743 ID *string `json:"id,omitempty"` 744 // Name - READ-ONLY; Resource name. 745 Name *string `json:"name,omitempty"` 746 // Type - READ-ONLY; Resource type. 747 Type *string `json:"type,omitempty"` 748} 749 750// MarshalJSON is the custom marshaler for AvailableBalance. 751func (ab AvailableBalance) MarshalJSON() ([]byte, error) { 752 objectMap := make(map[string]interface{}) 753 if ab.AvailableBalanceProperties != nil { 754 objectMap["properties"] = ab.AvailableBalanceProperties 755 } 756 return json.Marshal(objectMap) 757} 758 759// UnmarshalJSON is the custom unmarshaler for AvailableBalance struct. 760func (ab *AvailableBalance) UnmarshalJSON(body []byte) error { 761 var m map[string]*json.RawMessage 762 err := json.Unmarshal(body, &m) 763 if err != nil { 764 return err 765 } 766 for k, v := range m { 767 switch k { 768 case "properties": 769 if v != nil { 770 var availableBalanceProperties AvailableBalanceProperties 771 err = json.Unmarshal(*v, &availableBalanceProperties) 772 if err != nil { 773 return err 774 } 775 ab.AvailableBalanceProperties = &availableBalanceProperties 776 } 777 case "id": 778 if v != nil { 779 var ID string 780 err = json.Unmarshal(*v, &ID) 781 if err != nil { 782 return err 783 } 784 ab.ID = &ID 785 } 786 case "name": 787 if v != nil { 788 var name string 789 err = json.Unmarshal(*v, &name) 790 if err != nil { 791 return err 792 } 793 ab.Name = &name 794 } 795 case "type": 796 if v != nil { 797 var typeVar string 798 err = json.Unmarshal(*v, &typeVar) 799 if err != nil { 800 return err 801 } 802 ab.Type = &typeVar 803 } 804 } 805 } 806 807 return nil 808} 809 810// AvailableBalanceProperties the properties of available balance. 811type AvailableBalanceProperties struct { 812 // Amount - READ-ONLY; Balance Amount. 813 Amount *Amount `json:"amount,omitempty"` 814} 815 816// MarshalJSON is the custom marshaler for AvailableBalanceProperties. 817func (abp AvailableBalanceProperties) MarshalJSON() ([]byte, error) { 818 objectMap := make(map[string]interface{}) 819 return json.Marshal(objectMap) 820} 821 822// Customer a partner's customer. 823type Customer struct { 824 autorest.Response `json:"-"` 825 // CustomerProperties - The customer. 826 *CustomerProperties `json:"properties,omitempty"` 827 // ID - READ-ONLY; Resource Id. 828 ID *string `json:"id,omitempty"` 829 // Name - READ-ONLY; Resource name. 830 Name *string `json:"name,omitempty"` 831 // Type - READ-ONLY; Resource type. 832 Type *string `json:"type,omitempty"` 833} 834 835// MarshalJSON is the custom marshaler for Customer. 836func (c Customer) MarshalJSON() ([]byte, error) { 837 objectMap := make(map[string]interface{}) 838 if c.CustomerProperties != nil { 839 objectMap["properties"] = c.CustomerProperties 840 } 841 return json.Marshal(objectMap) 842} 843 844// UnmarshalJSON is the custom unmarshaler for Customer struct. 845func (c *Customer) UnmarshalJSON(body []byte) error { 846 var m map[string]*json.RawMessage 847 err := json.Unmarshal(body, &m) 848 if err != nil { 849 return err 850 } 851 for k, v := range m { 852 switch k { 853 case "properties": 854 if v != nil { 855 var customerProperties CustomerProperties 856 err = json.Unmarshal(*v, &customerProperties) 857 if err != nil { 858 return err 859 } 860 c.CustomerProperties = &customerProperties 861 } 862 case "id": 863 if v != nil { 864 var ID string 865 err = json.Unmarshal(*v, &ID) 866 if err != nil { 867 return err 868 } 869 c.ID = &ID 870 } 871 case "name": 872 if v != nil { 873 var name string 874 err = json.Unmarshal(*v, &name) 875 if err != nil { 876 return err 877 } 878 c.Name = &name 879 } 880 case "type": 881 if v != nil { 882 var typeVar string 883 err = json.Unmarshal(*v, &typeVar) 884 if err != nil { 885 return err 886 } 887 c.Type = &typeVar 888 } 889 } 890 } 891 892 return nil 893} 894 895// CustomerListResult result of listing customers. 896type CustomerListResult struct { 897 autorest.Response `json:"-"` 898 // Value - READ-ONLY; The list of customers. 899 Value *[]Customer `json:"value,omitempty"` 900 // NextLink - READ-ONLY; The link (url) to the next page of results. 901 NextLink *string `json:"nextLink,omitempty"` 902} 903 904// MarshalJSON is the custom marshaler for CustomerListResult. 905func (clr CustomerListResult) MarshalJSON() ([]byte, error) { 906 objectMap := make(map[string]interface{}) 907 return json.Marshal(objectMap) 908} 909 910// CustomerListResultIterator provides access to a complete listing of Customer values. 911type CustomerListResultIterator struct { 912 i int 913 page CustomerListResultPage 914} 915 916// NextWithContext advances to the next value. If there was an error making 917// the request the iterator does not advance and the error is returned. 918func (iter *CustomerListResultIterator) NextWithContext(ctx context.Context) (err error) { 919 if tracing.IsEnabled() { 920 ctx = tracing.StartSpan(ctx, fqdn+"/CustomerListResultIterator.NextWithContext") 921 defer func() { 922 sc := -1 923 if iter.Response().Response.Response != nil { 924 sc = iter.Response().Response.Response.StatusCode 925 } 926 tracing.EndSpan(ctx, sc, err) 927 }() 928 } 929 iter.i++ 930 if iter.i < len(iter.page.Values()) { 931 return nil 932 } 933 err = iter.page.NextWithContext(ctx) 934 if err != nil { 935 iter.i-- 936 return err 937 } 938 iter.i = 0 939 return nil 940} 941 942// Next advances to the next value. If there was an error making 943// the request the iterator does not advance and the error is returned. 944// Deprecated: Use NextWithContext() instead. 945func (iter *CustomerListResultIterator) Next() error { 946 return iter.NextWithContext(context.Background()) 947} 948 949// NotDone returns true if the enumeration should be started or is not yet complete. 950func (iter CustomerListResultIterator) NotDone() bool { 951 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 952} 953 954// Response returns the raw server response from the last page request. 955func (iter CustomerListResultIterator) Response() CustomerListResult { 956 return iter.page.Response() 957} 958 959// Value returns the current value or a zero-initialized value if the 960// iterator has advanced beyond the end of the collection. 961func (iter CustomerListResultIterator) Value() Customer { 962 if !iter.page.NotDone() { 963 return Customer{} 964 } 965 return iter.page.Values()[iter.i] 966} 967 968// Creates a new instance of the CustomerListResultIterator type. 969func NewCustomerListResultIterator(page CustomerListResultPage) CustomerListResultIterator { 970 return CustomerListResultIterator{page: page} 971} 972 973// IsEmpty returns true if the ListResult contains no values. 974func (clr CustomerListResult) IsEmpty() bool { 975 return clr.Value == nil || len(*clr.Value) == 0 976} 977 978// hasNextLink returns true if the NextLink is not empty. 979func (clr CustomerListResult) hasNextLink() bool { 980 return clr.NextLink != nil && len(*clr.NextLink) != 0 981} 982 983// customerListResultPreparer prepares a request to retrieve the next set of results. 984// It returns nil if no more results exist. 985func (clr CustomerListResult) customerListResultPreparer(ctx context.Context) (*http.Request, error) { 986 if !clr.hasNextLink() { 987 return nil, nil 988 } 989 return autorest.Prepare((&http.Request{}).WithContext(ctx), 990 autorest.AsJSON(), 991 autorest.AsGet(), 992 autorest.WithBaseURL(to.String(clr.NextLink))) 993} 994 995// CustomerListResultPage contains a page of Customer values. 996type CustomerListResultPage struct { 997 fn func(context.Context, CustomerListResult) (CustomerListResult, error) 998 clr CustomerListResult 999} 1000 1001// NextWithContext advances to the next page of values. If there was an error making 1002// the request the page does not advance and the error is returned. 1003func (page *CustomerListResultPage) NextWithContext(ctx context.Context) (err error) { 1004 if tracing.IsEnabled() { 1005 ctx = tracing.StartSpan(ctx, fqdn+"/CustomerListResultPage.NextWithContext") 1006 defer func() { 1007 sc := -1 1008 if page.Response().Response.Response != nil { 1009 sc = page.Response().Response.Response.StatusCode 1010 } 1011 tracing.EndSpan(ctx, sc, err) 1012 }() 1013 } 1014 for { 1015 next, err := page.fn(ctx, page.clr) 1016 if err != nil { 1017 return err 1018 } 1019 page.clr = next 1020 if !next.hasNextLink() || !next.IsEmpty() { 1021 break 1022 } 1023 } 1024 return nil 1025} 1026 1027// Next advances to the next page of values. If there was an error making 1028// the request the page does not advance and the error is returned. 1029// Deprecated: Use NextWithContext() instead. 1030func (page *CustomerListResultPage) Next() error { 1031 return page.NextWithContext(context.Background()) 1032} 1033 1034// NotDone returns true if the page enumeration should be started or is not yet complete. 1035func (page CustomerListResultPage) NotDone() bool { 1036 return !page.clr.IsEmpty() 1037} 1038 1039// Response returns the raw server response from the last page request. 1040func (page CustomerListResultPage) Response() CustomerListResult { 1041 return page.clr 1042} 1043 1044// Values returns the slice of values for the current page or nil if there are no values. 1045func (page CustomerListResultPage) Values() []Customer { 1046 if page.clr.IsEmpty() { 1047 return nil 1048 } 1049 return *page.clr.Value 1050} 1051 1052// Creates a new instance of the CustomerListResultPage type. 1053func NewCustomerListResultPage(cur CustomerListResult, getNextPage func(context.Context, CustomerListResult) (CustomerListResult, error)) CustomerListResultPage { 1054 return CustomerListResultPage{ 1055 fn: getNextPage, 1056 clr: cur, 1057 } 1058} 1059 1060// CustomerProperties the properties of a customer. 1061type CustomerProperties struct { 1062 // DisplayName - The name of the customer. 1063 DisplayName *string `json:"displayName,omitempty"` 1064 // EnabledAzureSKUs - Information about the product. 1065 EnabledAzureSKUs *[]EnabledAzureSKUs `json:"enabledAzureSKUs,omitempty"` 1066 // Resellers - The resellers which are allowed to provide service to this customer. 1067 Resellers *[]Reseller `json:"resellers,omitempty"` 1068} 1069 1070// Department a department resource. 1071type Department struct { 1072 autorest.Response `json:"-"` 1073 // DepartmentProperties - A department. 1074 *DepartmentProperties `json:"properties,omitempty"` 1075 // ID - READ-ONLY; Resource Id. 1076 ID *string `json:"id,omitempty"` 1077 // Name - READ-ONLY; Resource name. 1078 Name *string `json:"name,omitempty"` 1079 // Type - READ-ONLY; Resource type. 1080 Type *string `json:"type,omitempty"` 1081} 1082 1083// MarshalJSON is the custom marshaler for Department. 1084func (d Department) MarshalJSON() ([]byte, error) { 1085 objectMap := make(map[string]interface{}) 1086 if d.DepartmentProperties != nil { 1087 objectMap["properties"] = d.DepartmentProperties 1088 } 1089 return json.Marshal(objectMap) 1090} 1091 1092// UnmarshalJSON is the custom unmarshaler for Department struct. 1093func (d *Department) UnmarshalJSON(body []byte) error { 1094 var m map[string]*json.RawMessage 1095 err := json.Unmarshal(body, &m) 1096 if err != nil { 1097 return err 1098 } 1099 for k, v := range m { 1100 switch k { 1101 case "properties": 1102 if v != nil { 1103 var departmentProperties DepartmentProperties 1104 err = json.Unmarshal(*v, &departmentProperties) 1105 if err != nil { 1106 return err 1107 } 1108 d.DepartmentProperties = &departmentProperties 1109 } 1110 case "id": 1111 if v != nil { 1112 var ID string 1113 err = json.Unmarshal(*v, &ID) 1114 if err != nil { 1115 return err 1116 } 1117 d.ID = &ID 1118 } 1119 case "name": 1120 if v != nil { 1121 var name string 1122 err = json.Unmarshal(*v, &name) 1123 if err != nil { 1124 return err 1125 } 1126 d.Name = &name 1127 } 1128 case "type": 1129 if v != nil { 1130 var typeVar string 1131 err = json.Unmarshal(*v, &typeVar) 1132 if err != nil { 1133 return err 1134 } 1135 d.Type = &typeVar 1136 } 1137 } 1138 } 1139 1140 return nil 1141} 1142 1143// DepartmentListResult result of listing departments. 1144type DepartmentListResult struct { 1145 autorest.Response `json:"-"` 1146 // Value - READ-ONLY; The list of departments. 1147 Value *[]Department `json:"value,omitempty"` 1148 // NextLink - READ-ONLY; The link (url) to the next page of results. 1149 NextLink *string `json:"nextLink,omitempty"` 1150} 1151 1152// MarshalJSON is the custom marshaler for DepartmentListResult. 1153func (dlr DepartmentListResult) MarshalJSON() ([]byte, error) { 1154 objectMap := make(map[string]interface{}) 1155 return json.Marshal(objectMap) 1156} 1157 1158// DepartmentListResultIterator provides access to a complete listing of Department values. 1159type DepartmentListResultIterator struct { 1160 i int 1161 page DepartmentListResultPage 1162} 1163 1164// NextWithContext advances to the next value. If there was an error making 1165// the request the iterator does not advance and the error is returned. 1166func (iter *DepartmentListResultIterator) NextWithContext(ctx context.Context) (err error) { 1167 if tracing.IsEnabled() { 1168 ctx = tracing.StartSpan(ctx, fqdn+"/DepartmentListResultIterator.NextWithContext") 1169 defer func() { 1170 sc := -1 1171 if iter.Response().Response.Response != nil { 1172 sc = iter.Response().Response.Response.StatusCode 1173 } 1174 tracing.EndSpan(ctx, sc, err) 1175 }() 1176 } 1177 iter.i++ 1178 if iter.i < len(iter.page.Values()) { 1179 return nil 1180 } 1181 err = iter.page.NextWithContext(ctx) 1182 if err != nil { 1183 iter.i-- 1184 return err 1185 } 1186 iter.i = 0 1187 return nil 1188} 1189 1190// Next advances to the next value. If there was an error making 1191// the request the iterator does not advance and the error is returned. 1192// Deprecated: Use NextWithContext() instead. 1193func (iter *DepartmentListResultIterator) Next() error { 1194 return iter.NextWithContext(context.Background()) 1195} 1196 1197// NotDone returns true if the enumeration should be started or is not yet complete. 1198func (iter DepartmentListResultIterator) NotDone() bool { 1199 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1200} 1201 1202// Response returns the raw server response from the last page request. 1203func (iter DepartmentListResultIterator) Response() DepartmentListResult { 1204 return iter.page.Response() 1205} 1206 1207// Value returns the current value or a zero-initialized value if the 1208// iterator has advanced beyond the end of the collection. 1209func (iter DepartmentListResultIterator) Value() Department { 1210 if !iter.page.NotDone() { 1211 return Department{} 1212 } 1213 return iter.page.Values()[iter.i] 1214} 1215 1216// Creates a new instance of the DepartmentListResultIterator type. 1217func NewDepartmentListResultIterator(page DepartmentListResultPage) DepartmentListResultIterator { 1218 return DepartmentListResultIterator{page: page} 1219} 1220 1221// IsEmpty returns true if the ListResult contains no values. 1222func (dlr DepartmentListResult) IsEmpty() bool { 1223 return dlr.Value == nil || len(*dlr.Value) == 0 1224} 1225 1226// hasNextLink returns true if the NextLink is not empty. 1227func (dlr DepartmentListResult) hasNextLink() bool { 1228 return dlr.NextLink != nil && len(*dlr.NextLink) != 0 1229} 1230 1231// departmentListResultPreparer prepares a request to retrieve the next set of results. 1232// It returns nil if no more results exist. 1233func (dlr DepartmentListResult) departmentListResultPreparer(ctx context.Context) (*http.Request, error) { 1234 if !dlr.hasNextLink() { 1235 return nil, nil 1236 } 1237 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1238 autorest.AsJSON(), 1239 autorest.AsGet(), 1240 autorest.WithBaseURL(to.String(dlr.NextLink))) 1241} 1242 1243// DepartmentListResultPage contains a page of Department values. 1244type DepartmentListResultPage struct { 1245 fn func(context.Context, DepartmentListResult) (DepartmentListResult, error) 1246 dlr DepartmentListResult 1247} 1248 1249// NextWithContext advances to the next page of values. If there was an error making 1250// the request the page does not advance and the error is returned. 1251func (page *DepartmentListResultPage) NextWithContext(ctx context.Context) (err error) { 1252 if tracing.IsEnabled() { 1253 ctx = tracing.StartSpan(ctx, fqdn+"/DepartmentListResultPage.NextWithContext") 1254 defer func() { 1255 sc := -1 1256 if page.Response().Response.Response != nil { 1257 sc = page.Response().Response.Response.StatusCode 1258 } 1259 tracing.EndSpan(ctx, sc, err) 1260 }() 1261 } 1262 for { 1263 next, err := page.fn(ctx, page.dlr) 1264 if err != nil { 1265 return err 1266 } 1267 page.dlr = next 1268 if !next.hasNextLink() || !next.IsEmpty() { 1269 break 1270 } 1271 } 1272 return nil 1273} 1274 1275// Next advances to the next page of values. If there was an error making 1276// the request the page does not advance and the error is returned. 1277// Deprecated: Use NextWithContext() instead. 1278func (page *DepartmentListResultPage) Next() error { 1279 return page.NextWithContext(context.Background()) 1280} 1281 1282// NotDone returns true if the page enumeration should be started or is not yet complete. 1283func (page DepartmentListResultPage) NotDone() bool { 1284 return !page.dlr.IsEmpty() 1285} 1286 1287// Response returns the raw server response from the last page request. 1288func (page DepartmentListResultPage) Response() DepartmentListResult { 1289 return page.dlr 1290} 1291 1292// Values returns the slice of values for the current page or nil if there are no values. 1293func (page DepartmentListResultPage) Values() []Department { 1294 if page.dlr.IsEmpty() { 1295 return nil 1296 } 1297 return *page.dlr.Value 1298} 1299 1300// Creates a new instance of the DepartmentListResultPage type. 1301func NewDepartmentListResultPage(cur DepartmentListResult, getNextPage func(context.Context, DepartmentListResult) (DepartmentListResult, error)) DepartmentListResultPage { 1302 return DepartmentListResultPage{ 1303 fn: getNextPage, 1304 dlr: cur, 1305 } 1306} 1307 1308// DepartmentProperties the properties of the department. 1309type DepartmentProperties struct { 1310 // DepartmentName - The name for department. 1311 DepartmentName *string `json:"departmentName,omitempty"` 1312 // CostCenter - The cost center name. 1313 CostCenter *string `json:"costCenter,omitempty"` 1314 // Status - The status for department. 1315 Status *string `json:"status,omitempty"` 1316 // EnrollmentAccounts - Associated enrollment accounts. By default this is not populated, unless it's specified in $expand. 1317 EnrollmentAccounts *[]EnrollmentAccount `json:"enrollmentAccounts,omitempty"` 1318} 1319 1320// DetailedTransferStatus detailed transfer status. 1321type DetailedTransferStatus struct { 1322 // ProductType - READ-ONLY; Type of product being transferred. Possible values include: 'ProductTypeAzureSubscription', 'ProductTypeAzureReservation' 1323 ProductType ProductType `json:"productType,omitempty"` 1324 // ProductID - READ-ONLY; Id of product being transferred. 1325 ProductID *string `json:"productId,omitempty"` 1326 // TransferStatus - READ-ONLY; Transfer status. Possible values include: 'NotStarted', 'InProgress', 'Completed', 'Failed' 1327 TransferStatus ProductTransferStatus `json:"transferStatus,omitempty"` 1328 // ErrorDetails - Error details for transfer execution. 1329 ErrorDetails *Error `json:"errorDetails,omitempty"` 1330} 1331 1332// MarshalJSON is the custom marshaler for DetailedTransferStatus. 1333func (dts DetailedTransferStatus) MarshalJSON() ([]byte, error) { 1334 objectMap := make(map[string]interface{}) 1335 if dts.ErrorDetails != nil { 1336 objectMap["errorDetails"] = dts.ErrorDetails 1337 } 1338 return json.Marshal(objectMap) 1339} 1340 1341// DownloadProperties the properties of the invoice download. 1342type DownloadProperties struct { 1343 // Kind - READ-ONLY; Document type. Possible values include: 'Invoice', 'VoidNote', 'Receipt', 'CreditNote' 1344 Kind Kind `json:"kind,omitempty"` 1345 // URL - READ-ONLY; Document URL. 1346 URL *string `json:"url,omitempty"` 1347} 1348 1349// MarshalJSON is the custom marshaler for DownloadProperties. 1350func (dp DownloadProperties) MarshalJSON() ([]byte, error) { 1351 objectMap := make(map[string]interface{}) 1352 return json.Marshal(objectMap) 1353} 1354 1355// DownloadURL a secure URL that can be used to download a an entity until the URL expires. 1356type DownloadURL struct { 1357 autorest.Response `json:"-"` 1358 // ExpiryTime - READ-ONLY; The time in UTC at which this download URL will expire. 1359 ExpiryTime *date.Time `json:"expiryTime,omitempty"` 1360 // URL - READ-ONLY; The URL to the PDF file. 1361 URL *string `json:"url,omitempty"` 1362} 1363 1364// MarshalJSON is the custom marshaler for DownloadURL. 1365func (du DownloadURL) MarshalJSON() ([]byte, error) { 1366 objectMap := make(map[string]interface{}) 1367 return json.Marshal(objectMap) 1368} 1369 1370// EnabledAzureSKUs details about the enabled azure sku. 1371type EnabledAzureSKUs struct { 1372 // SkuID - The sku id. 1373 SkuID *string `json:"skuId,omitempty"` 1374 // SkuDescription - READ-ONLY; The sku description. 1375 SkuDescription *string `json:"skuDescription,omitempty"` 1376} 1377 1378// MarshalJSON is the custom marshaler for EnabledAzureSKUs. 1379func (easu EnabledAzureSKUs) MarshalJSON() ([]byte, error) { 1380 objectMap := make(map[string]interface{}) 1381 if easu.SkuID != nil { 1382 objectMap["skuId"] = easu.SkuID 1383 } 1384 return json.Marshal(objectMap) 1385} 1386 1387// Enrollment current entity level details 1388type Enrollment struct { 1389 // StartDate - Enrollment Start Date 1390 StartDate *date.Time `json:"startDate,omitempty"` 1391 // EndDate - Enrollment End Date 1392 EndDate *date.Time `json:"endDate,omitempty"` 1393 // Currency - READ-ONLY; The currency associated with enrollment 1394 Currency *string `json:"currency,omitempty"` 1395 // Channel - READ-ONLY; The channel for Enrollment 1396 Channel *string `json:"channel,omitempty"` 1397 // Policies - READ-ONLY; The attributes associated with legacy enrollment. 1398 Policies *EnrollmentPolicies `json:"policies,omitempty"` 1399 // Language - READ-ONLY; The language for Enrollment 1400 Language *string `json:"language,omitempty"` 1401 // CountryCode - READ-ONLY; The countryCode for Enrollment 1402 CountryCode *string `json:"countryCode,omitempty"` 1403 // Status - READ-ONLY; Enrollment status 1404 Status *string `json:"status,omitempty"` 1405 // BillingCycle - READ-ONLY; Enrollment billing cycle 1406 BillingCycle *string `json:"billingCycle,omitempty"` 1407} 1408 1409// MarshalJSON is the custom marshaler for Enrollment. 1410func (e Enrollment) MarshalJSON() ([]byte, error) { 1411 objectMap := make(map[string]interface{}) 1412 if e.StartDate != nil { 1413 objectMap["startDate"] = e.StartDate 1414 } 1415 if e.EndDate != nil { 1416 objectMap["endDate"] = e.EndDate 1417 } 1418 return json.Marshal(objectMap) 1419} 1420 1421// EnrollmentAccount an account resource. 1422type EnrollmentAccount struct { 1423 autorest.Response `json:"-"` 1424 // EnrollmentAccountProperties - An account. 1425 *EnrollmentAccountProperties `json:"properties,omitempty"` 1426 // ID - READ-ONLY; Resource Id. 1427 ID *string `json:"id,omitempty"` 1428 // Name - READ-ONLY; Resource name. 1429 Name *string `json:"name,omitempty"` 1430 // Type - READ-ONLY; Resource type. 1431 Type *string `json:"type,omitempty"` 1432} 1433 1434// MarshalJSON is the custom marshaler for EnrollmentAccount. 1435func (ea EnrollmentAccount) MarshalJSON() ([]byte, error) { 1436 objectMap := make(map[string]interface{}) 1437 if ea.EnrollmentAccountProperties != nil { 1438 objectMap["properties"] = ea.EnrollmentAccountProperties 1439 } 1440 return json.Marshal(objectMap) 1441} 1442 1443// UnmarshalJSON is the custom unmarshaler for EnrollmentAccount struct. 1444func (ea *EnrollmentAccount) UnmarshalJSON(body []byte) error { 1445 var m map[string]*json.RawMessage 1446 err := json.Unmarshal(body, &m) 1447 if err != nil { 1448 return err 1449 } 1450 for k, v := range m { 1451 switch k { 1452 case "properties": 1453 if v != nil { 1454 var enrollmentAccountProperties EnrollmentAccountProperties 1455 err = json.Unmarshal(*v, &enrollmentAccountProperties) 1456 if err != nil { 1457 return err 1458 } 1459 ea.EnrollmentAccountProperties = &enrollmentAccountProperties 1460 } 1461 case "id": 1462 if v != nil { 1463 var ID string 1464 err = json.Unmarshal(*v, &ID) 1465 if err != nil { 1466 return err 1467 } 1468 ea.ID = &ID 1469 } 1470 case "name": 1471 if v != nil { 1472 var name string 1473 err = json.Unmarshal(*v, &name) 1474 if err != nil { 1475 return err 1476 } 1477 ea.Name = &name 1478 } 1479 case "type": 1480 if v != nil { 1481 var typeVar string 1482 err = json.Unmarshal(*v, &typeVar) 1483 if err != nil { 1484 return err 1485 } 1486 ea.Type = &typeVar 1487 } 1488 } 1489 } 1490 1491 return nil 1492} 1493 1494// EnrollmentAccountContext the rating context. 1495type EnrollmentAccountContext struct { 1496 // CostCenter - The cost center name. 1497 CostCenter *string `json:"costCenter,omitempty"` 1498 // StartDate - Account Start Date 1499 StartDate *date.Time `json:"startDate,omitempty"` 1500 // EndDate - Account End Date 1501 EndDate *date.Time `json:"endDate,omitempty"` 1502 // EnrollmentAccountName - The enrollment account id. 1503 EnrollmentAccountName *string `json:"enrollmentAccountName,omitempty"` 1504} 1505 1506// EnrollmentAccountListResult result of listing enrollment accounts. 1507type EnrollmentAccountListResult struct { 1508 autorest.Response `json:"-"` 1509 // Value - READ-ONLY; The list of enrollment accounts. 1510 Value *[]EnrollmentAccount `json:"value,omitempty"` 1511 // NextLink - READ-ONLY; The link (url) to the next page of results. 1512 NextLink *string `json:"nextLink,omitempty"` 1513} 1514 1515// MarshalJSON is the custom marshaler for EnrollmentAccountListResult. 1516func (ealr EnrollmentAccountListResult) MarshalJSON() ([]byte, error) { 1517 objectMap := make(map[string]interface{}) 1518 return json.Marshal(objectMap) 1519} 1520 1521// EnrollmentAccountListResultIterator provides access to a complete listing of EnrollmentAccount values. 1522type EnrollmentAccountListResultIterator struct { 1523 i int 1524 page EnrollmentAccountListResultPage 1525} 1526 1527// NextWithContext advances to the next value. If there was an error making 1528// the request the iterator does not advance and the error is returned. 1529func (iter *EnrollmentAccountListResultIterator) NextWithContext(ctx context.Context) (err error) { 1530 if tracing.IsEnabled() { 1531 ctx = tracing.StartSpan(ctx, fqdn+"/EnrollmentAccountListResultIterator.NextWithContext") 1532 defer func() { 1533 sc := -1 1534 if iter.Response().Response.Response != nil { 1535 sc = iter.Response().Response.Response.StatusCode 1536 } 1537 tracing.EndSpan(ctx, sc, err) 1538 }() 1539 } 1540 iter.i++ 1541 if iter.i < len(iter.page.Values()) { 1542 return nil 1543 } 1544 err = iter.page.NextWithContext(ctx) 1545 if err != nil { 1546 iter.i-- 1547 return err 1548 } 1549 iter.i = 0 1550 return nil 1551} 1552 1553// Next advances to the next value. If there was an error making 1554// the request the iterator does not advance and the error is returned. 1555// Deprecated: Use NextWithContext() instead. 1556func (iter *EnrollmentAccountListResultIterator) Next() error { 1557 return iter.NextWithContext(context.Background()) 1558} 1559 1560// NotDone returns true if the enumeration should be started or is not yet complete. 1561func (iter EnrollmentAccountListResultIterator) NotDone() bool { 1562 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1563} 1564 1565// Response returns the raw server response from the last page request. 1566func (iter EnrollmentAccountListResultIterator) Response() EnrollmentAccountListResult { 1567 return iter.page.Response() 1568} 1569 1570// Value returns the current value or a zero-initialized value if the 1571// iterator has advanced beyond the end of the collection. 1572func (iter EnrollmentAccountListResultIterator) Value() EnrollmentAccount { 1573 if !iter.page.NotDone() { 1574 return EnrollmentAccount{} 1575 } 1576 return iter.page.Values()[iter.i] 1577} 1578 1579// Creates a new instance of the EnrollmentAccountListResultIterator type. 1580func NewEnrollmentAccountListResultIterator(page EnrollmentAccountListResultPage) EnrollmentAccountListResultIterator { 1581 return EnrollmentAccountListResultIterator{page: page} 1582} 1583 1584// IsEmpty returns true if the ListResult contains no values. 1585func (ealr EnrollmentAccountListResult) IsEmpty() bool { 1586 return ealr.Value == nil || len(*ealr.Value) == 0 1587} 1588 1589// hasNextLink returns true if the NextLink is not empty. 1590func (ealr EnrollmentAccountListResult) hasNextLink() bool { 1591 return ealr.NextLink != nil && len(*ealr.NextLink) != 0 1592} 1593 1594// enrollmentAccountListResultPreparer prepares a request to retrieve the next set of results. 1595// It returns nil if no more results exist. 1596func (ealr EnrollmentAccountListResult) enrollmentAccountListResultPreparer(ctx context.Context) (*http.Request, error) { 1597 if !ealr.hasNextLink() { 1598 return nil, nil 1599 } 1600 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1601 autorest.AsJSON(), 1602 autorest.AsGet(), 1603 autorest.WithBaseURL(to.String(ealr.NextLink))) 1604} 1605 1606// EnrollmentAccountListResultPage contains a page of EnrollmentAccount values. 1607type EnrollmentAccountListResultPage struct { 1608 fn func(context.Context, EnrollmentAccountListResult) (EnrollmentAccountListResult, error) 1609 ealr EnrollmentAccountListResult 1610} 1611 1612// NextWithContext advances to the next page of values. If there was an error making 1613// the request the page does not advance and the error is returned. 1614func (page *EnrollmentAccountListResultPage) NextWithContext(ctx context.Context) (err error) { 1615 if tracing.IsEnabled() { 1616 ctx = tracing.StartSpan(ctx, fqdn+"/EnrollmentAccountListResultPage.NextWithContext") 1617 defer func() { 1618 sc := -1 1619 if page.Response().Response.Response != nil { 1620 sc = page.Response().Response.Response.StatusCode 1621 } 1622 tracing.EndSpan(ctx, sc, err) 1623 }() 1624 } 1625 for { 1626 next, err := page.fn(ctx, page.ealr) 1627 if err != nil { 1628 return err 1629 } 1630 page.ealr = next 1631 if !next.hasNextLink() || !next.IsEmpty() { 1632 break 1633 } 1634 } 1635 return nil 1636} 1637 1638// Next advances to the next page of values. If there was an error making 1639// the request the page does not advance and the error is returned. 1640// Deprecated: Use NextWithContext() instead. 1641func (page *EnrollmentAccountListResultPage) Next() error { 1642 return page.NextWithContext(context.Background()) 1643} 1644 1645// NotDone returns true if the page enumeration should be started or is not yet complete. 1646func (page EnrollmentAccountListResultPage) NotDone() bool { 1647 return !page.ealr.IsEmpty() 1648} 1649 1650// Response returns the raw server response from the last page request. 1651func (page EnrollmentAccountListResultPage) Response() EnrollmentAccountListResult { 1652 return page.ealr 1653} 1654 1655// Values returns the slice of values for the current page or nil if there are no values. 1656func (page EnrollmentAccountListResultPage) Values() []EnrollmentAccount { 1657 if page.ealr.IsEmpty() { 1658 return nil 1659 } 1660 return *page.ealr.Value 1661} 1662 1663// Creates a new instance of the EnrollmentAccountListResultPage type. 1664func NewEnrollmentAccountListResultPage(cur EnrollmentAccountListResult, getNextPage func(context.Context, EnrollmentAccountListResult) (EnrollmentAccountListResult, error)) EnrollmentAccountListResultPage { 1665 return EnrollmentAccountListResultPage{ 1666 fn: getNextPage, 1667 ealr: cur, 1668 } 1669} 1670 1671// EnrollmentAccountProperties the properties of the account. 1672type EnrollmentAccountProperties struct { 1673 // AccountName - The account name. 1674 AccountName *string `json:"accountName,omitempty"` 1675 // CostCenter - The cost center name. 1676 CostCenter *string `json:"costCenter,omitempty"` 1677 // AccountOwner - The account owner 1678 AccountOwner *string `json:"accountOwner,omitempty"` 1679 // Status - The status for account. 1680 Status *string `json:"status,omitempty"` 1681 // StartDate - Account Start Date 1682 StartDate *date.Time `json:"startDate,omitempty"` 1683 // EndDate - Account End Date 1684 EndDate *date.Time `json:"endDate,omitempty"` 1685 // Department - Associated department. By default this is not populated, unless it's specified in $expand. 1686 Department *Department `json:"department,omitempty"` 1687} 1688 1689// EnrollmentPolicies the attributes associated with legacy enrollment 1690type EnrollmentPolicies struct { 1691 // AccountOwnerViewCharges - READ-ONLY; The accountOwnerViewCharges flag for Enrollment 1692 AccountOwnerViewCharges *bool `json:"accountOwnerViewCharges,omitempty"` 1693 // DepartmentAdminViewCharges - READ-ONLY; The departmentAdminViewCharges flag for Enrollment 1694 DepartmentAdminViewCharges *bool `json:"departmentAdminViewCharges,omitempty"` 1695 // MarketplacesEnabled - READ-ONLY; The marketplaces flag for Enrollment 1696 MarketplacesEnabled *bool `json:"marketplacesEnabled,omitempty"` 1697 // ReservedInstancesEnabled - READ-ONLY; The reserved instances flag for Enrollment 1698 ReservedInstancesEnabled *bool `json:"reservedInstancesEnabled,omitempty"` 1699} 1700 1701// MarshalJSON is the custom marshaler for EnrollmentPolicies. 1702func (ep EnrollmentPolicies) MarshalJSON() ([]byte, error) { 1703 objectMap := make(map[string]interface{}) 1704 return json.Marshal(objectMap) 1705} 1706 1707// Error error details for transfer execution. 1708type Error struct { 1709 // ErrorCode - READ-ONLY; Error code. 1710 ErrorCode *string `json:"errorCode,omitempty"` 1711 // ErrorMessage - READ-ONLY; Error message. 1712 ErrorMessage *string `json:"errorMessage,omitempty"` 1713} 1714 1715// MarshalJSON is the custom marshaler for Error. 1716func (e Error) MarshalJSON() ([]byte, error) { 1717 objectMap := make(map[string]interface{}) 1718 return json.Marshal(objectMap) 1719} 1720 1721// ErrorDetails the details of the error. 1722type ErrorDetails struct { 1723 // Code - READ-ONLY; Error code. 1724 Code *string `json:"code,omitempty"` 1725 // Message - READ-ONLY; Error message indicating why the operation failed. 1726 Message *string `json:"message,omitempty"` 1727 // Target - READ-ONLY; The target of the particular error. 1728 Target *string `json:"target,omitempty"` 1729} 1730 1731// MarshalJSON is the custom marshaler for ErrorDetails. 1732func (ed ErrorDetails) MarshalJSON() ([]byte, error) { 1733 objectMap := make(map[string]interface{}) 1734 return json.Marshal(objectMap) 1735} 1736 1737// ErrorResponse error response indicates that the service is not able to process the incoming request. The 1738// reason is provided in the error message. 1739type ErrorResponse struct { 1740 // Error - The details of the error. 1741 Error *ErrorDetails `json:"error,omitempty"` 1742} 1743 1744// InitiateTransferProperties request parameters to initiate transfer. 1745type InitiateTransferProperties struct { 1746 // BillingProfileID - Target Usage context for devTest subscriptions. 1747 BillingProfileID *string `json:"billingProfileId,omitempty"` 1748 // RecipientEmailID - Email Id of recipient for transfer. 1749 RecipientEmailID *string `json:"recipientEmailId,omitempty"` 1750} 1751 1752// InitiateTransferRequest request parameters to initiate transfer. 1753type InitiateTransferRequest struct { 1754 // InitiateTransferProperties - Request parameters to initiate transfer. 1755 *InitiateTransferProperties `json:"properties,omitempty"` 1756} 1757 1758// MarshalJSON is the custom marshaler for InitiateTransferRequest. 1759func (itr InitiateTransferRequest) MarshalJSON() ([]byte, error) { 1760 objectMap := make(map[string]interface{}) 1761 if itr.InitiateTransferProperties != nil { 1762 objectMap["properties"] = itr.InitiateTransferProperties 1763 } 1764 return json.Marshal(objectMap) 1765} 1766 1767// UnmarshalJSON is the custom unmarshaler for InitiateTransferRequest struct. 1768func (itr *InitiateTransferRequest) UnmarshalJSON(body []byte) error { 1769 var m map[string]*json.RawMessage 1770 err := json.Unmarshal(body, &m) 1771 if err != nil { 1772 return err 1773 } 1774 for k, v := range m { 1775 switch k { 1776 case "properties": 1777 if v != nil { 1778 var initiateTransferProperties InitiateTransferProperties 1779 err = json.Unmarshal(*v, &initiateTransferProperties) 1780 if err != nil { 1781 return err 1782 } 1783 itr.InitiateTransferProperties = &initiateTransferProperties 1784 } 1785 } 1786 } 1787 1788 return nil 1789} 1790 1791// InvoiceListResult result of listing invoices. 1792type InvoiceListResult struct { 1793 autorest.Response `json:"-"` 1794 // Value - READ-ONLY; The list of invoices. 1795 Value *[]InvoiceSummary `json:"value,omitempty"` 1796 // NextLink - READ-ONLY; The link (url) to the next page of results. 1797 NextLink *string `json:"nextLink,omitempty"` 1798} 1799 1800// MarshalJSON is the custom marshaler for InvoiceListResult. 1801func (ilr InvoiceListResult) MarshalJSON() ([]byte, error) { 1802 objectMap := make(map[string]interface{}) 1803 return json.Marshal(objectMap) 1804} 1805 1806// InvoiceListResultIterator provides access to a complete listing of InvoiceSummary values. 1807type InvoiceListResultIterator struct { 1808 i int 1809 page InvoiceListResultPage 1810} 1811 1812// NextWithContext advances to the next value. If there was an error making 1813// the request the iterator does not advance and the error is returned. 1814func (iter *InvoiceListResultIterator) NextWithContext(ctx context.Context) (err error) { 1815 if tracing.IsEnabled() { 1816 ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceListResultIterator.NextWithContext") 1817 defer func() { 1818 sc := -1 1819 if iter.Response().Response.Response != nil { 1820 sc = iter.Response().Response.Response.StatusCode 1821 } 1822 tracing.EndSpan(ctx, sc, err) 1823 }() 1824 } 1825 iter.i++ 1826 if iter.i < len(iter.page.Values()) { 1827 return nil 1828 } 1829 err = iter.page.NextWithContext(ctx) 1830 if err != nil { 1831 iter.i-- 1832 return err 1833 } 1834 iter.i = 0 1835 return nil 1836} 1837 1838// Next advances to the next value. If there was an error making 1839// the request the iterator does not advance and the error is returned. 1840// Deprecated: Use NextWithContext() instead. 1841func (iter *InvoiceListResultIterator) Next() error { 1842 return iter.NextWithContext(context.Background()) 1843} 1844 1845// NotDone returns true if the enumeration should be started or is not yet complete. 1846func (iter InvoiceListResultIterator) NotDone() bool { 1847 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1848} 1849 1850// Response returns the raw server response from the last page request. 1851func (iter InvoiceListResultIterator) Response() InvoiceListResult { 1852 return iter.page.Response() 1853} 1854 1855// Value returns the current value or a zero-initialized value if the 1856// iterator has advanced beyond the end of the collection. 1857func (iter InvoiceListResultIterator) Value() InvoiceSummary { 1858 if !iter.page.NotDone() { 1859 return InvoiceSummary{} 1860 } 1861 return iter.page.Values()[iter.i] 1862} 1863 1864// Creates a new instance of the InvoiceListResultIterator type. 1865func NewInvoiceListResultIterator(page InvoiceListResultPage) InvoiceListResultIterator { 1866 return InvoiceListResultIterator{page: page} 1867} 1868 1869// IsEmpty returns true if the ListResult contains no values. 1870func (ilr InvoiceListResult) IsEmpty() bool { 1871 return ilr.Value == nil || len(*ilr.Value) == 0 1872} 1873 1874// hasNextLink returns true if the NextLink is not empty. 1875func (ilr InvoiceListResult) hasNextLink() bool { 1876 return ilr.NextLink != nil && len(*ilr.NextLink) != 0 1877} 1878 1879// invoiceListResultPreparer prepares a request to retrieve the next set of results. 1880// It returns nil if no more results exist. 1881func (ilr InvoiceListResult) invoiceListResultPreparer(ctx context.Context) (*http.Request, error) { 1882 if !ilr.hasNextLink() { 1883 return nil, nil 1884 } 1885 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1886 autorest.AsJSON(), 1887 autorest.AsGet(), 1888 autorest.WithBaseURL(to.String(ilr.NextLink))) 1889} 1890 1891// InvoiceListResultPage contains a page of InvoiceSummary values. 1892type InvoiceListResultPage struct { 1893 fn func(context.Context, InvoiceListResult) (InvoiceListResult, error) 1894 ilr InvoiceListResult 1895} 1896 1897// NextWithContext advances to the next page of values. If there was an error making 1898// the request the page does not advance and the error is returned. 1899func (page *InvoiceListResultPage) NextWithContext(ctx context.Context) (err error) { 1900 if tracing.IsEnabled() { 1901 ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceListResultPage.NextWithContext") 1902 defer func() { 1903 sc := -1 1904 if page.Response().Response.Response != nil { 1905 sc = page.Response().Response.Response.StatusCode 1906 } 1907 tracing.EndSpan(ctx, sc, err) 1908 }() 1909 } 1910 for { 1911 next, err := page.fn(ctx, page.ilr) 1912 if err != nil { 1913 return err 1914 } 1915 page.ilr = next 1916 if !next.hasNextLink() || !next.IsEmpty() { 1917 break 1918 } 1919 } 1920 return nil 1921} 1922 1923// Next advances to the next page of values. If there was an error making 1924// the request the page does not advance and the error is returned. 1925// Deprecated: Use NextWithContext() instead. 1926func (page *InvoiceListResultPage) Next() error { 1927 return page.NextWithContext(context.Background()) 1928} 1929 1930// NotDone returns true if the page enumeration should be started or is not yet complete. 1931func (page InvoiceListResultPage) NotDone() bool { 1932 return !page.ilr.IsEmpty() 1933} 1934 1935// Response returns the raw server response from the last page request. 1936func (page InvoiceListResultPage) Response() InvoiceListResult { 1937 return page.ilr 1938} 1939 1940// Values returns the slice of values for the current page or nil if there are no values. 1941func (page InvoiceListResultPage) Values() []InvoiceSummary { 1942 if page.ilr.IsEmpty() { 1943 return nil 1944 } 1945 return *page.ilr.Value 1946} 1947 1948// Creates a new instance of the InvoiceListResultPage type. 1949func NewInvoiceListResultPage(cur InvoiceListResult, getNextPage func(context.Context, InvoiceListResult) (InvoiceListResult, error)) InvoiceListResultPage { 1950 return InvoiceListResultPage{ 1951 fn: getNextPage, 1952 ilr: cur, 1953 } 1954} 1955 1956// InvoiceSection an InvoiceSection resource. 1957type InvoiceSection struct { 1958 autorest.Response `json:"-"` 1959 // InvoiceSectionProperties - The InvoiceSection. 1960 *InvoiceSectionProperties `json:"properties,omitempty"` 1961 // ID - READ-ONLY; Resource Id. 1962 ID *string `json:"id,omitempty"` 1963 // Name - READ-ONLY; Resource name. 1964 Name *string `json:"name,omitempty"` 1965 // Type - READ-ONLY; Resource type. 1966 Type *string `json:"type,omitempty"` 1967} 1968 1969// MarshalJSON is the custom marshaler for InvoiceSection. 1970func (is InvoiceSection) MarshalJSON() ([]byte, error) { 1971 objectMap := make(map[string]interface{}) 1972 if is.InvoiceSectionProperties != nil { 1973 objectMap["properties"] = is.InvoiceSectionProperties 1974 } 1975 return json.Marshal(objectMap) 1976} 1977 1978// UnmarshalJSON is the custom unmarshaler for InvoiceSection struct. 1979func (is *InvoiceSection) UnmarshalJSON(body []byte) error { 1980 var m map[string]*json.RawMessage 1981 err := json.Unmarshal(body, &m) 1982 if err != nil { 1983 return err 1984 } 1985 for k, v := range m { 1986 switch k { 1987 case "properties": 1988 if v != nil { 1989 var invoiceSectionProperties InvoiceSectionProperties 1990 err = json.Unmarshal(*v, &invoiceSectionProperties) 1991 if err != nil { 1992 return err 1993 } 1994 is.InvoiceSectionProperties = &invoiceSectionProperties 1995 } 1996 case "id": 1997 if v != nil { 1998 var ID string 1999 err = json.Unmarshal(*v, &ID) 2000 if err != nil { 2001 return err 2002 } 2003 is.ID = &ID 2004 } 2005 case "name": 2006 if v != nil { 2007 var name string 2008 err = json.Unmarshal(*v, &name) 2009 if err != nil { 2010 return err 2011 } 2012 is.Name = &name 2013 } 2014 case "type": 2015 if v != nil { 2016 var typeVar string 2017 err = json.Unmarshal(*v, &typeVar) 2018 if err != nil { 2019 return err 2020 } 2021 is.Type = &typeVar 2022 } 2023 } 2024 } 2025 2026 return nil 2027} 2028 2029// InvoiceSectionCreationRequest the properties of an InvoiceSection. 2030type InvoiceSectionCreationRequest struct { 2031 // DisplayName - The name of the InvoiceSection. 2032 DisplayName *string `json:"displayName,omitempty"` 2033 // BillingProfileID - The billing profile id. 2034 BillingProfileID *string `json:"billingProfileId,omitempty"` 2035} 2036 2037// InvoiceSectionListResult result of listing invoice sections. 2038type InvoiceSectionListResult struct { 2039 autorest.Response `json:"-"` 2040 // Value - READ-ONLY; The list of invoice sections. 2041 Value *[]InvoiceSection `json:"value,omitempty"` 2042 // NextLink - READ-ONLY; The link (url) to the next page of results. 2043 NextLink *string `json:"nextLink,omitempty"` 2044} 2045 2046// MarshalJSON is the custom marshaler for InvoiceSectionListResult. 2047func (islr InvoiceSectionListResult) MarshalJSON() ([]byte, error) { 2048 objectMap := make(map[string]interface{}) 2049 return json.Marshal(objectMap) 2050} 2051 2052// InvoiceSectionListResultIterator provides access to a complete listing of InvoiceSection values. 2053type InvoiceSectionListResultIterator struct { 2054 i int 2055 page InvoiceSectionListResultPage 2056} 2057 2058// NextWithContext advances to the next value. If there was an error making 2059// the request the iterator does not advance and the error is returned. 2060func (iter *InvoiceSectionListResultIterator) NextWithContext(ctx context.Context) (err error) { 2061 if tracing.IsEnabled() { 2062 ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionListResultIterator.NextWithContext") 2063 defer func() { 2064 sc := -1 2065 if iter.Response().Response.Response != nil { 2066 sc = iter.Response().Response.Response.StatusCode 2067 } 2068 tracing.EndSpan(ctx, sc, err) 2069 }() 2070 } 2071 iter.i++ 2072 if iter.i < len(iter.page.Values()) { 2073 return nil 2074 } 2075 err = iter.page.NextWithContext(ctx) 2076 if err != nil { 2077 iter.i-- 2078 return err 2079 } 2080 iter.i = 0 2081 return nil 2082} 2083 2084// Next advances to the next value. If there was an error making 2085// the request the iterator does not advance and the error is returned. 2086// Deprecated: Use NextWithContext() instead. 2087func (iter *InvoiceSectionListResultIterator) Next() error { 2088 return iter.NextWithContext(context.Background()) 2089} 2090 2091// NotDone returns true if the enumeration should be started or is not yet complete. 2092func (iter InvoiceSectionListResultIterator) NotDone() bool { 2093 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2094} 2095 2096// Response returns the raw server response from the last page request. 2097func (iter InvoiceSectionListResultIterator) Response() InvoiceSectionListResult { 2098 return iter.page.Response() 2099} 2100 2101// Value returns the current value or a zero-initialized value if the 2102// iterator has advanced beyond the end of the collection. 2103func (iter InvoiceSectionListResultIterator) Value() InvoiceSection { 2104 if !iter.page.NotDone() { 2105 return InvoiceSection{} 2106 } 2107 return iter.page.Values()[iter.i] 2108} 2109 2110// Creates a new instance of the InvoiceSectionListResultIterator type. 2111func NewInvoiceSectionListResultIterator(page InvoiceSectionListResultPage) InvoiceSectionListResultIterator { 2112 return InvoiceSectionListResultIterator{page: page} 2113} 2114 2115// IsEmpty returns true if the ListResult contains no values. 2116func (islr InvoiceSectionListResult) IsEmpty() bool { 2117 return islr.Value == nil || len(*islr.Value) == 0 2118} 2119 2120// hasNextLink returns true if the NextLink is not empty. 2121func (islr InvoiceSectionListResult) hasNextLink() bool { 2122 return islr.NextLink != nil && len(*islr.NextLink) != 0 2123} 2124 2125// invoiceSectionListResultPreparer prepares a request to retrieve the next set of results. 2126// It returns nil if no more results exist. 2127func (islr InvoiceSectionListResult) invoiceSectionListResultPreparer(ctx context.Context) (*http.Request, error) { 2128 if !islr.hasNextLink() { 2129 return nil, nil 2130 } 2131 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2132 autorest.AsJSON(), 2133 autorest.AsGet(), 2134 autorest.WithBaseURL(to.String(islr.NextLink))) 2135} 2136 2137// InvoiceSectionListResultPage contains a page of InvoiceSection values. 2138type InvoiceSectionListResultPage struct { 2139 fn func(context.Context, InvoiceSectionListResult) (InvoiceSectionListResult, error) 2140 islr InvoiceSectionListResult 2141} 2142 2143// NextWithContext advances to the next page of values. If there was an error making 2144// the request the page does not advance and the error is returned. 2145func (page *InvoiceSectionListResultPage) NextWithContext(ctx context.Context) (err error) { 2146 if tracing.IsEnabled() { 2147 ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionListResultPage.NextWithContext") 2148 defer func() { 2149 sc := -1 2150 if page.Response().Response.Response != nil { 2151 sc = page.Response().Response.Response.StatusCode 2152 } 2153 tracing.EndSpan(ctx, sc, err) 2154 }() 2155 } 2156 for { 2157 next, err := page.fn(ctx, page.islr) 2158 if err != nil { 2159 return err 2160 } 2161 page.islr = next 2162 if !next.hasNextLink() || !next.IsEmpty() { 2163 break 2164 } 2165 } 2166 return nil 2167} 2168 2169// Next advances to the next page of values. If there was an error making 2170// the request the page does not advance and the error is returned. 2171// Deprecated: Use NextWithContext() instead. 2172func (page *InvoiceSectionListResultPage) Next() error { 2173 return page.NextWithContext(context.Background()) 2174} 2175 2176// NotDone returns true if the page enumeration should be started or is not yet complete. 2177func (page InvoiceSectionListResultPage) NotDone() bool { 2178 return !page.islr.IsEmpty() 2179} 2180 2181// Response returns the raw server response from the last page request. 2182func (page InvoiceSectionListResultPage) Response() InvoiceSectionListResult { 2183 return page.islr 2184} 2185 2186// Values returns the slice of values for the current page or nil if there are no values. 2187func (page InvoiceSectionListResultPage) Values() []InvoiceSection { 2188 if page.islr.IsEmpty() { 2189 return nil 2190 } 2191 return *page.islr.Value 2192} 2193 2194// Creates a new instance of the InvoiceSectionListResultPage type. 2195func NewInvoiceSectionListResultPage(cur InvoiceSectionListResult, getNextPage func(context.Context, InvoiceSectionListResult) (InvoiceSectionListResult, error)) InvoiceSectionListResultPage { 2196 return InvoiceSectionListResultPage{ 2197 fn: getNextPage, 2198 islr: cur, 2199 } 2200} 2201 2202// InvoiceSectionProperties the properties of an InvoiceSection. 2203type InvoiceSectionProperties struct { 2204 // DisplayName - The name of the InvoiceSection. 2205 DisplayName *string `json:"displayName,omitempty"` 2206 // BillingProfiles - The billing profiles associated to the billing account. 2207 BillingProfiles *[]Profile `json:"billingProfiles,omitempty"` 2208} 2209 2210// InvoiceSectionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 2211// operation. 2212type InvoiceSectionsCreateFuture struct { 2213 azure.FutureAPI 2214 // Result returns the result of the asynchronous operation. 2215 // If the operation has not completed it will return an error. 2216 Result func(InvoiceSectionsClient) (InvoiceSection, error) 2217} 2218 2219// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2220func (future *InvoiceSectionsCreateFuture) UnmarshalJSON(body []byte) error { 2221 var azFuture azure.Future 2222 if err := json.Unmarshal(body, &azFuture); err != nil { 2223 return err 2224 } 2225 future.FutureAPI = &azFuture 2226 future.Result = future.result 2227 return nil 2228} 2229 2230// result is the default implementation for InvoiceSectionsCreateFuture.Result. 2231func (future *InvoiceSectionsCreateFuture) result(client InvoiceSectionsClient) (is InvoiceSection, err error) { 2232 var done bool 2233 done, err = future.DoneWithContext(context.Background(), client) 2234 if err != nil { 2235 err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsCreateFuture", "Result", future.Response(), "Polling failure") 2236 return 2237 } 2238 if !done { 2239 is.Response.Response = future.Response() 2240 err = azure.NewAsyncOpIncompleteError("billing.InvoiceSectionsCreateFuture") 2241 return 2242 } 2243 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2244 if is.Response.Response, err = future.GetResult(sender); err == nil && is.Response.Response.StatusCode != http.StatusNoContent { 2245 is, err = client.CreateResponder(is.Response.Response) 2246 if err != nil { 2247 err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsCreateFuture", "Result", is.Response.Response, "Failure responding to request") 2248 } 2249 } 2250 return 2251} 2252 2253// InvoiceSectionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2254// operation. 2255type InvoiceSectionsUpdateFuture struct { 2256 azure.FutureAPI 2257 // Result returns the result of the asynchronous operation. 2258 // If the operation has not completed it will return an error. 2259 Result func(InvoiceSectionsClient) (InvoiceSection, error) 2260} 2261 2262// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2263func (future *InvoiceSectionsUpdateFuture) UnmarshalJSON(body []byte) error { 2264 var azFuture azure.Future 2265 if err := json.Unmarshal(body, &azFuture); err != nil { 2266 return err 2267 } 2268 future.FutureAPI = &azFuture 2269 future.Result = future.result 2270 return nil 2271} 2272 2273// result is the default implementation for InvoiceSectionsUpdateFuture.Result. 2274func (future *InvoiceSectionsUpdateFuture) result(client InvoiceSectionsClient) (is InvoiceSection, err error) { 2275 var done bool 2276 done, err = future.DoneWithContext(context.Background(), client) 2277 if err != nil { 2278 err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsUpdateFuture", "Result", future.Response(), "Polling failure") 2279 return 2280 } 2281 if !done { 2282 is.Response.Response = future.Response() 2283 err = azure.NewAsyncOpIncompleteError("billing.InvoiceSectionsUpdateFuture") 2284 return 2285 } 2286 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2287 if is.Response.Response, err = future.GetResult(sender); err == nil && is.Response.Response.StatusCode != http.StatusNoContent { 2288 is, err = client.UpdateResponder(is.Response.Response) 2289 if err != nil { 2290 err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsUpdateFuture", "Result", is.Response.Response, "Failure responding to request") 2291 } 2292 } 2293 return 2294} 2295 2296// InvoiceSummary an invoice resource. 2297type InvoiceSummary struct { 2298 autorest.Response `json:"-"` 2299 // InvoiceSummaryProperties - An invoice. 2300 *InvoiceSummaryProperties `json:"properties,omitempty"` 2301 // ID - READ-ONLY; Resource Id. 2302 ID *string `json:"id,omitempty"` 2303 // Name - READ-ONLY; Resource name. 2304 Name *string `json:"name,omitempty"` 2305 // Type - READ-ONLY; Resource type. 2306 Type *string `json:"type,omitempty"` 2307} 2308 2309// MarshalJSON is the custom marshaler for InvoiceSummary. 2310func (is InvoiceSummary) MarshalJSON() ([]byte, error) { 2311 objectMap := make(map[string]interface{}) 2312 if is.InvoiceSummaryProperties != nil { 2313 objectMap["properties"] = is.InvoiceSummaryProperties 2314 } 2315 return json.Marshal(objectMap) 2316} 2317 2318// UnmarshalJSON is the custom unmarshaler for InvoiceSummary struct. 2319func (is *InvoiceSummary) UnmarshalJSON(body []byte) error { 2320 var m map[string]*json.RawMessage 2321 err := json.Unmarshal(body, &m) 2322 if err != nil { 2323 return err 2324 } 2325 for k, v := range m { 2326 switch k { 2327 case "properties": 2328 if v != nil { 2329 var invoiceSummaryProperties InvoiceSummaryProperties 2330 err = json.Unmarshal(*v, &invoiceSummaryProperties) 2331 if err != nil { 2332 return err 2333 } 2334 is.InvoiceSummaryProperties = &invoiceSummaryProperties 2335 } 2336 case "id": 2337 if v != nil { 2338 var ID string 2339 err = json.Unmarshal(*v, &ID) 2340 if err != nil { 2341 return err 2342 } 2343 is.ID = &ID 2344 } 2345 case "name": 2346 if v != nil { 2347 var name string 2348 err = json.Unmarshal(*v, &name) 2349 if err != nil { 2350 return err 2351 } 2352 is.Name = &name 2353 } 2354 case "type": 2355 if v != nil { 2356 var typeVar string 2357 err = json.Unmarshal(*v, &typeVar) 2358 if err != nil { 2359 return err 2360 } 2361 is.Type = &typeVar 2362 } 2363 } 2364 } 2365 2366 return nil 2367} 2368 2369// InvoiceSummaryProperties the properties of the invoice. 2370type InvoiceSummaryProperties struct { 2371 // DueDate - READ-ONLY; The due date for invoice. 2372 DueDate *date.Time `json:"dueDate,omitempty"` 2373 // InvoiceDate - READ-ONLY; The date when invoice was created. 2374 InvoiceDate *date.Time `json:"invoiceDate,omitempty"` 2375 // Status - READ-ONLY; Invoice status. Possible values include: 'Status1PastDue', 'Status1Due', 'Status1Paid', 'Status1Void' 2376 Status Status1 `json:"status,omitempty"` 2377 // AmountDue - READ-ONLY; Amount due. 2378 AmountDue *Amount `json:"amountDue,omitempty"` 2379 // BilledAmount - READ-ONLY; Amount billed. 2380 BilledAmount *Amount `json:"billedAmount,omitempty"` 2381 // InvoicePeriodStartDate - READ-ONLY; The start date of the billing period. 2382 InvoicePeriodStartDate *date.Time `json:"invoicePeriodStartDate,omitempty"` 2383 // InvoicePeriodEndDate - READ-ONLY; The end date of the billing period. 2384 InvoicePeriodEndDate *date.Time `json:"invoicePeriodEndDate,omitempty"` 2385 // BillingProfileID - READ-ONLY; The billing profile id this invoice belongs to. 2386 BillingProfileID *string `json:"billingProfileId,omitempty"` 2387 // BillingProfileName - READ-ONLY; The profile name this invoice belongs to. 2388 BillingProfileName *string `json:"billingProfileName,omitempty"` 2389 // PurchaseOrderNumber - READ-ONLY; The purchase identifier for the invoice. 2390 PurchaseOrderNumber *string `json:"purchaseOrderNumber,omitempty"` 2391 // DocumentUrls - READ-ONLY; List of document urls available to download including invoice and tax documents. 2392 DocumentUrls *[]DownloadProperties `json:"documentUrls,omitempty"` 2393 // Payments - READ-ONLY; List of payments. 2394 Payments *[]PaymentProperties `json:"payments,omitempty"` 2395} 2396 2397// MarshalJSON is the custom marshaler for InvoiceSummaryProperties. 2398func (isp InvoiceSummaryProperties) MarshalJSON() ([]byte, error) { 2399 objectMap := make(map[string]interface{}) 2400 return json.Marshal(objectMap) 2401} 2402 2403// LineOfCredit line of credit resource. 2404type LineOfCredit struct { 2405 autorest.Response `json:"-"` 2406 // LineOfCreditProperties - A line of credit. 2407 *LineOfCreditProperties `json:"properties,omitempty"` 2408 // ID - READ-ONLY; Resource Id. 2409 ID *string `json:"id,omitempty"` 2410 // Name - READ-ONLY; Resource name. 2411 Name *string `json:"name,omitempty"` 2412 // Type - READ-ONLY; Resource type. 2413 Type *string `json:"type,omitempty"` 2414} 2415 2416// MarshalJSON is the custom marshaler for LineOfCredit. 2417func (loc LineOfCredit) MarshalJSON() ([]byte, error) { 2418 objectMap := make(map[string]interface{}) 2419 if loc.LineOfCreditProperties != nil { 2420 objectMap["properties"] = loc.LineOfCreditProperties 2421 } 2422 return json.Marshal(objectMap) 2423} 2424 2425// UnmarshalJSON is the custom unmarshaler for LineOfCredit struct. 2426func (loc *LineOfCredit) UnmarshalJSON(body []byte) error { 2427 var m map[string]*json.RawMessage 2428 err := json.Unmarshal(body, &m) 2429 if err != nil { 2430 return err 2431 } 2432 for k, v := range m { 2433 switch k { 2434 case "properties": 2435 if v != nil { 2436 var lineOfCreditProperties LineOfCreditProperties 2437 err = json.Unmarshal(*v, &lineOfCreditProperties) 2438 if err != nil { 2439 return err 2440 } 2441 loc.LineOfCreditProperties = &lineOfCreditProperties 2442 } 2443 case "id": 2444 if v != nil { 2445 var ID string 2446 err = json.Unmarshal(*v, &ID) 2447 if err != nil { 2448 return err 2449 } 2450 loc.ID = &ID 2451 } 2452 case "name": 2453 if v != nil { 2454 var name string 2455 err = json.Unmarshal(*v, &name) 2456 if err != nil { 2457 return err 2458 } 2459 loc.Name = &name 2460 } 2461 case "type": 2462 if v != nil { 2463 var typeVar string 2464 err = json.Unmarshal(*v, &typeVar) 2465 if err != nil { 2466 return err 2467 } 2468 loc.Type = &typeVar 2469 } 2470 } 2471 } 2472 2473 return nil 2474} 2475 2476// LineOfCreditProperties the properties of the line of credit. 2477type LineOfCreditProperties struct { 2478 // CreditLimit - The current credit limit. 2479 CreditLimit *Amount `json:"creditLimit,omitempty"` 2480 // Reason - READ-ONLY; The reason for the line of credit status when not approved. 2481 Reason *string `json:"reason,omitempty"` 2482 // RemainingBalance - READ-ONLY; Remaining balance. 2483 RemainingBalance *Amount `json:"remainingBalance,omitempty"` 2484 // Status - The line of credit status. Possible values include: 'Approved', 'Rejected' 2485 Status Status `json:"status,omitempty"` 2486} 2487 2488// MarshalJSON is the custom marshaler for LineOfCreditProperties. 2489func (locp LineOfCreditProperties) MarshalJSON() ([]byte, error) { 2490 objectMap := make(map[string]interface{}) 2491 if locp.CreditLimit != nil { 2492 objectMap["creditLimit"] = locp.CreditLimit 2493 } 2494 if locp.Status != "" { 2495 objectMap["status"] = locp.Status 2496 } 2497 return json.Marshal(objectMap) 2498} 2499 2500// LineOfCreditsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2501// operation. 2502type LineOfCreditsUpdateFuture struct { 2503 azure.FutureAPI 2504 // Result returns the result of the asynchronous operation. 2505 // If the operation has not completed it will return an error. 2506 Result func(LineOfCreditsClient) (LineOfCredit, error) 2507} 2508 2509// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2510func (future *LineOfCreditsUpdateFuture) UnmarshalJSON(body []byte) error { 2511 var azFuture azure.Future 2512 if err := json.Unmarshal(body, &azFuture); err != nil { 2513 return err 2514 } 2515 future.FutureAPI = &azFuture 2516 future.Result = future.result 2517 return nil 2518} 2519 2520// result is the default implementation for LineOfCreditsUpdateFuture.Result. 2521func (future *LineOfCreditsUpdateFuture) result(client LineOfCreditsClient) (loc LineOfCredit, err error) { 2522 var done bool 2523 done, err = future.DoneWithContext(context.Background(), client) 2524 if err != nil { 2525 err = autorest.NewErrorWithError(err, "billing.LineOfCreditsUpdateFuture", "Result", future.Response(), "Polling failure") 2526 return 2527 } 2528 if !done { 2529 loc.Response.Response = future.Response() 2530 err = azure.NewAsyncOpIncompleteError("billing.LineOfCreditsUpdateFuture") 2531 return 2532 } 2533 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2534 if loc.Response.Response, err = future.GetResult(sender); err == nil && loc.Response.Response.StatusCode != http.StatusNoContent { 2535 loc, err = client.UpdateResponder(loc.Response.Response) 2536 if err != nil { 2537 err = autorest.NewErrorWithError(err, "billing.LineOfCreditsUpdateFuture", "Result", loc.Response.Response, "Failure responding to request") 2538 } 2539 } 2540 return 2541} 2542 2543// Operation a Billing REST API operation. 2544type Operation struct { 2545 // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}. 2546 Name *string `json:"name,omitempty"` 2547 // Display - The object that represents the operation. 2548 Display *OperationDisplay `json:"display,omitempty"` 2549} 2550 2551// MarshalJSON is the custom marshaler for Operation. 2552func (o Operation) MarshalJSON() ([]byte, error) { 2553 objectMap := make(map[string]interface{}) 2554 if o.Display != nil { 2555 objectMap["display"] = o.Display 2556 } 2557 return json.Marshal(objectMap) 2558} 2559 2560// OperationDisplay the object that represents the operation. 2561type OperationDisplay struct { 2562 // Provider - READ-ONLY; Service provider: Microsoft.Billing. 2563 Provider *string `json:"provider,omitempty"` 2564 // Resource - READ-ONLY; Resource on which the operation is performed: Invoice, etc. 2565 Resource *string `json:"resource,omitempty"` 2566 // Operation - READ-ONLY; Operation type: Read, write, delete, etc. 2567 Operation *string `json:"operation,omitempty"` 2568} 2569 2570// MarshalJSON is the custom marshaler for OperationDisplay. 2571func (o OperationDisplay) MarshalJSON() ([]byte, error) { 2572 objectMap := make(map[string]interface{}) 2573 return json.Marshal(objectMap) 2574} 2575 2576// OperationListResult result listing billing operations. It contains a list of operations and a URL link 2577// to get the next set of results. 2578type OperationListResult struct { 2579 autorest.Response `json:"-"` 2580 // Value - READ-ONLY; List of billing operations supported by the Microsoft.Billing resource provider. 2581 Value *[]Operation `json:"value,omitempty"` 2582 // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. 2583 NextLink *string `json:"nextLink,omitempty"` 2584} 2585 2586// MarshalJSON is the custom marshaler for OperationListResult. 2587func (olr OperationListResult) MarshalJSON() ([]byte, error) { 2588 objectMap := make(map[string]interface{}) 2589 return json.Marshal(objectMap) 2590} 2591 2592// OperationListResultIterator provides access to a complete listing of Operation values. 2593type OperationListResultIterator struct { 2594 i int 2595 page OperationListResultPage 2596} 2597 2598// NextWithContext advances to the next value. If there was an error making 2599// the request the iterator does not advance and the error is returned. 2600func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2601 if tracing.IsEnabled() { 2602 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 2603 defer func() { 2604 sc := -1 2605 if iter.Response().Response.Response != nil { 2606 sc = iter.Response().Response.Response.StatusCode 2607 } 2608 tracing.EndSpan(ctx, sc, err) 2609 }() 2610 } 2611 iter.i++ 2612 if iter.i < len(iter.page.Values()) { 2613 return nil 2614 } 2615 err = iter.page.NextWithContext(ctx) 2616 if err != nil { 2617 iter.i-- 2618 return err 2619 } 2620 iter.i = 0 2621 return nil 2622} 2623 2624// Next advances to the next value. If there was an error making 2625// the request the iterator does not advance and the error is returned. 2626// Deprecated: Use NextWithContext() instead. 2627func (iter *OperationListResultIterator) Next() error { 2628 return iter.NextWithContext(context.Background()) 2629} 2630 2631// NotDone returns true if the enumeration should be started or is not yet complete. 2632func (iter OperationListResultIterator) NotDone() bool { 2633 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2634} 2635 2636// Response returns the raw server response from the last page request. 2637func (iter OperationListResultIterator) Response() OperationListResult { 2638 return iter.page.Response() 2639} 2640 2641// Value returns the current value or a zero-initialized value if the 2642// iterator has advanced beyond the end of the collection. 2643func (iter OperationListResultIterator) Value() Operation { 2644 if !iter.page.NotDone() { 2645 return Operation{} 2646 } 2647 return iter.page.Values()[iter.i] 2648} 2649 2650// Creates a new instance of the OperationListResultIterator type. 2651func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 2652 return OperationListResultIterator{page: page} 2653} 2654 2655// IsEmpty returns true if the ListResult contains no values. 2656func (olr OperationListResult) IsEmpty() bool { 2657 return olr.Value == nil || len(*olr.Value) == 0 2658} 2659 2660// hasNextLink returns true if the NextLink is not empty. 2661func (olr OperationListResult) hasNextLink() bool { 2662 return olr.NextLink != nil && len(*olr.NextLink) != 0 2663} 2664 2665// operationListResultPreparer prepares a request to retrieve the next set of results. 2666// It returns nil if no more results exist. 2667func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 2668 if !olr.hasNextLink() { 2669 return nil, nil 2670 } 2671 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2672 autorest.AsJSON(), 2673 autorest.AsGet(), 2674 autorest.WithBaseURL(to.String(olr.NextLink))) 2675} 2676 2677// OperationListResultPage contains a page of Operation values. 2678type OperationListResultPage struct { 2679 fn func(context.Context, OperationListResult) (OperationListResult, error) 2680 olr OperationListResult 2681} 2682 2683// NextWithContext advances to the next page of values. If there was an error making 2684// the request the page does not advance and the error is returned. 2685func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 2686 if tracing.IsEnabled() { 2687 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 2688 defer func() { 2689 sc := -1 2690 if page.Response().Response.Response != nil { 2691 sc = page.Response().Response.Response.StatusCode 2692 } 2693 tracing.EndSpan(ctx, sc, err) 2694 }() 2695 } 2696 for { 2697 next, err := page.fn(ctx, page.olr) 2698 if err != nil { 2699 return err 2700 } 2701 page.olr = next 2702 if !next.hasNextLink() || !next.IsEmpty() { 2703 break 2704 } 2705 } 2706 return nil 2707} 2708 2709// Next advances to the next page of values. If there was an error making 2710// the request the page does not advance and the error is returned. 2711// Deprecated: Use NextWithContext() instead. 2712func (page *OperationListResultPage) Next() error { 2713 return page.NextWithContext(context.Background()) 2714} 2715 2716// NotDone returns true if the page enumeration should be started or is not yet complete. 2717func (page OperationListResultPage) NotDone() bool { 2718 return !page.olr.IsEmpty() 2719} 2720 2721// Response returns the raw server response from the last page request. 2722func (page OperationListResultPage) Response() OperationListResult { 2723 return page.olr 2724} 2725 2726// Values returns the slice of values for the current page or nil if there are no values. 2727func (page OperationListResultPage) Values() []Operation { 2728 if page.olr.IsEmpty() { 2729 return nil 2730 } 2731 return *page.olr.Value 2732} 2733 2734// Creates a new instance of the OperationListResultPage type. 2735func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 2736 return OperationListResultPage{ 2737 fn: getNextPage, 2738 olr: cur, 2739 } 2740} 2741 2742// OperationStatus status of the Billing POST/PUT operation. 2743type OperationStatus struct { 2744 // ID - READ-ONLY; The operation Id. 2745 ID *string `json:"id,omitempty"` 2746 // Status - Status of the pending operation 2747 Status *string `json:"status,omitempty"` 2748 // StatusDetail - Status Detail of the pending operation 2749 StatusDetail *string `json:"statusDetail,omitempty"` 2750} 2751 2752// MarshalJSON is the custom marshaler for OperationStatus. 2753func (osVar OperationStatus) MarshalJSON() ([]byte, error) { 2754 objectMap := make(map[string]interface{}) 2755 if osVar.Status != nil { 2756 objectMap["status"] = osVar.Status 2757 } 2758 if osVar.StatusDetail != nil { 2759 objectMap["statusDetail"] = osVar.StatusDetail 2760 } 2761 return json.Marshal(objectMap) 2762} 2763 2764// Participants details about the participant or signer. 2765type Participants struct { 2766 // Status - READ-ONLY; The signing status 2767 Status *string `json:"status,omitempty"` 2768 // StatusDate - READ-ONLY; The date when status got changed. 2769 StatusDate *date.Time `json:"statusDate,omitempty"` 2770 // Email - READ-ONLY; The email address of the participant or signer. 2771 Email *string `json:"email,omitempty"` 2772} 2773 2774// MarshalJSON is the custom marshaler for Participants. 2775func (p Participants) MarshalJSON() ([]byte, error) { 2776 objectMap := make(map[string]interface{}) 2777 return json.Marshal(objectMap) 2778} 2779 2780// PaymentMethod a payment method resource. 2781type PaymentMethod struct { 2782 *PaymentMethodProperties `json:"properties,omitempty"` 2783 // ID - READ-ONLY; Resource Id. 2784 ID *string `json:"id,omitempty"` 2785 // Name - READ-ONLY; Resource name. 2786 Name *string `json:"name,omitempty"` 2787 // Type - READ-ONLY; Resource type. 2788 Type *string `json:"type,omitempty"` 2789} 2790 2791// MarshalJSON is the custom marshaler for PaymentMethod. 2792func (pm PaymentMethod) MarshalJSON() ([]byte, error) { 2793 objectMap := make(map[string]interface{}) 2794 if pm.PaymentMethodProperties != nil { 2795 objectMap["properties"] = pm.PaymentMethodProperties 2796 } 2797 return json.Marshal(objectMap) 2798} 2799 2800// UnmarshalJSON is the custom unmarshaler for PaymentMethod struct. 2801func (pm *PaymentMethod) UnmarshalJSON(body []byte) error { 2802 var m map[string]*json.RawMessage 2803 err := json.Unmarshal(body, &m) 2804 if err != nil { 2805 return err 2806 } 2807 for k, v := range m { 2808 switch k { 2809 case "properties": 2810 if v != nil { 2811 var paymentMethodProperties PaymentMethodProperties 2812 err = json.Unmarshal(*v, &paymentMethodProperties) 2813 if err != nil { 2814 return err 2815 } 2816 pm.PaymentMethodProperties = &paymentMethodProperties 2817 } 2818 case "id": 2819 if v != nil { 2820 var ID string 2821 err = json.Unmarshal(*v, &ID) 2822 if err != nil { 2823 return err 2824 } 2825 pm.ID = &ID 2826 } 2827 case "name": 2828 if v != nil { 2829 var name string 2830 err = json.Unmarshal(*v, &name) 2831 if err != nil { 2832 return err 2833 } 2834 pm.Name = &name 2835 } 2836 case "type": 2837 if v != nil { 2838 var typeVar string 2839 err = json.Unmarshal(*v, &typeVar) 2840 if err != nil { 2841 return err 2842 } 2843 pm.Type = &typeVar 2844 } 2845 } 2846 } 2847 2848 return nil 2849} 2850 2851// PaymentMethodProperties the properties of the payment method. 2852type PaymentMethodProperties struct { 2853 // PaymentMethodType - Payment method type. Possible values include: 'Credits', 'ChequeWire' 2854 PaymentMethodType PaymentMethodType `json:"paymentMethodType,omitempty"` 2855 // Details - READ-ONLY; Details about the payment method. 2856 Details *string `json:"details,omitempty"` 2857 // Expiration - READ-ONLY; Expiration date. 2858 Expiration *date.Time `json:"expiration,omitempty"` 2859 // Currency - READ-ONLY; The currency associated with the payment method. 2860 Currency *string `json:"currency,omitempty"` 2861} 2862 2863// MarshalJSON is the custom marshaler for PaymentMethodProperties. 2864func (pmp PaymentMethodProperties) MarshalJSON() ([]byte, error) { 2865 objectMap := make(map[string]interface{}) 2866 if pmp.PaymentMethodType != "" { 2867 objectMap["paymentMethodType"] = pmp.PaymentMethodType 2868 } 2869 return json.Marshal(objectMap) 2870} 2871 2872// PaymentMethodsListResult result of listing payment methods. 2873type PaymentMethodsListResult struct { 2874 autorest.Response `json:"-"` 2875 // Value - READ-ONLY; The list of payment methods. 2876 Value *[]PaymentMethod `json:"value,omitempty"` 2877 // NextLink - READ-ONLY; The link (url) to the next page of results. 2878 NextLink *string `json:"nextLink,omitempty"` 2879} 2880 2881// MarshalJSON is the custom marshaler for PaymentMethodsListResult. 2882func (pmlr PaymentMethodsListResult) MarshalJSON() ([]byte, error) { 2883 objectMap := make(map[string]interface{}) 2884 return json.Marshal(objectMap) 2885} 2886 2887// PaymentMethodsListResultIterator provides access to a complete listing of PaymentMethod values. 2888type PaymentMethodsListResultIterator struct { 2889 i int 2890 page PaymentMethodsListResultPage 2891} 2892 2893// NextWithContext advances to the next value. If there was an error making 2894// the request the iterator does not advance and the error is returned. 2895func (iter *PaymentMethodsListResultIterator) NextWithContext(ctx context.Context) (err error) { 2896 if tracing.IsEnabled() { 2897 ctx = tracing.StartSpan(ctx, fqdn+"/PaymentMethodsListResultIterator.NextWithContext") 2898 defer func() { 2899 sc := -1 2900 if iter.Response().Response.Response != nil { 2901 sc = iter.Response().Response.Response.StatusCode 2902 } 2903 tracing.EndSpan(ctx, sc, err) 2904 }() 2905 } 2906 iter.i++ 2907 if iter.i < len(iter.page.Values()) { 2908 return nil 2909 } 2910 err = iter.page.NextWithContext(ctx) 2911 if err != nil { 2912 iter.i-- 2913 return err 2914 } 2915 iter.i = 0 2916 return nil 2917} 2918 2919// Next advances to the next value. If there was an error making 2920// the request the iterator does not advance and the error is returned. 2921// Deprecated: Use NextWithContext() instead. 2922func (iter *PaymentMethodsListResultIterator) Next() error { 2923 return iter.NextWithContext(context.Background()) 2924} 2925 2926// NotDone returns true if the enumeration should be started or is not yet complete. 2927func (iter PaymentMethodsListResultIterator) NotDone() bool { 2928 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2929} 2930 2931// Response returns the raw server response from the last page request. 2932func (iter PaymentMethodsListResultIterator) Response() PaymentMethodsListResult { 2933 return iter.page.Response() 2934} 2935 2936// Value returns the current value or a zero-initialized value if the 2937// iterator has advanced beyond the end of the collection. 2938func (iter PaymentMethodsListResultIterator) Value() PaymentMethod { 2939 if !iter.page.NotDone() { 2940 return PaymentMethod{} 2941 } 2942 return iter.page.Values()[iter.i] 2943} 2944 2945// Creates a new instance of the PaymentMethodsListResultIterator type. 2946func NewPaymentMethodsListResultIterator(page PaymentMethodsListResultPage) PaymentMethodsListResultIterator { 2947 return PaymentMethodsListResultIterator{page: page} 2948} 2949 2950// IsEmpty returns true if the ListResult contains no values. 2951func (pmlr PaymentMethodsListResult) IsEmpty() bool { 2952 return pmlr.Value == nil || len(*pmlr.Value) == 0 2953} 2954 2955// hasNextLink returns true if the NextLink is not empty. 2956func (pmlr PaymentMethodsListResult) hasNextLink() bool { 2957 return pmlr.NextLink != nil && len(*pmlr.NextLink) != 0 2958} 2959 2960// paymentMethodsListResultPreparer prepares a request to retrieve the next set of results. 2961// It returns nil if no more results exist. 2962func (pmlr PaymentMethodsListResult) paymentMethodsListResultPreparer(ctx context.Context) (*http.Request, error) { 2963 if !pmlr.hasNextLink() { 2964 return nil, nil 2965 } 2966 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2967 autorest.AsJSON(), 2968 autorest.AsGet(), 2969 autorest.WithBaseURL(to.String(pmlr.NextLink))) 2970} 2971 2972// PaymentMethodsListResultPage contains a page of PaymentMethod values. 2973type PaymentMethodsListResultPage struct { 2974 fn func(context.Context, PaymentMethodsListResult) (PaymentMethodsListResult, error) 2975 pmlr PaymentMethodsListResult 2976} 2977 2978// NextWithContext advances to the next page of values. If there was an error making 2979// the request the page does not advance and the error is returned. 2980func (page *PaymentMethodsListResultPage) NextWithContext(ctx context.Context) (err error) { 2981 if tracing.IsEnabled() { 2982 ctx = tracing.StartSpan(ctx, fqdn+"/PaymentMethodsListResultPage.NextWithContext") 2983 defer func() { 2984 sc := -1 2985 if page.Response().Response.Response != nil { 2986 sc = page.Response().Response.Response.StatusCode 2987 } 2988 tracing.EndSpan(ctx, sc, err) 2989 }() 2990 } 2991 for { 2992 next, err := page.fn(ctx, page.pmlr) 2993 if err != nil { 2994 return err 2995 } 2996 page.pmlr = next 2997 if !next.hasNextLink() || !next.IsEmpty() { 2998 break 2999 } 3000 } 3001 return nil 3002} 3003 3004// Next advances to the next page of values. If there was an error making 3005// the request the page does not advance and the error is returned. 3006// Deprecated: Use NextWithContext() instead. 3007func (page *PaymentMethodsListResultPage) Next() error { 3008 return page.NextWithContext(context.Background()) 3009} 3010 3011// NotDone returns true if the page enumeration should be started or is not yet complete. 3012func (page PaymentMethodsListResultPage) NotDone() bool { 3013 return !page.pmlr.IsEmpty() 3014} 3015 3016// Response returns the raw server response from the last page request. 3017func (page PaymentMethodsListResultPage) Response() PaymentMethodsListResult { 3018 return page.pmlr 3019} 3020 3021// Values returns the slice of values for the current page or nil if there are no values. 3022func (page PaymentMethodsListResultPage) Values() []PaymentMethod { 3023 if page.pmlr.IsEmpty() { 3024 return nil 3025 } 3026 return *page.pmlr.Value 3027} 3028 3029// Creates a new instance of the PaymentMethodsListResultPage type. 3030func NewPaymentMethodsListResultPage(cur PaymentMethodsListResult, getNextPage func(context.Context, PaymentMethodsListResult) (PaymentMethodsListResult, error)) PaymentMethodsListResultPage { 3031 return PaymentMethodsListResultPage{ 3032 fn: getNextPage, 3033 pmlr: cur, 3034 } 3035} 3036 3037// PaymentProperties the properties of the payment. 3038type PaymentProperties struct { 3039 // PaymentType - READ-ONLY; The type of payment. 3040 PaymentType *string `json:"paymentType,omitempty"` 3041 // Amount - READ-ONLY; The paid amount. 3042 Amount *Amount `json:"amount,omitempty"` 3043 // Date - READ-ONLY; The date of the payment. 3044 Date *date.Time `json:"date,omitempty"` 3045} 3046 3047// MarshalJSON is the custom marshaler for PaymentProperties. 3048func (pp PaymentProperties) MarshalJSON() ([]byte, error) { 3049 objectMap := make(map[string]interface{}) 3050 return json.Marshal(objectMap) 3051} 3052 3053// PermissionsListResult result of list billingPermissions a caller has on a billing account. 3054type PermissionsListResult struct { 3055 autorest.Response `json:"-"` 3056 // Value - READ-ONLY; The list OF billingPermissions a caller has on a billing account. 3057 Value *[]PermissionsProperties `json:"value,omitempty"` 3058} 3059 3060// MarshalJSON is the custom marshaler for PermissionsListResult. 3061func (plr PermissionsListResult) MarshalJSON() ([]byte, error) { 3062 objectMap := make(map[string]interface{}) 3063 return json.Marshal(objectMap) 3064} 3065 3066// PermissionsProperties the set of allowed action and not allowed actions a caller has on a billing 3067// account 3068type PermissionsProperties struct { 3069 // Actions - READ-ONLY; The set of actions that the caller is allowed to do 3070 Actions *[]string `json:"actions,omitempty"` 3071 // NotActions - READ-ONLY; The set of actions the caller is not allowed to do 3072 NotActions *[]string `json:"notActions,omitempty"` 3073} 3074 3075// MarshalJSON is the custom marshaler for PermissionsProperties. 3076func (pp PermissionsProperties) MarshalJSON() ([]byte, error) { 3077 objectMap := make(map[string]interface{}) 3078 return json.Marshal(objectMap) 3079} 3080 3081// Policy the Policy. 3082type Policy struct { 3083 autorest.Response `json:"-"` 3084 *PolicyProperties `json:"properties,omitempty"` 3085 // ID - READ-ONLY; Resource Id. 3086 ID *string `json:"id,omitempty"` 3087 // Name - READ-ONLY; Resource name. 3088 Name *string `json:"name,omitempty"` 3089 // Type - READ-ONLY; Resource type. 3090 Type *string `json:"type,omitempty"` 3091} 3092 3093// MarshalJSON is the custom marshaler for Policy. 3094func (p Policy) MarshalJSON() ([]byte, error) { 3095 objectMap := make(map[string]interface{}) 3096 if p.PolicyProperties != nil { 3097 objectMap["properties"] = p.PolicyProperties 3098 } 3099 return json.Marshal(objectMap) 3100} 3101 3102// UnmarshalJSON is the custom unmarshaler for Policy struct. 3103func (p *Policy) UnmarshalJSON(body []byte) error { 3104 var m map[string]*json.RawMessage 3105 err := json.Unmarshal(body, &m) 3106 if err != nil { 3107 return err 3108 } 3109 for k, v := range m { 3110 switch k { 3111 case "properties": 3112 if v != nil { 3113 var policyProperties PolicyProperties 3114 err = json.Unmarshal(*v, &policyProperties) 3115 if err != nil { 3116 return err 3117 } 3118 p.PolicyProperties = &policyProperties 3119 } 3120 case "id": 3121 if v != nil { 3122 var ID string 3123 err = json.Unmarshal(*v, &ID) 3124 if err != nil { 3125 return err 3126 } 3127 p.ID = &ID 3128 } 3129 case "name": 3130 if v != nil { 3131 var name string 3132 err = json.Unmarshal(*v, &name) 3133 if err != nil { 3134 return err 3135 } 3136 p.Name = &name 3137 } 3138 case "type": 3139 if v != nil { 3140 var typeVar string 3141 err = json.Unmarshal(*v, &typeVar) 3142 if err != nil { 3143 return err 3144 } 3145 p.Type = &typeVar 3146 } 3147 } 3148 } 3149 3150 return nil 3151} 3152 3153// PolicyProperties the properties of policy. 3154type PolicyProperties struct { 3155 // MarketplacePurchasesAllowed - The marketplacePurchasesAllowed flag. 3156 MarketplacePurchasesAllowed *bool `json:"marketplacePurchasesAllowed,omitempty"` 3157 // ReservationPurchasesAllowed - The reservationPurchasesAllowed flag. 3158 ReservationPurchasesAllowed *bool `json:"reservationPurchasesAllowed,omitempty"` 3159 // SubscriptionOwnerCanViewCharges - The subscriptionOwnerCanViewCharges flag. 3160 SubscriptionOwnerCanViewCharges *bool `json:"subscriptionOwnerCanViewCharges,omitempty"` 3161} 3162 3163// PriceSheetDownloadFuture an abstraction for monitoring and retrieving the results of a long-running 3164// operation. 3165type PriceSheetDownloadFuture struct { 3166 azure.FutureAPI 3167 // Result returns the result of the asynchronous operation. 3168 // If the operation has not completed it will return an error. 3169 Result func(PriceSheetClient) (DownloadURL, error) 3170} 3171 3172// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3173func (future *PriceSheetDownloadFuture) UnmarshalJSON(body []byte) error { 3174 var azFuture azure.Future 3175 if err := json.Unmarshal(body, &azFuture); err != nil { 3176 return err 3177 } 3178 future.FutureAPI = &azFuture 3179 future.Result = future.result 3180 return nil 3181} 3182 3183// result is the default implementation for PriceSheetDownloadFuture.Result. 3184func (future *PriceSheetDownloadFuture) result(client PriceSheetClient) (du DownloadURL, err error) { 3185 var done bool 3186 done, err = future.DoneWithContext(context.Background(), client) 3187 if err != nil { 3188 err = autorest.NewErrorWithError(err, "billing.PriceSheetDownloadFuture", "Result", future.Response(), "Polling failure") 3189 return 3190 } 3191 if !done { 3192 du.Response.Response = future.Response() 3193 err = azure.NewAsyncOpIncompleteError("billing.PriceSheetDownloadFuture") 3194 return 3195 } 3196 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3197 if du.Response.Response, err = future.GetResult(sender); err == nil && du.Response.Response.StatusCode != http.StatusNoContent { 3198 du, err = client.DownloadResponder(du.Response.Response) 3199 if err != nil { 3200 err = autorest.NewErrorWithError(err, "billing.PriceSheetDownloadFuture", "Result", du.Response.Response, "Failure responding to request") 3201 } 3202 } 3203 return 3204} 3205 3206// ProductDetails details of the product to be transferred. 3207type ProductDetails struct { 3208 // ProductType - Type of the product to be transferred. Possible values include: 'ProductTypeAzureSubscription', 'ProductTypeAzureReservation' 3209 ProductType ProductType `json:"productType,omitempty"` 3210 // ProductID - Id of product to be transferred. 3211 ProductID *string `json:"productId,omitempty"` 3212} 3213 3214// ProductsListResult result of listing products summary. It contains a list of available products 3215// summaries in reverse chronological order by purchase date. 3216type ProductsListResult struct { 3217 autorest.Response `json:"-"` 3218 // Value - READ-ONLY; The list of products summary. 3219 Value *[]ProductSummary `json:"value,omitempty"` 3220 // NextLink - READ-ONLY; The link (url) to the next page of results. 3221 NextLink *string `json:"nextLink,omitempty"` 3222} 3223 3224// MarshalJSON is the custom marshaler for ProductsListResult. 3225func (plr ProductsListResult) MarshalJSON() ([]byte, error) { 3226 objectMap := make(map[string]interface{}) 3227 return json.Marshal(objectMap) 3228} 3229 3230// ProductsListResultIterator provides access to a complete listing of ProductSummary values. 3231type ProductsListResultIterator struct { 3232 i int 3233 page ProductsListResultPage 3234} 3235 3236// NextWithContext advances to the next value. If there was an error making 3237// the request the iterator does not advance and the error is returned. 3238func (iter *ProductsListResultIterator) NextWithContext(ctx context.Context) (err error) { 3239 if tracing.IsEnabled() { 3240 ctx = tracing.StartSpan(ctx, fqdn+"/ProductsListResultIterator.NextWithContext") 3241 defer func() { 3242 sc := -1 3243 if iter.Response().Response.Response != nil { 3244 sc = iter.Response().Response.Response.StatusCode 3245 } 3246 tracing.EndSpan(ctx, sc, err) 3247 }() 3248 } 3249 iter.i++ 3250 if iter.i < len(iter.page.Values()) { 3251 return nil 3252 } 3253 err = iter.page.NextWithContext(ctx) 3254 if err != nil { 3255 iter.i-- 3256 return err 3257 } 3258 iter.i = 0 3259 return nil 3260} 3261 3262// Next advances to the next value. If there was an error making 3263// the request the iterator does not advance and the error is returned. 3264// Deprecated: Use NextWithContext() instead. 3265func (iter *ProductsListResultIterator) Next() error { 3266 return iter.NextWithContext(context.Background()) 3267} 3268 3269// NotDone returns true if the enumeration should be started or is not yet complete. 3270func (iter ProductsListResultIterator) NotDone() bool { 3271 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3272} 3273 3274// Response returns the raw server response from the last page request. 3275func (iter ProductsListResultIterator) Response() ProductsListResult { 3276 return iter.page.Response() 3277} 3278 3279// Value returns the current value or a zero-initialized value if the 3280// iterator has advanced beyond the end of the collection. 3281func (iter ProductsListResultIterator) Value() ProductSummary { 3282 if !iter.page.NotDone() { 3283 return ProductSummary{} 3284 } 3285 return iter.page.Values()[iter.i] 3286} 3287 3288// Creates a new instance of the ProductsListResultIterator type. 3289func NewProductsListResultIterator(page ProductsListResultPage) ProductsListResultIterator { 3290 return ProductsListResultIterator{page: page} 3291} 3292 3293// IsEmpty returns true if the ListResult contains no values. 3294func (plr ProductsListResult) IsEmpty() bool { 3295 return plr.Value == nil || len(*plr.Value) == 0 3296} 3297 3298// hasNextLink returns true if the NextLink is not empty. 3299func (plr ProductsListResult) hasNextLink() bool { 3300 return plr.NextLink != nil && len(*plr.NextLink) != 0 3301} 3302 3303// productsListResultPreparer prepares a request to retrieve the next set of results. 3304// It returns nil if no more results exist. 3305func (plr ProductsListResult) productsListResultPreparer(ctx context.Context) (*http.Request, error) { 3306 if !plr.hasNextLink() { 3307 return nil, nil 3308 } 3309 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3310 autorest.AsJSON(), 3311 autorest.AsGet(), 3312 autorest.WithBaseURL(to.String(plr.NextLink))) 3313} 3314 3315// ProductsListResultPage contains a page of ProductSummary values. 3316type ProductsListResultPage struct { 3317 fn func(context.Context, ProductsListResult) (ProductsListResult, error) 3318 plr ProductsListResult 3319} 3320 3321// NextWithContext advances to the next page of values. If there was an error making 3322// the request the page does not advance and the error is returned. 3323func (page *ProductsListResultPage) NextWithContext(ctx context.Context) (err error) { 3324 if tracing.IsEnabled() { 3325 ctx = tracing.StartSpan(ctx, fqdn+"/ProductsListResultPage.NextWithContext") 3326 defer func() { 3327 sc := -1 3328 if page.Response().Response.Response != nil { 3329 sc = page.Response().Response.Response.StatusCode 3330 } 3331 tracing.EndSpan(ctx, sc, err) 3332 }() 3333 } 3334 for { 3335 next, err := page.fn(ctx, page.plr) 3336 if err != nil { 3337 return err 3338 } 3339 page.plr = next 3340 if !next.hasNextLink() || !next.IsEmpty() { 3341 break 3342 } 3343 } 3344 return nil 3345} 3346 3347// Next advances to the next page of values. If there was an error making 3348// the request the page does not advance and the error is returned. 3349// Deprecated: Use NextWithContext() instead. 3350func (page *ProductsListResultPage) Next() error { 3351 return page.NextWithContext(context.Background()) 3352} 3353 3354// NotDone returns true if the page enumeration should be started or is not yet complete. 3355func (page ProductsListResultPage) NotDone() bool { 3356 return !page.plr.IsEmpty() 3357} 3358 3359// Response returns the raw server response from the last page request. 3360func (page ProductsListResultPage) Response() ProductsListResult { 3361 return page.plr 3362} 3363 3364// Values returns the slice of values for the current page or nil if there are no values. 3365func (page ProductsListResultPage) Values() []ProductSummary { 3366 if page.plr.IsEmpty() { 3367 return nil 3368 } 3369 return *page.plr.Value 3370} 3371 3372// Creates a new instance of the ProductsListResultPage type. 3373func NewProductsListResultPage(cur ProductsListResult, getNextPage func(context.Context, ProductsListResult) (ProductsListResult, error)) ProductsListResultPage { 3374 return ProductsListResultPage{ 3375 fn: getNextPage, 3376 plr: cur, 3377 } 3378} 3379 3380// ProductSummary a product summary resource. 3381type ProductSummary struct { 3382 autorest.Response `json:"-"` 3383 *ProductSummaryProperties `json:"properties,omitempty"` 3384 // ID - READ-ONLY; Resource Id. 3385 ID *string `json:"id,omitempty"` 3386 // Name - READ-ONLY; Resource name. 3387 Name *string `json:"name,omitempty"` 3388 // Type - READ-ONLY; Resource type. 3389 Type *string `json:"type,omitempty"` 3390} 3391 3392// MarshalJSON is the custom marshaler for ProductSummary. 3393func (ps ProductSummary) MarshalJSON() ([]byte, error) { 3394 objectMap := make(map[string]interface{}) 3395 if ps.ProductSummaryProperties != nil { 3396 objectMap["properties"] = ps.ProductSummaryProperties 3397 } 3398 return json.Marshal(objectMap) 3399} 3400 3401// UnmarshalJSON is the custom unmarshaler for ProductSummary struct. 3402func (ps *ProductSummary) UnmarshalJSON(body []byte) error { 3403 var m map[string]*json.RawMessage 3404 err := json.Unmarshal(body, &m) 3405 if err != nil { 3406 return err 3407 } 3408 for k, v := range m { 3409 switch k { 3410 case "properties": 3411 if v != nil { 3412 var productSummaryProperties ProductSummaryProperties 3413 err = json.Unmarshal(*v, &productSummaryProperties) 3414 if err != nil { 3415 return err 3416 } 3417 ps.ProductSummaryProperties = &productSummaryProperties 3418 } 3419 case "id": 3420 if v != nil { 3421 var ID string 3422 err = json.Unmarshal(*v, &ID) 3423 if err != nil { 3424 return err 3425 } 3426 ps.ID = &ID 3427 } 3428 case "name": 3429 if v != nil { 3430 var name string 3431 err = json.Unmarshal(*v, &name) 3432 if err != nil { 3433 return err 3434 } 3435 ps.Name = &name 3436 } 3437 case "type": 3438 if v != nil { 3439 var typeVar string 3440 err = json.Unmarshal(*v, &typeVar) 3441 if err != nil { 3442 return err 3443 } 3444 ps.Type = &typeVar 3445 } 3446 } 3447 } 3448 3449 return nil 3450} 3451 3452// ProductSummaryProperties the properties of the product summary. 3453type ProductSummaryProperties struct { 3454 // DisplayName - READ-ONLY; The display name of the product. 3455 DisplayName *string `json:"displayName,omitempty"` 3456 // PurchaseDate - READ-ONLY; The date of purchase. 3457 PurchaseDate *date.Time `json:"purchaseDate,omitempty"` 3458 // ProductTypeID - READ-ONLY; The product type id. 3459 ProductTypeID *string `json:"productTypeId,omitempty"` 3460 // ProductType - READ-ONLY; The type of product. 3461 ProductType *string `json:"productType,omitempty"` 3462 // Status - Product status. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' 3463 Status ProductStatusType `json:"status,omitempty"` 3464 // EndDate - READ-ONLY; end date. 3465 EndDate *date.Time `json:"endDate,omitempty"` 3466 // BillingFrequency - Billing frequency. Possible values include: 'OneTime', 'Monthly', 'UsageBased' 3467 BillingFrequency Frequency `json:"billingFrequency,omitempty"` 3468 // LastCharge - READ-ONLY; Last month charges. 3469 LastCharge *Amount `json:"lastCharge,omitempty"` 3470 // LastChargeDate - READ-ONLY; The date of the last charge. 3471 LastChargeDate *date.Time `json:"lastChargeDate,omitempty"` 3472 // Quantity - READ-ONLY; The purchased product quantity. 3473 Quantity *float64 `json:"quantity,omitempty"` 3474 // SkuID - READ-ONLY; Sku Id. 3475 SkuID *string `json:"skuId,omitempty"` 3476 // SkuDescription - READ-ONLY; Sku description. 3477 SkuDescription *string `json:"skuDescription,omitempty"` 3478 // AvailabilityID - READ-ONLY; Availability Id. 3479 AvailabilityID *string `json:"availabilityId,omitempty"` 3480 // ParentProductID - READ-ONLY; Parent Product Id. 3481 ParentProductID *string `json:"parentProductId,omitempty"` 3482 // InvoiceSectionID - READ-ONLY; Invoice section id to which this product belongs. 3483 InvoiceSectionID *string `json:"invoiceSectionId,omitempty"` 3484 // InvoiceSectionName - READ-ONLY; Invoice section name to which this product belongs. 3485 InvoiceSectionName *string `json:"invoiceSectionName,omitempty"` 3486 // BillingProfileID - READ-ONLY; Billing Profile id to which this product belongs. 3487 BillingProfileID *string `json:"billingProfileId,omitempty"` 3488 // BillingProfileName - READ-ONLY; Billing Profile name to which this product belongs. 3489 BillingProfileName *string `json:"billingProfileName,omitempty"` 3490} 3491 3492// MarshalJSON is the custom marshaler for ProductSummaryProperties. 3493func (psp ProductSummaryProperties) MarshalJSON() ([]byte, error) { 3494 objectMap := make(map[string]interface{}) 3495 if psp.Status != "" { 3496 objectMap["status"] = psp.Status 3497 } 3498 if psp.BillingFrequency != "" { 3499 objectMap["billingFrequency"] = psp.BillingFrequency 3500 } 3501 return json.Marshal(objectMap) 3502} 3503 3504// Profile a billing profile resource. 3505type Profile struct { 3506 autorest.Response `json:"-"` 3507 // ProfileProperties - A billing profile. 3508 *ProfileProperties `json:"properties,omitempty"` 3509 // ID - READ-ONLY; Resource Id. 3510 ID *string `json:"id,omitempty"` 3511 // Name - READ-ONLY; Resource name. 3512 Name *string `json:"name,omitempty"` 3513 // Type - READ-ONLY; Resource type. 3514 Type *string `json:"type,omitempty"` 3515} 3516 3517// MarshalJSON is the custom marshaler for Profile. 3518func (p Profile) MarshalJSON() ([]byte, error) { 3519 objectMap := make(map[string]interface{}) 3520 if p.ProfileProperties != nil { 3521 objectMap["properties"] = p.ProfileProperties 3522 } 3523 return json.Marshal(objectMap) 3524} 3525 3526// UnmarshalJSON is the custom unmarshaler for Profile struct. 3527func (p *Profile) UnmarshalJSON(body []byte) error { 3528 var m map[string]*json.RawMessage 3529 err := json.Unmarshal(body, &m) 3530 if err != nil { 3531 return err 3532 } 3533 for k, v := range m { 3534 switch k { 3535 case "properties": 3536 if v != nil { 3537 var profileProperties ProfileProperties 3538 err = json.Unmarshal(*v, &profileProperties) 3539 if err != nil { 3540 return err 3541 } 3542 p.ProfileProperties = &profileProperties 3543 } 3544 case "id": 3545 if v != nil { 3546 var ID string 3547 err = json.Unmarshal(*v, &ID) 3548 if err != nil { 3549 return err 3550 } 3551 p.ID = &ID 3552 } 3553 case "name": 3554 if v != nil { 3555 var name string 3556 err = json.Unmarshal(*v, &name) 3557 if err != nil { 3558 return err 3559 } 3560 p.Name = &name 3561 } 3562 case "type": 3563 if v != nil { 3564 var typeVar string 3565 err = json.Unmarshal(*v, &typeVar) 3566 if err != nil { 3567 return err 3568 } 3569 p.Type = &typeVar 3570 } 3571 } 3572 } 3573 3574 return nil 3575} 3576 3577// ProfileCreationParameters the parameters for creating a new billing profile. 3578type ProfileCreationParameters struct { 3579 // DisplayName - The billing profile name. 3580 DisplayName *string `json:"displayName,omitempty"` 3581 // PoNumber - Purchase order number. 3582 PoNumber *string `json:"poNumber,omitempty"` 3583 // Address - Billing address. 3584 Address *Address `json:"address,omitempty"` 3585 // InvoiceEmailOptIn - If the billing profile is opted in to receive invoices via email. 3586 InvoiceEmailOptIn *bool `json:"invoiceEmailOptIn,omitempty"` 3587 // EnableAzureSKUs - Azure skus to enable for this billing profile.. 3588 EnableAzureSKUs *[]EnabledAzureSKUs `json:"enableAzureSKUs,omitempty"` 3589} 3590 3591// ProfileListResult result of listing billing profiles. 3592type ProfileListResult struct { 3593 autorest.Response `json:"-"` 3594 // Value - READ-ONLY; The list of billing profiles. 3595 Value *[]Profile `json:"value,omitempty"` 3596 // NextLink - READ-ONLY; The link (url) to the next page of results. 3597 NextLink *string `json:"nextLink,omitempty"` 3598} 3599 3600// MarshalJSON is the custom marshaler for ProfileListResult. 3601func (plr ProfileListResult) MarshalJSON() ([]byte, error) { 3602 objectMap := make(map[string]interface{}) 3603 return json.Marshal(objectMap) 3604} 3605 3606// ProfileListResultIterator provides access to a complete listing of Profile values. 3607type ProfileListResultIterator struct { 3608 i int 3609 page ProfileListResultPage 3610} 3611 3612// NextWithContext advances to the next value. If there was an error making 3613// the request the iterator does not advance and the error is returned. 3614func (iter *ProfileListResultIterator) NextWithContext(ctx context.Context) (err error) { 3615 if tracing.IsEnabled() { 3616 ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultIterator.NextWithContext") 3617 defer func() { 3618 sc := -1 3619 if iter.Response().Response.Response != nil { 3620 sc = iter.Response().Response.Response.StatusCode 3621 } 3622 tracing.EndSpan(ctx, sc, err) 3623 }() 3624 } 3625 iter.i++ 3626 if iter.i < len(iter.page.Values()) { 3627 return nil 3628 } 3629 err = iter.page.NextWithContext(ctx) 3630 if err != nil { 3631 iter.i-- 3632 return err 3633 } 3634 iter.i = 0 3635 return nil 3636} 3637 3638// Next advances to the next value. If there was an error making 3639// the request the iterator does not advance and the error is returned. 3640// Deprecated: Use NextWithContext() instead. 3641func (iter *ProfileListResultIterator) Next() error { 3642 return iter.NextWithContext(context.Background()) 3643} 3644 3645// NotDone returns true if the enumeration should be started or is not yet complete. 3646func (iter ProfileListResultIterator) NotDone() bool { 3647 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3648} 3649 3650// Response returns the raw server response from the last page request. 3651func (iter ProfileListResultIterator) Response() ProfileListResult { 3652 return iter.page.Response() 3653} 3654 3655// Value returns the current value or a zero-initialized value if the 3656// iterator has advanced beyond the end of the collection. 3657func (iter ProfileListResultIterator) Value() Profile { 3658 if !iter.page.NotDone() { 3659 return Profile{} 3660 } 3661 return iter.page.Values()[iter.i] 3662} 3663 3664// Creates a new instance of the ProfileListResultIterator type. 3665func NewProfileListResultIterator(page ProfileListResultPage) ProfileListResultIterator { 3666 return ProfileListResultIterator{page: page} 3667} 3668 3669// IsEmpty returns true if the ListResult contains no values. 3670func (plr ProfileListResult) IsEmpty() bool { 3671 return plr.Value == nil || len(*plr.Value) == 0 3672} 3673 3674// hasNextLink returns true if the NextLink is not empty. 3675func (plr ProfileListResult) hasNextLink() bool { 3676 return plr.NextLink != nil && len(*plr.NextLink) != 0 3677} 3678 3679// profileListResultPreparer prepares a request to retrieve the next set of results. 3680// It returns nil if no more results exist. 3681func (plr ProfileListResult) profileListResultPreparer(ctx context.Context) (*http.Request, error) { 3682 if !plr.hasNextLink() { 3683 return nil, nil 3684 } 3685 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3686 autorest.AsJSON(), 3687 autorest.AsGet(), 3688 autorest.WithBaseURL(to.String(plr.NextLink))) 3689} 3690 3691// ProfileListResultPage contains a page of Profile values. 3692type ProfileListResultPage struct { 3693 fn func(context.Context, ProfileListResult) (ProfileListResult, error) 3694 plr ProfileListResult 3695} 3696 3697// NextWithContext advances to the next page of values. If there was an error making 3698// the request the page does not advance and the error is returned. 3699func (page *ProfileListResultPage) NextWithContext(ctx context.Context) (err error) { 3700 if tracing.IsEnabled() { 3701 ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultPage.NextWithContext") 3702 defer func() { 3703 sc := -1 3704 if page.Response().Response.Response != nil { 3705 sc = page.Response().Response.Response.StatusCode 3706 } 3707 tracing.EndSpan(ctx, sc, err) 3708 }() 3709 } 3710 for { 3711 next, err := page.fn(ctx, page.plr) 3712 if err != nil { 3713 return err 3714 } 3715 page.plr = next 3716 if !next.hasNextLink() || !next.IsEmpty() { 3717 break 3718 } 3719 } 3720 return nil 3721} 3722 3723// Next advances to the next page of values. If there was an error making 3724// the request the page does not advance and the error is returned. 3725// Deprecated: Use NextWithContext() instead. 3726func (page *ProfileListResultPage) Next() error { 3727 return page.NextWithContext(context.Background()) 3728} 3729 3730// NotDone returns true if the page enumeration should be started or is not yet complete. 3731func (page ProfileListResultPage) NotDone() bool { 3732 return !page.plr.IsEmpty() 3733} 3734 3735// Response returns the raw server response from the last page request. 3736func (page ProfileListResultPage) Response() ProfileListResult { 3737 return page.plr 3738} 3739 3740// Values returns the slice of values for the current page or nil if there are no values. 3741func (page ProfileListResultPage) Values() []Profile { 3742 if page.plr.IsEmpty() { 3743 return nil 3744 } 3745 return *page.plr.Value 3746} 3747 3748// Creates a new instance of the ProfileListResultPage type. 3749func NewProfileListResultPage(cur ProfileListResult, getNextPage func(context.Context, ProfileListResult) (ProfileListResult, error)) ProfileListResultPage { 3750 return ProfileListResultPage{ 3751 fn: getNextPage, 3752 plr: cur, 3753 } 3754} 3755 3756// ProfileProperties the properties of the billing profile. 3757type ProfileProperties struct { 3758 // DisplayName - The billing profile name. 3759 DisplayName *string `json:"displayName,omitempty"` 3760 // PoNumber - Purchase order number. 3761 PoNumber *string `json:"poNumber,omitempty"` 3762 // Address - Billing address. 3763 Address *Address `json:"address,omitempty"` 3764 // InvoiceEmailOptIn - READ-ONLY; If the billing profile is opted in to receive invoices via email. 3765 InvoiceEmailOptIn *bool `json:"invoiceEmailOptIn,omitempty"` 3766 // IsClassic - READ-ONLY; Is OMS bootstrapped billing profile. 3767 IsClassic *bool `json:"isClassic,omitempty"` 3768 // InvoiceDay - READ-ONLY; Invoice day. 3769 InvoiceDay *int32 `json:"invoiceDay,omitempty"` 3770 // Currency - READ-ONLY; The currency associated with the billing profile. 3771 Currency *string `json:"currency,omitempty"` 3772 // EnabledAzureSKUs - Information about the product. 3773 EnabledAzureSKUs *[]EnabledAzureSKUs `json:"enabledAzureSKUs,omitempty"` 3774 // InvoiceSections - The invoice sections associated to the billing profile. 3775 InvoiceSections *[]InvoiceSection `json:"invoiceSections,omitempty"` 3776} 3777 3778// MarshalJSON is the custom marshaler for ProfileProperties. 3779func (pp ProfileProperties) MarshalJSON() ([]byte, error) { 3780 objectMap := make(map[string]interface{}) 3781 if pp.DisplayName != nil { 3782 objectMap["displayName"] = pp.DisplayName 3783 } 3784 if pp.PoNumber != nil { 3785 objectMap["poNumber"] = pp.PoNumber 3786 } 3787 if pp.Address != nil { 3788 objectMap["address"] = pp.Address 3789 } 3790 if pp.EnabledAzureSKUs != nil { 3791 objectMap["enabledAzureSKUs"] = pp.EnabledAzureSKUs 3792 } 3793 if pp.InvoiceSections != nil { 3794 objectMap["invoiceSections"] = pp.InvoiceSections 3795 } 3796 return json.Marshal(objectMap) 3797} 3798 3799// ProfilesCreateFuture an abstraction for monitoring and retrieving the results of a long-running 3800// operation. 3801type ProfilesCreateFuture struct { 3802 azure.FutureAPI 3803 // Result returns the result of the asynchronous operation. 3804 // If the operation has not completed it will return an error. 3805 Result func(ProfilesClient) (Profile, error) 3806} 3807 3808// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3809func (future *ProfilesCreateFuture) UnmarshalJSON(body []byte) error { 3810 var azFuture azure.Future 3811 if err := json.Unmarshal(body, &azFuture); err != nil { 3812 return err 3813 } 3814 future.FutureAPI = &azFuture 3815 future.Result = future.result 3816 return nil 3817} 3818 3819// result is the default implementation for ProfilesCreateFuture.Result. 3820func (future *ProfilesCreateFuture) result(client ProfilesClient) (p Profile, err error) { 3821 var done bool 3822 done, err = future.DoneWithContext(context.Background(), client) 3823 if err != nil { 3824 err = autorest.NewErrorWithError(err, "billing.ProfilesCreateFuture", "Result", future.Response(), "Polling failure") 3825 return 3826 } 3827 if !done { 3828 p.Response.Response = future.Response() 3829 err = azure.NewAsyncOpIncompleteError("billing.ProfilesCreateFuture") 3830 return 3831 } 3832 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3833 if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { 3834 p, err = client.CreateResponder(p.Response.Response) 3835 if err != nil { 3836 err = autorest.NewErrorWithError(err, "billing.ProfilesCreateFuture", "Result", p.Response.Response, "Failure responding to request") 3837 } 3838 } 3839 return 3840} 3841 3842// ProfilesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 3843// operation. 3844type ProfilesUpdateFuture struct { 3845 azure.FutureAPI 3846 // Result returns the result of the asynchronous operation. 3847 // If the operation has not completed it will return an error. 3848 Result func(ProfilesClient) (Profile, error) 3849} 3850 3851// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3852func (future *ProfilesUpdateFuture) UnmarshalJSON(body []byte) error { 3853 var azFuture azure.Future 3854 if err := json.Unmarshal(body, &azFuture); err != nil { 3855 return err 3856 } 3857 future.FutureAPI = &azFuture 3858 future.Result = future.result 3859 return nil 3860} 3861 3862// result is the default implementation for ProfilesUpdateFuture.Result. 3863func (future *ProfilesUpdateFuture) result(client ProfilesClient) (p Profile, err error) { 3864 var done bool 3865 done, err = future.DoneWithContext(context.Background(), client) 3866 if err != nil { 3867 err = autorest.NewErrorWithError(err, "billing.ProfilesUpdateFuture", "Result", future.Response(), "Polling failure") 3868 return 3869 } 3870 if !done { 3871 p.Response.Response = future.Response() 3872 err = azure.NewAsyncOpIncompleteError("billing.ProfilesUpdateFuture") 3873 return 3874 } 3875 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3876 if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { 3877 p, err = client.UpdateResponder(p.Response.Response) 3878 if err != nil { 3879 err = autorest.NewErrorWithError(err, "billing.ProfilesUpdateFuture", "Result", p.Response.Response, "Failure responding to request") 3880 } 3881 } 3882 return 3883} 3884 3885// Property a billing property resource. 3886type Property struct { 3887 autorest.Response `json:"-"` 3888 // PropertySummary - A billing property. 3889 *PropertySummary `json:"properties,omitempty"` 3890 // ID - READ-ONLY; Resource Id. 3891 ID *string `json:"id,omitempty"` 3892 // Name - READ-ONLY; Resource name. 3893 Name *string `json:"name,omitempty"` 3894 // Type - READ-ONLY; Resource type. 3895 Type *string `json:"type,omitempty"` 3896} 3897 3898// MarshalJSON is the custom marshaler for Property. 3899func (p Property) MarshalJSON() ([]byte, error) { 3900 objectMap := make(map[string]interface{}) 3901 if p.PropertySummary != nil { 3902 objectMap["properties"] = p.PropertySummary 3903 } 3904 return json.Marshal(objectMap) 3905} 3906 3907// UnmarshalJSON is the custom unmarshaler for Property struct. 3908func (p *Property) UnmarshalJSON(body []byte) error { 3909 var m map[string]*json.RawMessage 3910 err := json.Unmarshal(body, &m) 3911 if err != nil { 3912 return err 3913 } 3914 for k, v := range m { 3915 switch k { 3916 case "properties": 3917 if v != nil { 3918 var propertySummary PropertySummary 3919 err = json.Unmarshal(*v, &propertySummary) 3920 if err != nil { 3921 return err 3922 } 3923 p.PropertySummary = &propertySummary 3924 } 3925 case "id": 3926 if v != nil { 3927 var ID string 3928 err = json.Unmarshal(*v, &ID) 3929 if err != nil { 3930 return err 3931 } 3932 p.ID = &ID 3933 } 3934 case "name": 3935 if v != nil { 3936 var name string 3937 err = json.Unmarshal(*v, &name) 3938 if err != nil { 3939 return err 3940 } 3941 p.Name = &name 3942 } 3943 case "type": 3944 if v != nil { 3945 var typeVar string 3946 err = json.Unmarshal(*v, &typeVar) 3947 if err != nil { 3948 return err 3949 } 3950 p.Type = &typeVar 3951 } 3952 } 3953 } 3954 3955 return nil 3956} 3957 3958// PropertySummary the billing property. 3959type PropertySummary struct { 3960 // BillingTenantID - READ-ONLY; Billing tenant Id. 3961 BillingTenantID *string `json:"billingTenantId,omitempty"` 3962 // BillingAccountID - READ-ONLY; Billing account Id. 3963 BillingAccountID *string `json:"billingAccountId,omitempty"` 3964 // BillingAccountName - READ-ONLY; Billing account name. 3965 BillingAccountName *string `json:"billingAccountName,omitempty"` 3966 // BillingProfileID - READ-ONLY; Billing profile Id. 3967 BillingProfileID *string `json:"billingProfileId,omitempty"` 3968 // BillingProfileName - READ-ONLY; Billing profile name. 3969 BillingProfileName *string `json:"billingProfileName,omitempty"` 3970 // CostCenter - READ-ONLY; Cost center name. 3971 CostCenter *string `json:"costCenter,omitempty"` 3972 // InvoiceSectionID - READ-ONLY; Invoice Section Id. 3973 InvoiceSectionID *string `json:"invoiceSectionId,omitempty"` 3974 // InvoiceSectionName - READ-ONLY; Invoice Section name. 3975 InvoiceSectionName *string `json:"invoiceSectionName,omitempty"` 3976 // ProductID - READ-ONLY; Product Id. 3977 ProductID *string `json:"productId,omitempty"` 3978 // ProductName - READ-ONLY; Product name. 3979 ProductName *string `json:"productName,omitempty"` 3980 // SkuID - READ-ONLY; SKU Id. 3981 SkuID *string `json:"skuId,omitempty"` 3982 // SkuDescription - READ-ONLY; SKU description. 3983 SkuDescription *string `json:"skuDescription,omitempty"` 3984} 3985 3986// MarshalJSON is the custom marshaler for PropertySummary. 3987func (ps PropertySummary) MarshalJSON() ([]byte, error) { 3988 objectMap := make(map[string]interface{}) 3989 return json.Marshal(objectMap) 3990} 3991 3992// RecipientTransferDetails details of the transfer. 3993type RecipientTransferDetails struct { 3994 autorest.Response `json:"-"` 3995 // RecipientTransferProperties - Details of the transfer. 3996 *RecipientTransferProperties `json:"properties,omitempty"` 3997} 3998 3999// MarshalJSON is the custom marshaler for RecipientTransferDetails. 4000func (rtd RecipientTransferDetails) MarshalJSON() ([]byte, error) { 4001 objectMap := make(map[string]interface{}) 4002 if rtd.RecipientTransferProperties != nil { 4003 objectMap["properties"] = rtd.RecipientTransferProperties 4004 } 4005 return json.Marshal(objectMap) 4006} 4007 4008// UnmarshalJSON is the custom unmarshaler for RecipientTransferDetails struct. 4009func (rtd *RecipientTransferDetails) UnmarshalJSON(body []byte) error { 4010 var m map[string]*json.RawMessage 4011 err := json.Unmarshal(body, &m) 4012 if err != nil { 4013 return err 4014 } 4015 for k, v := range m { 4016 switch k { 4017 case "properties": 4018 if v != nil { 4019 var recipientTransferProperties RecipientTransferProperties 4020 err = json.Unmarshal(*v, &recipientTransferProperties) 4021 if err != nil { 4022 return err 4023 } 4024 rtd.RecipientTransferProperties = &recipientTransferProperties 4025 } 4026 } 4027 } 4028 4029 return nil 4030} 4031 4032// RecipientTransferDetailsListResult result of listing details of the transfer received by caller. 4033type RecipientTransferDetailsListResult struct { 4034 autorest.Response `json:"-"` 4035 // Value - READ-ONLY; The list of transfers received by caller. 4036 Value *[]RecipientTransferDetails `json:"value,omitempty"` 4037 // NextLink - READ-ONLY; The link (url) to the next page of results. 4038 NextLink *string `json:"nextLink,omitempty"` 4039} 4040 4041// MarshalJSON is the custom marshaler for RecipientTransferDetailsListResult. 4042func (rtdlr RecipientTransferDetailsListResult) MarshalJSON() ([]byte, error) { 4043 objectMap := make(map[string]interface{}) 4044 return json.Marshal(objectMap) 4045} 4046 4047// RecipientTransferDetailsListResultIterator provides access to a complete listing of 4048// RecipientTransferDetails values. 4049type RecipientTransferDetailsListResultIterator struct { 4050 i int 4051 page RecipientTransferDetailsListResultPage 4052} 4053 4054// NextWithContext advances to the next value. If there was an error making 4055// the request the iterator does not advance and the error is returned. 4056func (iter *RecipientTransferDetailsListResultIterator) NextWithContext(ctx context.Context) (err error) { 4057 if tracing.IsEnabled() { 4058 ctx = tracing.StartSpan(ctx, fqdn+"/RecipientTransferDetailsListResultIterator.NextWithContext") 4059 defer func() { 4060 sc := -1 4061 if iter.Response().Response.Response != nil { 4062 sc = iter.Response().Response.Response.StatusCode 4063 } 4064 tracing.EndSpan(ctx, sc, err) 4065 }() 4066 } 4067 iter.i++ 4068 if iter.i < len(iter.page.Values()) { 4069 return nil 4070 } 4071 err = iter.page.NextWithContext(ctx) 4072 if err != nil { 4073 iter.i-- 4074 return err 4075 } 4076 iter.i = 0 4077 return nil 4078} 4079 4080// Next advances to the next value. If there was an error making 4081// the request the iterator does not advance and the error is returned. 4082// Deprecated: Use NextWithContext() instead. 4083func (iter *RecipientTransferDetailsListResultIterator) Next() error { 4084 return iter.NextWithContext(context.Background()) 4085} 4086 4087// NotDone returns true if the enumeration should be started or is not yet complete. 4088func (iter RecipientTransferDetailsListResultIterator) NotDone() bool { 4089 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4090} 4091 4092// Response returns the raw server response from the last page request. 4093func (iter RecipientTransferDetailsListResultIterator) Response() RecipientTransferDetailsListResult { 4094 return iter.page.Response() 4095} 4096 4097// Value returns the current value or a zero-initialized value if the 4098// iterator has advanced beyond the end of the collection. 4099func (iter RecipientTransferDetailsListResultIterator) Value() RecipientTransferDetails { 4100 if !iter.page.NotDone() { 4101 return RecipientTransferDetails{} 4102 } 4103 return iter.page.Values()[iter.i] 4104} 4105 4106// Creates a new instance of the RecipientTransferDetailsListResultIterator type. 4107func NewRecipientTransferDetailsListResultIterator(page RecipientTransferDetailsListResultPage) RecipientTransferDetailsListResultIterator { 4108 return RecipientTransferDetailsListResultIterator{page: page} 4109} 4110 4111// IsEmpty returns true if the ListResult contains no values. 4112func (rtdlr RecipientTransferDetailsListResult) IsEmpty() bool { 4113 return rtdlr.Value == nil || len(*rtdlr.Value) == 0 4114} 4115 4116// hasNextLink returns true if the NextLink is not empty. 4117func (rtdlr RecipientTransferDetailsListResult) hasNextLink() bool { 4118 return rtdlr.NextLink != nil && len(*rtdlr.NextLink) != 0 4119} 4120 4121// recipientTransferDetailsListResultPreparer prepares a request to retrieve the next set of results. 4122// It returns nil if no more results exist. 4123func (rtdlr RecipientTransferDetailsListResult) recipientTransferDetailsListResultPreparer(ctx context.Context) (*http.Request, error) { 4124 if !rtdlr.hasNextLink() { 4125 return nil, nil 4126 } 4127 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4128 autorest.AsJSON(), 4129 autorest.AsGet(), 4130 autorest.WithBaseURL(to.String(rtdlr.NextLink))) 4131} 4132 4133// RecipientTransferDetailsListResultPage contains a page of RecipientTransferDetails values. 4134type RecipientTransferDetailsListResultPage struct { 4135 fn func(context.Context, RecipientTransferDetailsListResult) (RecipientTransferDetailsListResult, error) 4136 rtdlr RecipientTransferDetailsListResult 4137} 4138 4139// NextWithContext advances to the next page of values. If there was an error making 4140// the request the page does not advance and the error is returned. 4141func (page *RecipientTransferDetailsListResultPage) NextWithContext(ctx context.Context) (err error) { 4142 if tracing.IsEnabled() { 4143 ctx = tracing.StartSpan(ctx, fqdn+"/RecipientTransferDetailsListResultPage.NextWithContext") 4144 defer func() { 4145 sc := -1 4146 if page.Response().Response.Response != nil { 4147 sc = page.Response().Response.Response.StatusCode 4148 } 4149 tracing.EndSpan(ctx, sc, err) 4150 }() 4151 } 4152 for { 4153 next, err := page.fn(ctx, page.rtdlr) 4154 if err != nil { 4155 return err 4156 } 4157 page.rtdlr = next 4158 if !next.hasNextLink() || !next.IsEmpty() { 4159 break 4160 } 4161 } 4162 return nil 4163} 4164 4165// Next advances to the next page of values. If there was an error making 4166// the request the page does not advance and the error is returned. 4167// Deprecated: Use NextWithContext() instead. 4168func (page *RecipientTransferDetailsListResultPage) Next() error { 4169 return page.NextWithContext(context.Background()) 4170} 4171 4172// NotDone returns true if the page enumeration should be started or is not yet complete. 4173func (page RecipientTransferDetailsListResultPage) NotDone() bool { 4174 return !page.rtdlr.IsEmpty() 4175} 4176 4177// Response returns the raw server response from the last page request. 4178func (page RecipientTransferDetailsListResultPage) Response() RecipientTransferDetailsListResult { 4179 return page.rtdlr 4180} 4181 4182// Values returns the slice of values for the current page or nil if there are no values. 4183func (page RecipientTransferDetailsListResultPage) Values() []RecipientTransferDetails { 4184 if page.rtdlr.IsEmpty() { 4185 return nil 4186 } 4187 return *page.rtdlr.Value 4188} 4189 4190// Creates a new instance of the RecipientTransferDetailsListResultPage type. 4191func NewRecipientTransferDetailsListResultPage(cur RecipientTransferDetailsListResult, getNextPage func(context.Context, RecipientTransferDetailsListResult) (RecipientTransferDetailsListResult, error)) RecipientTransferDetailsListResultPage { 4192 return RecipientTransferDetailsListResultPage{ 4193 fn: getNextPage, 4194 rtdlr: cur, 4195 } 4196} 4197 4198// RecipientTransferProperties transfer Details. 4199type RecipientTransferProperties struct { 4200 // CreationTime - READ-ONLY; Transfer creation time. 4201 CreationTime *date.Time `json:"creationTime,omitempty"` 4202 // ExpirationTime - READ-ONLY; Transfer expiration time. 4203 ExpirationTime *date.Time `json:"expirationTime,omitempty"` 4204 // AllowedProductType - READ-ONLY; Type of subscriptions that can be transferred. 4205 AllowedProductType *[]EligibleProductType `json:"allowedProductType,omitempty"` 4206 // TransferStatus - READ-ONLY; Overall transfer status. Possible values include: 'TransferStatusPending', 'TransferStatusInProgress', 'TransferStatusCompleted', 'TransferStatusCompletedWithErrors', 'TransferStatusFailed', 'TransferStatusCanceled', 'TransferStatusDeclined' 4207 TransferStatus TransferStatus `json:"transferStatus,omitempty"` 4208 // RecipientEmailID - READ-ONLY; Email Id of recipient of transfer. 4209 RecipientEmailID *string `json:"recipientEmailId,omitempty"` 4210 // InitiatorEmailID - READ-ONLY; Email Id of initiator of transfer. 4211 InitiatorEmailID *string `json:"initiatorEmailId,omitempty"` 4212 // CanceledBy - READ-ONLY; Email Id who user canceled the transfer. 4213 CanceledBy *string `json:"canceledBy,omitempty"` 4214 // LastModifiedTime - READ-ONLY; Transfer last modification time. 4215 LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` 4216 // DetailedTransferStatus - READ-ONLY; Detailed transfer status. 4217 DetailedTransferStatus *[]DetailedTransferStatus `json:"detailedTransferStatus,omitempty"` 4218} 4219 4220// MarshalJSON is the custom marshaler for RecipientTransferProperties. 4221func (rtp RecipientTransferProperties) MarshalJSON() ([]byte, error) { 4222 objectMap := make(map[string]interface{}) 4223 return json.Marshal(objectMap) 4224} 4225 4226// Reseller details about a reseller. 4227type Reseller struct { 4228 // ResellerID - READ-ONLY; The reseller id. 4229 ResellerID *string `json:"resellerId,omitempty"` 4230 // Description - READ-ONLY; A description of the reseller. 4231 Description *string `json:"description,omitempty"` 4232} 4233 4234// MarshalJSON is the custom marshaler for Reseller. 4235func (r Reseller) MarshalJSON() ([]byte, error) { 4236 objectMap := make(map[string]interface{}) 4237 return json.Marshal(objectMap) 4238} 4239 4240// Resource the Resource model definition. 4241type Resource struct { 4242 // ID - READ-ONLY; Resource Id. 4243 ID *string `json:"id,omitempty"` 4244 // Name - READ-ONLY; Resource name. 4245 Name *string `json:"name,omitempty"` 4246 // Type - READ-ONLY; Resource type. 4247 Type *string `json:"type,omitempty"` 4248} 4249 4250// MarshalJSON is the custom marshaler for Resource. 4251func (r Resource) MarshalJSON() ([]byte, error) { 4252 objectMap := make(map[string]interface{}) 4253 return json.Marshal(objectMap) 4254} 4255 4256// RoleAssignment a role assignment 4257type RoleAssignment struct { 4258 autorest.Response `json:"-"` 4259 // RoleAssignmentProperties - The role assignment the caller has 4260 *RoleAssignmentProperties `json:"properties,omitempty"` 4261 // ID - READ-ONLY; Resource Id. 4262 ID *string `json:"id,omitempty"` 4263 // Name - READ-ONLY; Resource name. 4264 Name *string `json:"name,omitempty"` 4265 // Type - READ-ONLY; Resource type. 4266 Type *string `json:"type,omitempty"` 4267} 4268 4269// MarshalJSON is the custom marshaler for RoleAssignment. 4270func (ra RoleAssignment) MarshalJSON() ([]byte, error) { 4271 objectMap := make(map[string]interface{}) 4272 if ra.RoleAssignmentProperties != nil { 4273 objectMap["properties"] = ra.RoleAssignmentProperties 4274 } 4275 return json.Marshal(objectMap) 4276} 4277 4278// UnmarshalJSON is the custom unmarshaler for RoleAssignment struct. 4279func (ra *RoleAssignment) UnmarshalJSON(body []byte) error { 4280 var m map[string]*json.RawMessage 4281 err := json.Unmarshal(body, &m) 4282 if err != nil { 4283 return err 4284 } 4285 for k, v := range m { 4286 switch k { 4287 case "properties": 4288 if v != nil { 4289 var roleAssignmentProperties RoleAssignmentProperties 4290 err = json.Unmarshal(*v, &roleAssignmentProperties) 4291 if err != nil { 4292 return err 4293 } 4294 ra.RoleAssignmentProperties = &roleAssignmentProperties 4295 } 4296 case "id": 4297 if v != nil { 4298 var ID string 4299 err = json.Unmarshal(*v, &ID) 4300 if err != nil { 4301 return err 4302 } 4303 ra.ID = &ID 4304 } 4305 case "name": 4306 if v != nil { 4307 var name string 4308 err = json.Unmarshal(*v, &name) 4309 if err != nil { 4310 return err 4311 } 4312 ra.Name = &name 4313 } 4314 case "type": 4315 if v != nil { 4316 var typeVar string 4317 err = json.Unmarshal(*v, &typeVar) 4318 if err != nil { 4319 return err 4320 } 4321 ra.Type = &typeVar 4322 } 4323 } 4324 } 4325 4326 return nil 4327} 4328 4329// RoleAssignmentListResult result of get list of role assignments 4330type RoleAssignmentListResult struct { 4331 autorest.Response `json:"-"` 4332 // Value - READ-ONLY; The list role assignments 4333 Value *[]RoleAssignment `json:"value,omitempty"` 4334} 4335 4336// MarshalJSON is the custom marshaler for RoleAssignmentListResult. 4337func (ralr RoleAssignmentListResult) MarshalJSON() ([]byte, error) { 4338 objectMap := make(map[string]interface{}) 4339 return json.Marshal(objectMap) 4340} 4341 4342// RoleAssignmentPayload the payload use to update role assignment on a scope 4343type RoleAssignmentPayload struct { 4344 // PrincipalID - The user's principal id that the role gets assigned to 4345 PrincipalID *string `json:"principalId,omitempty"` 4346 // BillingRoleDefinitionID - The role definition id 4347 BillingRoleDefinitionID *string `json:"billingRoleDefinitionId,omitempty"` 4348} 4349 4350// RoleAssignmentProperties the properties of the a role assignment. 4351type RoleAssignmentProperties struct { 4352 // CreatedOn - READ-ONLY; the date the role assignment is created 4353 CreatedOn *string `json:"createdOn,omitempty"` 4354 // CreatedByPrincipalTenantID - READ-ONLY; the creator's tenant Id 4355 CreatedByPrincipalTenantID *string `json:"createdByPrincipalTenantId,omitempty"` 4356 // CreatedByPrincipalID - READ-ONLY; the creator's principal Id 4357 CreatedByPrincipalID *string `json:"createdByPrincipalId,omitempty"` 4358 // Name - READ-ONLY; the name of the role assignment 4359 Name *string `json:"name,omitempty"` 4360 // PrincipalID - READ-ONLY; The user's principal id that the role gets assigned to 4361 PrincipalID *string `json:"principalId,omitempty"` 4362 // RoleDefinitionName - READ-ONLY; The role definition id 4363 RoleDefinitionName *string `json:"roleDefinitionName,omitempty"` 4364 // Scope - READ-ONLY; The scope the role get assigned to 4365 Scope *string `json:"scope,omitempty"` 4366} 4367 4368// MarshalJSON is the custom marshaler for RoleAssignmentProperties. 4369func (rap RoleAssignmentProperties) MarshalJSON() ([]byte, error) { 4370 objectMap := make(map[string]interface{}) 4371 return json.Marshal(objectMap) 4372} 4373 4374// RoleDefinition result of get role definition for a role. 4375type RoleDefinition struct { 4376 autorest.Response `json:"-"` 4377 // RoleDefinitionProperties - The role definition for a role. 4378 *RoleDefinitionProperties `json:"properties,omitempty"` 4379 // ID - READ-ONLY; Resource Id. 4380 ID *string `json:"id,omitempty"` 4381 // Name - READ-ONLY; Resource name. 4382 Name *string `json:"name,omitempty"` 4383 // Type - READ-ONLY; Resource type. 4384 Type *string `json:"type,omitempty"` 4385} 4386 4387// MarshalJSON is the custom marshaler for RoleDefinition. 4388func (rd RoleDefinition) MarshalJSON() ([]byte, error) { 4389 objectMap := make(map[string]interface{}) 4390 if rd.RoleDefinitionProperties != nil { 4391 objectMap["properties"] = rd.RoleDefinitionProperties 4392 } 4393 return json.Marshal(objectMap) 4394} 4395 4396// UnmarshalJSON is the custom unmarshaler for RoleDefinition struct. 4397func (rd *RoleDefinition) UnmarshalJSON(body []byte) error { 4398 var m map[string]*json.RawMessage 4399 err := json.Unmarshal(body, &m) 4400 if err != nil { 4401 return err 4402 } 4403 for k, v := range m { 4404 switch k { 4405 case "properties": 4406 if v != nil { 4407 var roleDefinitionProperties RoleDefinitionProperties 4408 err = json.Unmarshal(*v, &roleDefinitionProperties) 4409 if err != nil { 4410 return err 4411 } 4412 rd.RoleDefinitionProperties = &roleDefinitionProperties 4413 } 4414 case "id": 4415 if v != nil { 4416 var ID string 4417 err = json.Unmarshal(*v, &ID) 4418 if err != nil { 4419 return err 4420 } 4421 rd.ID = &ID 4422 } 4423 case "name": 4424 if v != nil { 4425 var name string 4426 err = json.Unmarshal(*v, &name) 4427 if err != nil { 4428 return err 4429 } 4430 rd.Name = &name 4431 } 4432 case "type": 4433 if v != nil { 4434 var typeVar string 4435 err = json.Unmarshal(*v, &typeVar) 4436 if err != nil { 4437 return err 4438 } 4439 rd.Type = &typeVar 4440 } 4441 } 4442 } 4443 4444 return nil 4445} 4446 4447// RoleDefinitionListResult list the role definitions. 4448type RoleDefinitionListResult struct { 4449 autorest.Response `json:"-"` 4450 // Value - READ-ONLY; The list of role definitions. 4451 Value *[]RoleDefinition `json:"value,omitempty"` 4452} 4453 4454// MarshalJSON is the custom marshaler for RoleDefinitionListResult. 4455func (rdlr RoleDefinitionListResult) MarshalJSON() ([]byte, error) { 4456 objectMap := make(map[string]interface{}) 4457 return json.Marshal(objectMap) 4458} 4459 4460// RoleDefinitionProperties the properties of the a role definition. 4461type RoleDefinitionProperties struct { 4462 // Description - READ-ONLY; The role description 4463 Description *string `json:"description,omitempty"` 4464 // PermissionsListResult - The billingPermissions the role has 4465 *PermissionsListResult `json:"permissions,omitempty"` 4466 // RoleName - READ-ONLY; The name of the role 4467 RoleName *string `json:"roleName,omitempty"` 4468} 4469 4470// MarshalJSON is the custom marshaler for RoleDefinitionProperties. 4471func (rdp RoleDefinitionProperties) MarshalJSON() ([]byte, error) { 4472 objectMap := make(map[string]interface{}) 4473 if rdp.PermissionsListResult != nil { 4474 objectMap["permissions"] = rdp.PermissionsListResult 4475 } 4476 return json.Marshal(objectMap) 4477} 4478 4479// UnmarshalJSON is the custom unmarshaler for RoleDefinitionProperties struct. 4480func (rdp *RoleDefinitionProperties) UnmarshalJSON(body []byte) error { 4481 var m map[string]*json.RawMessage 4482 err := json.Unmarshal(body, &m) 4483 if err != nil { 4484 return err 4485 } 4486 for k, v := range m { 4487 switch k { 4488 case "description": 4489 if v != nil { 4490 var description string 4491 err = json.Unmarshal(*v, &description) 4492 if err != nil { 4493 return err 4494 } 4495 rdp.Description = &description 4496 } 4497 case "permissions": 4498 if v != nil { 4499 var permissionsListResult PermissionsListResult 4500 err = json.Unmarshal(*v, &permissionsListResult) 4501 if err != nil { 4502 return err 4503 } 4504 rdp.PermissionsListResult = &permissionsListResult 4505 } 4506 case "roleName": 4507 if v != nil { 4508 var roleName string 4509 err = json.Unmarshal(*v, &roleName) 4510 if err != nil { 4511 return err 4512 } 4513 rdp.RoleName = &roleName 4514 } 4515 } 4516 } 4517 4518 return nil 4519} 4520 4521// SubscriptionProperties the usage context properties. 4522type SubscriptionProperties struct { 4523 // DisplayName - READ-ONLY; display name. 4524 DisplayName *string `json:"displayName,omitempty"` 4525 // SubscriptionID - READ-ONLY; Subscription Id. 4526 SubscriptionID *uuid.UUID `json:"subscriptionId,omitempty"` 4527 // SubscriptionBillingStatus - Subscription billing status. Possible values include: 'SubscriptionStatusTypeActive', 'SubscriptionStatusTypeInactive', 'SubscriptionStatusTypeAbandoned', 'SubscriptionStatusTypeDeleted', 'SubscriptionStatusTypeWarning' 4528 SubscriptionBillingStatus SubscriptionStatusType `json:"subscriptionBillingStatus,omitempty"` 4529 // LastMonthCharges - READ-ONLY; Last month charges. 4530 LastMonthCharges *Amount `json:"lastMonthCharges,omitempty"` 4531 // MonthToDateCharges - READ-ONLY; Month to date charges. 4532 MonthToDateCharges *Amount `json:"monthToDateCharges,omitempty"` 4533 // BillingProfileID - READ-ONLY; Billing Profile id to which this product belongs. 4534 BillingProfileID *string `json:"billingProfileId,omitempty"` 4535 // BillingProfileName - READ-ONLY; Billing Profile name to which this product belongs. 4536 BillingProfileName *string `json:"billingProfileName,omitempty"` 4537 // CustomerID - READ-ONLY; Customer id to which this product belongs. 4538 CustomerID *string `json:"customerId,omitempty"` 4539 // CustomerDisplayName - READ-ONLY; Display name of customer to which this product belongs. 4540 CustomerDisplayName *string `json:"customerDisplayName,omitempty"` 4541 // InvoiceSectionID - READ-ONLY; Invoice section id to which this product belongs. 4542 InvoiceSectionID *string `json:"invoiceSectionId,omitempty"` 4543 // InvoiceSectionName - READ-ONLY; Invoice section name to which this product belongs. 4544 InvoiceSectionName *string `json:"invoiceSectionName,omitempty"` 4545 // SkuID - The sku id. 4546 SkuID *string `json:"skuId,omitempty"` 4547 // SkuDescription - READ-ONLY; The sku description. 4548 SkuDescription *string `json:"skuDescription,omitempty"` 4549 // Reseller - READ-ONLY; Reseller for this subscription. 4550 Reseller *Reseller `json:"reseller,omitempty"` 4551} 4552 4553// MarshalJSON is the custom marshaler for SubscriptionProperties. 4554func (sp SubscriptionProperties) MarshalJSON() ([]byte, error) { 4555 objectMap := make(map[string]interface{}) 4556 if sp.SubscriptionBillingStatus != "" { 4557 objectMap["subscriptionBillingStatus"] = sp.SubscriptionBillingStatus 4558 } 4559 if sp.SkuID != nil { 4560 objectMap["skuId"] = sp.SkuID 4561 } 4562 return json.Marshal(objectMap) 4563} 4564 4565// SubscriptionsListResult result of listing billing subscriptions summary. 4566type SubscriptionsListResult struct { 4567 autorest.Response `json:"-"` 4568 // Value - READ-ONLY; The list of billing subscriptions summary. 4569 Value *[]SubscriptionSummary `json:"value,omitempty"` 4570 // NextLink - READ-ONLY; The link (url) to the next page of results. 4571 NextLink *string `json:"nextLink,omitempty"` 4572} 4573 4574// MarshalJSON is the custom marshaler for SubscriptionsListResult. 4575func (slr SubscriptionsListResult) MarshalJSON() ([]byte, error) { 4576 objectMap := make(map[string]interface{}) 4577 return json.Marshal(objectMap) 4578} 4579 4580// SubscriptionsListResultIterator provides access to a complete listing of SubscriptionSummary values. 4581type SubscriptionsListResultIterator struct { 4582 i int 4583 page SubscriptionsListResultPage 4584} 4585 4586// NextWithContext advances to the next value. If there was an error making 4587// the request the iterator does not advance and the error is returned. 4588func (iter *SubscriptionsListResultIterator) NextWithContext(ctx context.Context) (err error) { 4589 if tracing.IsEnabled() { 4590 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsListResultIterator.NextWithContext") 4591 defer func() { 4592 sc := -1 4593 if iter.Response().Response.Response != nil { 4594 sc = iter.Response().Response.Response.StatusCode 4595 } 4596 tracing.EndSpan(ctx, sc, err) 4597 }() 4598 } 4599 iter.i++ 4600 if iter.i < len(iter.page.Values()) { 4601 return nil 4602 } 4603 err = iter.page.NextWithContext(ctx) 4604 if err != nil { 4605 iter.i-- 4606 return err 4607 } 4608 iter.i = 0 4609 return nil 4610} 4611 4612// Next advances to the next value. If there was an error making 4613// the request the iterator does not advance and the error is returned. 4614// Deprecated: Use NextWithContext() instead. 4615func (iter *SubscriptionsListResultIterator) Next() error { 4616 return iter.NextWithContext(context.Background()) 4617} 4618 4619// NotDone returns true if the enumeration should be started or is not yet complete. 4620func (iter SubscriptionsListResultIterator) NotDone() bool { 4621 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4622} 4623 4624// Response returns the raw server response from the last page request. 4625func (iter SubscriptionsListResultIterator) Response() SubscriptionsListResult { 4626 return iter.page.Response() 4627} 4628 4629// Value returns the current value or a zero-initialized value if the 4630// iterator has advanced beyond the end of the collection. 4631func (iter SubscriptionsListResultIterator) Value() SubscriptionSummary { 4632 if !iter.page.NotDone() { 4633 return SubscriptionSummary{} 4634 } 4635 return iter.page.Values()[iter.i] 4636} 4637 4638// Creates a new instance of the SubscriptionsListResultIterator type. 4639func NewSubscriptionsListResultIterator(page SubscriptionsListResultPage) SubscriptionsListResultIterator { 4640 return SubscriptionsListResultIterator{page: page} 4641} 4642 4643// IsEmpty returns true if the ListResult contains no values. 4644func (slr SubscriptionsListResult) IsEmpty() bool { 4645 return slr.Value == nil || len(*slr.Value) == 0 4646} 4647 4648// hasNextLink returns true if the NextLink is not empty. 4649func (slr SubscriptionsListResult) hasNextLink() bool { 4650 return slr.NextLink != nil && len(*slr.NextLink) != 0 4651} 4652 4653// subscriptionsListResultPreparer prepares a request to retrieve the next set of results. 4654// It returns nil if no more results exist. 4655func (slr SubscriptionsListResult) subscriptionsListResultPreparer(ctx context.Context) (*http.Request, error) { 4656 if !slr.hasNextLink() { 4657 return nil, nil 4658 } 4659 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4660 autorest.AsJSON(), 4661 autorest.AsGet(), 4662 autorest.WithBaseURL(to.String(slr.NextLink))) 4663} 4664 4665// SubscriptionsListResultPage contains a page of SubscriptionSummary values. 4666type SubscriptionsListResultPage struct { 4667 fn func(context.Context, SubscriptionsListResult) (SubscriptionsListResult, error) 4668 slr SubscriptionsListResult 4669} 4670 4671// NextWithContext advances to the next page of values. If there was an error making 4672// the request the page does not advance and the error is returned. 4673func (page *SubscriptionsListResultPage) NextWithContext(ctx context.Context) (err error) { 4674 if tracing.IsEnabled() { 4675 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsListResultPage.NextWithContext") 4676 defer func() { 4677 sc := -1 4678 if page.Response().Response.Response != nil { 4679 sc = page.Response().Response.Response.StatusCode 4680 } 4681 tracing.EndSpan(ctx, sc, err) 4682 }() 4683 } 4684 for { 4685 next, err := page.fn(ctx, page.slr) 4686 if err != nil { 4687 return err 4688 } 4689 page.slr = next 4690 if !next.hasNextLink() || !next.IsEmpty() { 4691 break 4692 } 4693 } 4694 return nil 4695} 4696 4697// Next advances to the next page of values. If there was an error making 4698// the request the page does not advance and the error is returned. 4699// Deprecated: Use NextWithContext() instead. 4700func (page *SubscriptionsListResultPage) Next() error { 4701 return page.NextWithContext(context.Background()) 4702} 4703 4704// NotDone returns true if the page enumeration should be started or is not yet complete. 4705func (page SubscriptionsListResultPage) NotDone() bool { 4706 return !page.slr.IsEmpty() 4707} 4708 4709// Response returns the raw server response from the last page request. 4710func (page SubscriptionsListResultPage) Response() SubscriptionsListResult { 4711 return page.slr 4712} 4713 4714// Values returns the slice of values for the current page or nil if there are no values. 4715func (page SubscriptionsListResultPage) Values() []SubscriptionSummary { 4716 if page.slr.IsEmpty() { 4717 return nil 4718 } 4719 return *page.slr.Value 4720} 4721 4722// Creates a new instance of the SubscriptionsListResultPage type. 4723func NewSubscriptionsListResultPage(cur SubscriptionsListResult, getNextPage func(context.Context, SubscriptionsListResult) (SubscriptionsListResult, error)) SubscriptionsListResultPage { 4724 return SubscriptionsListResultPage{ 4725 fn: getNextPage, 4726 slr: cur, 4727 } 4728} 4729 4730// SubscriptionsTransferFuture an abstraction for monitoring and retrieving the results of a long-running 4731// operation. 4732type SubscriptionsTransferFuture struct { 4733 azure.FutureAPI 4734 // Result returns the result of the asynchronous operation. 4735 // If the operation has not completed it will return an error. 4736 Result func(SubscriptionsClient) (TransferBillingSubscriptionResult, error) 4737} 4738 4739// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4740func (future *SubscriptionsTransferFuture) UnmarshalJSON(body []byte) error { 4741 var azFuture azure.Future 4742 if err := json.Unmarshal(body, &azFuture); err != nil { 4743 return err 4744 } 4745 future.FutureAPI = &azFuture 4746 future.Result = future.result 4747 return nil 4748} 4749 4750// result is the default implementation for SubscriptionsTransferFuture.Result. 4751func (future *SubscriptionsTransferFuture) result(client SubscriptionsClient) (tbsr TransferBillingSubscriptionResult, err error) { 4752 var done bool 4753 done, err = future.DoneWithContext(context.Background(), client) 4754 if err != nil { 4755 err = autorest.NewErrorWithError(err, "billing.SubscriptionsTransferFuture", "Result", future.Response(), "Polling failure") 4756 return 4757 } 4758 if !done { 4759 tbsr.Response.Response = future.Response() 4760 err = azure.NewAsyncOpIncompleteError("billing.SubscriptionsTransferFuture") 4761 return 4762 } 4763 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4764 if tbsr.Response.Response, err = future.GetResult(sender); err == nil && tbsr.Response.Response.StatusCode != http.StatusNoContent { 4765 tbsr, err = client.TransferResponder(tbsr.Response.Response) 4766 if err != nil { 4767 err = autorest.NewErrorWithError(err, "billing.SubscriptionsTransferFuture", "Result", tbsr.Response.Response, "Failure responding to request") 4768 } 4769 } 4770 return 4771} 4772 4773// SubscriptionSummary a billing Subscription summary resource. 4774type SubscriptionSummary struct { 4775 autorest.Response `json:"-"` 4776 *SubscriptionProperties `json:"properties,omitempty"` 4777 // ID - READ-ONLY; Resource Id. 4778 ID *string `json:"id,omitempty"` 4779 // Name - READ-ONLY; Resource name. 4780 Name *string `json:"name,omitempty"` 4781 // Type - READ-ONLY; Resource type. 4782 Type *string `json:"type,omitempty"` 4783} 4784 4785// MarshalJSON is the custom marshaler for SubscriptionSummary. 4786func (ss SubscriptionSummary) MarshalJSON() ([]byte, error) { 4787 objectMap := make(map[string]interface{}) 4788 if ss.SubscriptionProperties != nil { 4789 objectMap["properties"] = ss.SubscriptionProperties 4790 } 4791 return json.Marshal(objectMap) 4792} 4793 4794// UnmarshalJSON is the custom unmarshaler for SubscriptionSummary struct. 4795func (ss *SubscriptionSummary) UnmarshalJSON(body []byte) error { 4796 var m map[string]*json.RawMessage 4797 err := json.Unmarshal(body, &m) 4798 if err != nil { 4799 return err 4800 } 4801 for k, v := range m { 4802 switch k { 4803 case "properties": 4804 if v != nil { 4805 var subscriptionProperties SubscriptionProperties 4806 err = json.Unmarshal(*v, &subscriptionProperties) 4807 if err != nil { 4808 return err 4809 } 4810 ss.SubscriptionProperties = &subscriptionProperties 4811 } 4812 case "id": 4813 if v != nil { 4814 var ID string 4815 err = json.Unmarshal(*v, &ID) 4816 if err != nil { 4817 return err 4818 } 4819 ss.ID = &ID 4820 } 4821 case "name": 4822 if v != nil { 4823 var name string 4824 err = json.Unmarshal(*v, &name) 4825 if err != nil { 4826 return err 4827 } 4828 ss.Name = &name 4829 } 4830 case "type": 4831 if v != nil { 4832 var typeVar string 4833 err = json.Unmarshal(*v, &typeVar) 4834 if err != nil { 4835 return err 4836 } 4837 ss.Type = &typeVar 4838 } 4839 } 4840 } 4841 4842 return nil 4843} 4844 4845// TransactionsListResult result of listing reservation transactions summary. 4846type TransactionsListResult struct { 4847 autorest.Response `json:"-"` 4848 // Value - READ-ONLY; The list of reservation transactions summary. 4849 Value *[]TransactionsSummary `json:"value,omitempty"` 4850 // NextLink - READ-ONLY; The link (url) to the next page of results. 4851 NextLink *string `json:"nextLink,omitempty"` 4852} 4853 4854// MarshalJSON is the custom marshaler for TransactionsListResult. 4855func (tlr TransactionsListResult) MarshalJSON() ([]byte, error) { 4856 objectMap := make(map[string]interface{}) 4857 return json.Marshal(objectMap) 4858} 4859 4860// TransactionsListResultIterator provides access to a complete listing of TransactionsSummary values. 4861type TransactionsListResultIterator struct { 4862 i int 4863 page TransactionsListResultPage 4864} 4865 4866// NextWithContext advances to the next value. If there was an error making 4867// the request the iterator does not advance and the error is returned. 4868func (iter *TransactionsListResultIterator) NextWithContext(ctx context.Context) (err error) { 4869 if tracing.IsEnabled() { 4870 ctx = tracing.StartSpan(ctx, fqdn+"/TransactionsListResultIterator.NextWithContext") 4871 defer func() { 4872 sc := -1 4873 if iter.Response().Response.Response != nil { 4874 sc = iter.Response().Response.Response.StatusCode 4875 } 4876 tracing.EndSpan(ctx, sc, err) 4877 }() 4878 } 4879 iter.i++ 4880 if iter.i < len(iter.page.Values()) { 4881 return nil 4882 } 4883 err = iter.page.NextWithContext(ctx) 4884 if err != nil { 4885 iter.i-- 4886 return err 4887 } 4888 iter.i = 0 4889 return nil 4890} 4891 4892// Next advances to the next value. If there was an error making 4893// the request the iterator does not advance and the error is returned. 4894// Deprecated: Use NextWithContext() instead. 4895func (iter *TransactionsListResultIterator) Next() error { 4896 return iter.NextWithContext(context.Background()) 4897} 4898 4899// NotDone returns true if the enumeration should be started or is not yet complete. 4900func (iter TransactionsListResultIterator) NotDone() bool { 4901 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4902} 4903 4904// Response returns the raw server response from the last page request. 4905func (iter TransactionsListResultIterator) Response() TransactionsListResult { 4906 return iter.page.Response() 4907} 4908 4909// Value returns the current value or a zero-initialized value if the 4910// iterator has advanced beyond the end of the collection. 4911func (iter TransactionsListResultIterator) Value() TransactionsSummary { 4912 if !iter.page.NotDone() { 4913 return TransactionsSummary{} 4914 } 4915 return iter.page.Values()[iter.i] 4916} 4917 4918// Creates a new instance of the TransactionsListResultIterator type. 4919func NewTransactionsListResultIterator(page TransactionsListResultPage) TransactionsListResultIterator { 4920 return TransactionsListResultIterator{page: page} 4921} 4922 4923// IsEmpty returns true if the ListResult contains no values. 4924func (tlr TransactionsListResult) IsEmpty() bool { 4925 return tlr.Value == nil || len(*tlr.Value) == 0 4926} 4927 4928// hasNextLink returns true if the NextLink is not empty. 4929func (tlr TransactionsListResult) hasNextLink() bool { 4930 return tlr.NextLink != nil && len(*tlr.NextLink) != 0 4931} 4932 4933// transactionsListResultPreparer prepares a request to retrieve the next set of results. 4934// It returns nil if no more results exist. 4935func (tlr TransactionsListResult) transactionsListResultPreparer(ctx context.Context) (*http.Request, error) { 4936 if !tlr.hasNextLink() { 4937 return nil, nil 4938 } 4939 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4940 autorest.AsJSON(), 4941 autorest.AsGet(), 4942 autorest.WithBaseURL(to.String(tlr.NextLink))) 4943} 4944 4945// TransactionsListResultPage contains a page of TransactionsSummary values. 4946type TransactionsListResultPage struct { 4947 fn func(context.Context, TransactionsListResult) (TransactionsListResult, error) 4948 tlr TransactionsListResult 4949} 4950 4951// NextWithContext advances to the next page of values. If there was an error making 4952// the request the page does not advance and the error is returned. 4953func (page *TransactionsListResultPage) NextWithContext(ctx context.Context) (err error) { 4954 if tracing.IsEnabled() { 4955 ctx = tracing.StartSpan(ctx, fqdn+"/TransactionsListResultPage.NextWithContext") 4956 defer func() { 4957 sc := -1 4958 if page.Response().Response.Response != nil { 4959 sc = page.Response().Response.Response.StatusCode 4960 } 4961 tracing.EndSpan(ctx, sc, err) 4962 }() 4963 } 4964 for { 4965 next, err := page.fn(ctx, page.tlr) 4966 if err != nil { 4967 return err 4968 } 4969 page.tlr = next 4970 if !next.hasNextLink() || !next.IsEmpty() { 4971 break 4972 } 4973 } 4974 return nil 4975} 4976 4977// Next advances to the next page of values. If there was an error making 4978// the request the page does not advance and the error is returned. 4979// Deprecated: Use NextWithContext() instead. 4980func (page *TransactionsListResultPage) Next() error { 4981 return page.NextWithContext(context.Background()) 4982} 4983 4984// NotDone returns true if the page enumeration should be started or is not yet complete. 4985func (page TransactionsListResultPage) NotDone() bool { 4986 return !page.tlr.IsEmpty() 4987} 4988 4989// Response returns the raw server response from the last page request. 4990func (page TransactionsListResultPage) Response() TransactionsListResult { 4991 return page.tlr 4992} 4993 4994// Values returns the slice of values for the current page or nil if there are no values. 4995func (page TransactionsListResultPage) Values() []TransactionsSummary { 4996 if page.tlr.IsEmpty() { 4997 return nil 4998 } 4999 return *page.tlr.Value 5000} 5001 5002// Creates a new instance of the TransactionsListResultPage type. 5003func NewTransactionsListResultPage(cur TransactionsListResult, getNextPage func(context.Context, TransactionsListResult) (TransactionsListResult, error)) TransactionsListResultPage { 5004 return TransactionsListResultPage{ 5005 fn: getNextPage, 5006 tlr: cur, 5007 } 5008} 5009 5010// TransactionsSummary a reservation transaction summary resource. 5011type TransactionsSummary struct { 5012 *TransactionsSummaryProperties `json:"properties,omitempty"` 5013 // ID - READ-ONLY; Resource Id. 5014 ID *string `json:"id,omitempty"` 5015 // Name - READ-ONLY; Resource name. 5016 Name *string `json:"name,omitempty"` 5017 // Type - READ-ONLY; Resource type. 5018 Type *string `json:"type,omitempty"` 5019} 5020 5021// MarshalJSON is the custom marshaler for TransactionsSummary. 5022func (ts TransactionsSummary) MarshalJSON() ([]byte, error) { 5023 objectMap := make(map[string]interface{}) 5024 if ts.TransactionsSummaryProperties != nil { 5025 objectMap["properties"] = ts.TransactionsSummaryProperties 5026 } 5027 return json.Marshal(objectMap) 5028} 5029 5030// UnmarshalJSON is the custom unmarshaler for TransactionsSummary struct. 5031func (ts *TransactionsSummary) UnmarshalJSON(body []byte) error { 5032 var m map[string]*json.RawMessage 5033 err := json.Unmarshal(body, &m) 5034 if err != nil { 5035 return err 5036 } 5037 for k, v := range m { 5038 switch k { 5039 case "properties": 5040 if v != nil { 5041 var transactionsSummaryProperties TransactionsSummaryProperties 5042 err = json.Unmarshal(*v, &transactionsSummaryProperties) 5043 if err != nil { 5044 return err 5045 } 5046 ts.TransactionsSummaryProperties = &transactionsSummaryProperties 5047 } 5048 case "id": 5049 if v != nil { 5050 var ID string 5051 err = json.Unmarshal(*v, &ID) 5052 if err != nil { 5053 return err 5054 } 5055 ts.ID = &ID 5056 } 5057 case "name": 5058 if v != nil { 5059 var name string 5060 err = json.Unmarshal(*v, &name) 5061 if err != nil { 5062 return err 5063 } 5064 ts.Name = &name 5065 } 5066 case "type": 5067 if v != nil { 5068 var typeVar string 5069 err = json.Unmarshal(*v, &typeVar) 5070 if err != nil { 5071 return err 5072 } 5073 ts.Type = &typeVar 5074 } 5075 } 5076 } 5077 5078 return nil 5079} 5080 5081// TransactionsSummaryProperties the properties of the reservation transaction summary. 5082type TransactionsSummaryProperties struct { 5083 // Kind - The kind of transaction. Choices are all and reservation. Possible values include: 'All', 'Reservation' 5084 Kind TransactionTypeKind `json:"kind,omitempty"` 5085 // Date - READ-ONLY; The date of reservation transaction. 5086 Date *date.Time `json:"date,omitempty"` 5087 // Invoice - READ-ONLY; Invoice number or 'pending' if not invoiced. 5088 Invoice *string `json:"invoice,omitempty"` 5089 // OrderID - READ-ONLY; The reservation order id. 5090 OrderID *string `json:"orderId,omitempty"` 5091 // OrderName - READ-ONLY; The reservation order name. 5092 OrderName *string `json:"orderName,omitempty"` 5093 // ProductFamily - READ-ONLY; The product family. 5094 ProductFamily *string `json:"productFamily,omitempty"` 5095 // ProductTypeID - READ-ONLY; The product type id. 5096 ProductTypeID *string `json:"productTypeId,omitempty"` 5097 // ProductType - READ-ONLY; The type of product. 5098 ProductType *string `json:"productType,omitempty"` 5099 // ProductDescription - READ-ONLY; Product description. 5100 ProductDescription *string `json:"productDescription,omitempty"` 5101 // TransactionType - Transaction types. Possible values include: 'Purchase', 'UsageCharge' 5102 TransactionType ReservationType `json:"transactionType,omitempty"` 5103 // TransactionAmount - READ-ONLY; Last charge associated with the purchase. 5104 TransactionAmount *Amount `json:"transactionAmount,omitempty"` 5105 // Quantity - READ-ONLY; Purchase quantity. 5106 Quantity *int32 `json:"quantity,omitempty"` 5107 // CustomerID - READ-ONLY; Customer id to which this product belongs. 5108 CustomerID *string `json:"customerId,omitempty"` 5109 // CustomerDisplayName - READ-ONLY; Display name of customer to which this product belongs. 5110 CustomerDisplayName *string `json:"customerDisplayName,omitempty"` 5111 // InvoiceSectionID - READ-ONLY; Invoice section id to which this product belongs. 5112 InvoiceSectionID *string `json:"invoiceSectionId,omitempty"` 5113 // InvoiceSectionName - READ-ONLY; Invoice section name to which this product belongs. 5114 InvoiceSectionName *string `json:"invoiceSectionName,omitempty"` 5115 // BillingProfileID - READ-ONLY; Billing Profile id to which this product belongs. 5116 BillingProfileID *string `json:"billingProfileId,omitempty"` 5117 // BillingProfileName - READ-ONLY; Billing Profile name to which this product belongs. 5118 BillingProfileName *string `json:"billingProfileName,omitempty"` 5119 // SubscriptionID - READ-ONLY; The subscription id. 5120 SubscriptionID *string `json:"subscriptionId,omitempty"` 5121 // SubscriptionName - READ-ONLY; The subscription name. 5122 SubscriptionName *string `json:"subscriptionName,omitempty"` 5123} 5124 5125// MarshalJSON is the custom marshaler for TransactionsSummaryProperties. 5126func (tsp TransactionsSummaryProperties) MarshalJSON() ([]byte, error) { 5127 objectMap := make(map[string]interface{}) 5128 if tsp.Kind != "" { 5129 objectMap["kind"] = tsp.Kind 5130 } 5131 if tsp.TransactionType != "" { 5132 objectMap["transactionType"] = tsp.TransactionType 5133 } 5134 return json.Marshal(objectMap) 5135} 5136 5137// TransferBillingSubscriptionRequest request parameters to transfer billing subscription. 5138type TransferBillingSubscriptionRequest struct { 5139 // TransferBillingSubscriptionRequestProperties - Request parameters to transfer billing subscription. 5140 *TransferBillingSubscriptionRequestProperties `json:"properties,omitempty"` 5141} 5142 5143// MarshalJSON is the custom marshaler for TransferBillingSubscriptionRequest. 5144func (tbsr TransferBillingSubscriptionRequest) MarshalJSON() ([]byte, error) { 5145 objectMap := make(map[string]interface{}) 5146 if tbsr.TransferBillingSubscriptionRequestProperties != nil { 5147 objectMap["properties"] = tbsr.TransferBillingSubscriptionRequestProperties 5148 } 5149 return json.Marshal(objectMap) 5150} 5151 5152// UnmarshalJSON is the custom unmarshaler for TransferBillingSubscriptionRequest struct. 5153func (tbsr *TransferBillingSubscriptionRequest) UnmarshalJSON(body []byte) error { 5154 var m map[string]*json.RawMessage 5155 err := json.Unmarshal(body, &m) 5156 if err != nil { 5157 return err 5158 } 5159 for k, v := range m { 5160 switch k { 5161 case "properties": 5162 if v != nil { 5163 var transferBillingSubscriptionRequestProperties TransferBillingSubscriptionRequestProperties 5164 err = json.Unmarshal(*v, &transferBillingSubscriptionRequestProperties) 5165 if err != nil { 5166 return err 5167 } 5168 tbsr.TransferBillingSubscriptionRequestProperties = &transferBillingSubscriptionRequestProperties 5169 } 5170 } 5171 } 5172 5173 return nil 5174} 5175 5176// TransferBillingSubscriptionRequestProperties request parameters to transfer billing subscription. 5177type TransferBillingSubscriptionRequestProperties struct { 5178 // DestinationInvoiceSectionID - The destination invoice section id. 5179 DestinationInvoiceSectionID *string `json:"destinationInvoiceSectionId,omitempty"` 5180 // DestinationBillingProfileID - The destination billing profile id. 5181 DestinationBillingProfileID *string `json:"destinationBillingProfileId,omitempty"` 5182} 5183 5184// TransferBillingSubscriptionResult request parameters to transfer billing subscription. 5185type TransferBillingSubscriptionResult struct { 5186 autorest.Response `json:"-"` 5187 // TransferBillingSubscriptionResultProperties - Request parameters to transfer billing subscription. 5188 *TransferBillingSubscriptionResultProperties `json:"properties,omitempty"` 5189} 5190 5191// MarshalJSON is the custom marshaler for TransferBillingSubscriptionResult. 5192func (tbsr TransferBillingSubscriptionResult) MarshalJSON() ([]byte, error) { 5193 objectMap := make(map[string]interface{}) 5194 if tbsr.TransferBillingSubscriptionResultProperties != nil { 5195 objectMap["properties"] = tbsr.TransferBillingSubscriptionResultProperties 5196 } 5197 return json.Marshal(objectMap) 5198} 5199 5200// UnmarshalJSON is the custom unmarshaler for TransferBillingSubscriptionResult struct. 5201func (tbsr *TransferBillingSubscriptionResult) UnmarshalJSON(body []byte) error { 5202 var m map[string]*json.RawMessage 5203 err := json.Unmarshal(body, &m) 5204 if err != nil { 5205 return err 5206 } 5207 for k, v := range m { 5208 switch k { 5209 case "properties": 5210 if v != nil { 5211 var transferBillingSubscriptionResultProperties TransferBillingSubscriptionResultProperties 5212 err = json.Unmarshal(*v, &transferBillingSubscriptionResultProperties) 5213 if err != nil { 5214 return err 5215 } 5216 tbsr.TransferBillingSubscriptionResultProperties = &transferBillingSubscriptionResultProperties 5217 } 5218 } 5219 } 5220 5221 return nil 5222} 5223 5224// TransferBillingSubscriptionResultProperties transfer billing subscription result properties. 5225type TransferBillingSubscriptionResultProperties struct { 5226 // BillingSubscriptionName - The destination billing subscription id. 5227 BillingSubscriptionName *string `json:"billingSubscriptionName,omitempty"` 5228} 5229 5230// TransferDetails details of the transfer. 5231type TransferDetails struct { 5232 autorest.Response `json:"-"` 5233 // TransferProperties - Details of the transfer. 5234 *TransferProperties `json:"properties,omitempty"` 5235} 5236 5237// MarshalJSON is the custom marshaler for TransferDetails. 5238func (td TransferDetails) MarshalJSON() ([]byte, error) { 5239 objectMap := make(map[string]interface{}) 5240 if td.TransferProperties != nil { 5241 objectMap["properties"] = td.TransferProperties 5242 } 5243 return json.Marshal(objectMap) 5244} 5245 5246// UnmarshalJSON is the custom unmarshaler for TransferDetails struct. 5247func (td *TransferDetails) UnmarshalJSON(body []byte) error { 5248 var m map[string]*json.RawMessage 5249 err := json.Unmarshal(body, &m) 5250 if err != nil { 5251 return err 5252 } 5253 for k, v := range m { 5254 switch k { 5255 case "properties": 5256 if v != nil { 5257 var transferProperties TransferProperties 5258 err = json.Unmarshal(*v, &transferProperties) 5259 if err != nil { 5260 return err 5261 } 5262 td.TransferProperties = &transferProperties 5263 } 5264 } 5265 } 5266 5267 return nil 5268} 5269 5270// TransferDetailsListResult result of listing details of the transfer initiated by caller. 5271type TransferDetailsListResult struct { 5272 autorest.Response `json:"-"` 5273 // Value - READ-ONLY; The list of transfers initiated by caller. 5274 Value *[]TransferDetails `json:"value,omitempty"` 5275 // NextLink - READ-ONLY; The link (url) to the next page of results. 5276 NextLink *string `json:"nextLink,omitempty"` 5277} 5278 5279// MarshalJSON is the custom marshaler for TransferDetailsListResult. 5280func (tdlr TransferDetailsListResult) MarshalJSON() ([]byte, error) { 5281 objectMap := make(map[string]interface{}) 5282 return json.Marshal(objectMap) 5283} 5284 5285// TransferDetailsListResultIterator provides access to a complete listing of TransferDetails values. 5286type TransferDetailsListResultIterator struct { 5287 i int 5288 page TransferDetailsListResultPage 5289} 5290 5291// NextWithContext advances to the next value. If there was an error making 5292// the request the iterator does not advance and the error is returned. 5293func (iter *TransferDetailsListResultIterator) NextWithContext(ctx context.Context) (err error) { 5294 if tracing.IsEnabled() { 5295 ctx = tracing.StartSpan(ctx, fqdn+"/TransferDetailsListResultIterator.NextWithContext") 5296 defer func() { 5297 sc := -1 5298 if iter.Response().Response.Response != nil { 5299 sc = iter.Response().Response.Response.StatusCode 5300 } 5301 tracing.EndSpan(ctx, sc, err) 5302 }() 5303 } 5304 iter.i++ 5305 if iter.i < len(iter.page.Values()) { 5306 return nil 5307 } 5308 err = iter.page.NextWithContext(ctx) 5309 if err != nil { 5310 iter.i-- 5311 return err 5312 } 5313 iter.i = 0 5314 return nil 5315} 5316 5317// Next advances to the next value. If there was an error making 5318// the request the iterator does not advance and the error is returned. 5319// Deprecated: Use NextWithContext() instead. 5320func (iter *TransferDetailsListResultIterator) Next() error { 5321 return iter.NextWithContext(context.Background()) 5322} 5323 5324// NotDone returns true if the enumeration should be started or is not yet complete. 5325func (iter TransferDetailsListResultIterator) NotDone() bool { 5326 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5327} 5328 5329// Response returns the raw server response from the last page request. 5330func (iter TransferDetailsListResultIterator) Response() TransferDetailsListResult { 5331 return iter.page.Response() 5332} 5333 5334// Value returns the current value or a zero-initialized value if the 5335// iterator has advanced beyond the end of the collection. 5336func (iter TransferDetailsListResultIterator) Value() TransferDetails { 5337 if !iter.page.NotDone() { 5338 return TransferDetails{} 5339 } 5340 return iter.page.Values()[iter.i] 5341} 5342 5343// Creates a new instance of the TransferDetailsListResultIterator type. 5344func NewTransferDetailsListResultIterator(page TransferDetailsListResultPage) TransferDetailsListResultIterator { 5345 return TransferDetailsListResultIterator{page: page} 5346} 5347 5348// IsEmpty returns true if the ListResult contains no values. 5349func (tdlr TransferDetailsListResult) IsEmpty() bool { 5350 return tdlr.Value == nil || len(*tdlr.Value) == 0 5351} 5352 5353// hasNextLink returns true if the NextLink is not empty. 5354func (tdlr TransferDetailsListResult) hasNextLink() bool { 5355 return tdlr.NextLink != nil && len(*tdlr.NextLink) != 0 5356} 5357 5358// transferDetailsListResultPreparer prepares a request to retrieve the next set of results. 5359// It returns nil if no more results exist. 5360func (tdlr TransferDetailsListResult) transferDetailsListResultPreparer(ctx context.Context) (*http.Request, error) { 5361 if !tdlr.hasNextLink() { 5362 return nil, nil 5363 } 5364 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5365 autorest.AsJSON(), 5366 autorest.AsGet(), 5367 autorest.WithBaseURL(to.String(tdlr.NextLink))) 5368} 5369 5370// TransferDetailsListResultPage contains a page of TransferDetails values. 5371type TransferDetailsListResultPage struct { 5372 fn func(context.Context, TransferDetailsListResult) (TransferDetailsListResult, error) 5373 tdlr TransferDetailsListResult 5374} 5375 5376// NextWithContext advances to the next page of values. If there was an error making 5377// the request the page does not advance and the error is returned. 5378func (page *TransferDetailsListResultPage) NextWithContext(ctx context.Context) (err error) { 5379 if tracing.IsEnabled() { 5380 ctx = tracing.StartSpan(ctx, fqdn+"/TransferDetailsListResultPage.NextWithContext") 5381 defer func() { 5382 sc := -1 5383 if page.Response().Response.Response != nil { 5384 sc = page.Response().Response.Response.StatusCode 5385 } 5386 tracing.EndSpan(ctx, sc, err) 5387 }() 5388 } 5389 for { 5390 next, err := page.fn(ctx, page.tdlr) 5391 if err != nil { 5392 return err 5393 } 5394 page.tdlr = next 5395 if !next.hasNextLink() || !next.IsEmpty() { 5396 break 5397 } 5398 } 5399 return nil 5400} 5401 5402// Next advances to the next page of values. If there was an error making 5403// the request the page does not advance and the error is returned. 5404// Deprecated: Use NextWithContext() instead. 5405func (page *TransferDetailsListResultPage) Next() error { 5406 return page.NextWithContext(context.Background()) 5407} 5408 5409// NotDone returns true if the page enumeration should be started or is not yet complete. 5410func (page TransferDetailsListResultPage) NotDone() bool { 5411 return !page.tdlr.IsEmpty() 5412} 5413 5414// Response returns the raw server response from the last page request. 5415func (page TransferDetailsListResultPage) Response() TransferDetailsListResult { 5416 return page.tdlr 5417} 5418 5419// Values returns the slice of values for the current page or nil if there are no values. 5420func (page TransferDetailsListResultPage) Values() []TransferDetails { 5421 if page.tdlr.IsEmpty() { 5422 return nil 5423 } 5424 return *page.tdlr.Value 5425} 5426 5427// Creates a new instance of the TransferDetailsListResultPage type. 5428func NewTransferDetailsListResultPage(cur TransferDetailsListResult, getNextPage func(context.Context, TransferDetailsListResult) (TransferDetailsListResult, error)) TransferDetailsListResultPage { 5429 return TransferDetailsListResultPage{ 5430 fn: getNextPage, 5431 tdlr: cur, 5432 } 5433} 5434 5435// TransferProductRequestProperties the properties of the product to initiate a transfer. 5436type TransferProductRequestProperties struct { 5437 // DestinationInvoiceSectionID - The destination invoice section id. 5438 DestinationInvoiceSectionID *string `json:"destinationInvoiceSectionId,omitempty"` 5439 // DestinationBillingProfileID - The destination billing profile id. 5440 DestinationBillingProfileID *string `json:"destinationBillingProfileId,omitempty"` 5441} 5442 5443// TransferProperties transfer details 5444type TransferProperties struct { 5445 // CreationTime - READ-ONLY; Transfer creation time. 5446 CreationTime *date.Time `json:"creationTime,omitempty"` 5447 // ExpirationTime - READ-ONLY; Transfer expiration time. 5448 ExpirationTime *date.Time `json:"expirationTime,omitempty"` 5449 // InvoiceSectionID - READ-ONLY; Target invoice section Id. 5450 InvoiceSectionID *string `json:"invoiceSectionId,omitempty"` 5451 // BillingAccountID - READ-ONLY; Target billing account Id. 5452 BillingAccountID *string `json:"billingAccountId,omitempty"` 5453 // TransferStatus - READ-ONLY; Overall transfer status. Possible values include: 'TransferStatusPending', 'TransferStatusInProgress', 'TransferStatusCompleted', 'TransferStatusCompletedWithErrors', 'TransferStatusFailed', 'TransferStatusCanceled', 'TransferStatusDeclined' 5454 TransferStatus TransferStatus `json:"transferStatus,omitempty"` 5455 // RecipientEmailID - READ-ONLY; Email Id of recipient of transfer. 5456 RecipientEmailID *string `json:"recipientEmailId,omitempty"` 5457 // InitiatorEmailID - READ-ONLY; Email Id of initiator of transfer. 5458 InitiatorEmailID *string `json:"initiatorEmailId,omitempty"` 5459 // CanceledBy - READ-ONLY; Email Id who user canceled the transfer. 5460 CanceledBy *string `json:"canceledBy,omitempty"` 5461 // LastModifiedTime - READ-ONLY; Transfer last modification time. 5462 LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` 5463 // DetailedTransferStatus - READ-ONLY; Detailed transfer status. 5464 DetailedTransferStatus *[]DetailedTransferStatus `json:"detailedTransferStatus,omitempty"` 5465} 5466 5467// MarshalJSON is the custom marshaler for TransferProperties. 5468func (tp TransferProperties) MarshalJSON() ([]byte, error) { 5469 objectMap := make(map[string]interface{}) 5470 return json.Marshal(objectMap) 5471} 5472 5473// UpdateAutoRenewOperationSummary summary of cancel product operation 5474type UpdateAutoRenewOperationSummary struct { 5475 autorest.Response `json:"-"` 5476 // UpdateAutoRenewOperationSummaryProperties - Summary of update auto renew operation summary properties 5477 *UpdateAutoRenewOperationSummaryProperties `json:"properties,omitempty"` 5478} 5479 5480// MarshalJSON is the custom marshaler for UpdateAutoRenewOperationSummary. 5481func (uaros UpdateAutoRenewOperationSummary) MarshalJSON() ([]byte, error) { 5482 objectMap := make(map[string]interface{}) 5483 if uaros.UpdateAutoRenewOperationSummaryProperties != nil { 5484 objectMap["properties"] = uaros.UpdateAutoRenewOperationSummaryProperties 5485 } 5486 return json.Marshal(objectMap) 5487} 5488 5489// UnmarshalJSON is the custom unmarshaler for UpdateAutoRenewOperationSummary struct. 5490func (uaros *UpdateAutoRenewOperationSummary) UnmarshalJSON(body []byte) error { 5491 var m map[string]*json.RawMessage 5492 err := json.Unmarshal(body, &m) 5493 if err != nil { 5494 return err 5495 } 5496 for k, v := range m { 5497 switch k { 5498 case "properties": 5499 if v != nil { 5500 var updateAutoRenewOperationSummaryProperties UpdateAutoRenewOperationSummaryProperties 5501 err = json.Unmarshal(*v, &updateAutoRenewOperationSummaryProperties) 5502 if err != nil { 5503 return err 5504 } 5505 uaros.UpdateAutoRenewOperationSummaryProperties = &updateAutoRenewOperationSummaryProperties 5506 } 5507 } 5508 } 5509 5510 return nil 5511} 5512 5513// UpdateAutoRenewOperationSummaryProperties update auto renew operation summary properties 5514type UpdateAutoRenewOperationSummaryProperties struct { 5515 // EndDate - The end date of this asset 5516 EndDate *date.Time `json:"endDate,omitempty"` 5517} 5518 5519// UpdateAutoRenewRequest request parameters to update auto renew for support product. 5520type UpdateAutoRenewRequest struct { 5521 // AutoRenew - Request parameters to update auto renew policy a product. Possible values include: 'True', 'False' 5522 AutoRenew UpdateAutoRenew `json:"autoRenew,omitempty"` 5523} 5524 5525// ValidateAddressResponse result of the address validation 5526type ValidateAddressResponse struct { 5527 autorest.Response `json:"-"` 5528 // Status - status of the address validation. Possible values include: 'Valid', 'Invalid' 5529 Status AddressValidationStatus `json:"status,omitempty"` 5530 // SuggestedAddresses - list of suggested addresses. 5531 SuggestedAddresses *[]Address `json:"suggestedAddresses,omitempty"` 5532 // ValidationMessage - Validation error message. 5533 ValidationMessage *string `json:"validationMessage,omitempty"` 5534} 5535 5536// ValidateProductTransferEligibilityError error details of the product transfer eligibility validation. 5537type ValidateProductTransferEligibilityError struct { 5538 // Code - Error code for the product transfer validation. Possible values include: 'InvalidSource', 'ProductNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', 'OneTimePurchaseProductTransferNotAllowed' 5539 Code ProductTransferValidationErrorCode `json:"code,omitempty"` 5540 // Message - The error message. 5541 Message *string `json:"message,omitempty"` 5542 // Details - Detailed error message explaining the error. 5543 Details *string `json:"details,omitempty"` 5544} 5545 5546// ValidateProductTransferEligibilityResult result of the product transfer eligibility validation. 5547type ValidateProductTransferEligibilityResult struct { 5548 autorest.Response `json:"-"` 5549 // IsTransferEligible - READ-ONLY; Specifies whether the transfer is eligible or not. 5550 IsTransferEligible *bool `json:"isTransferEligible,omitempty"` 5551 // ErrorDetails - Validation error details. 5552 ErrorDetails *ValidateProductTransferEligibilityError `json:"errorDetails,omitempty"` 5553} 5554 5555// MarshalJSON is the custom marshaler for ValidateProductTransferEligibilityResult. 5556func (vpter ValidateProductTransferEligibilityResult) MarshalJSON() ([]byte, error) { 5557 objectMap := make(map[string]interface{}) 5558 if vpter.ErrorDetails != nil { 5559 objectMap["errorDetails"] = vpter.ErrorDetails 5560 } 5561 return json.Marshal(objectMap) 5562} 5563 5564// ValidateSubscriptionTransferEligibilityError error details of the transfer eligibility validation 5565type ValidateSubscriptionTransferEligibilityError struct { 5566 // Code - Error code for the product transfer validation. Possible values include: 'SubscriptionTransferValidationErrorCodeInvalidSource', 'SubscriptionTransferValidationErrorCodeSubscriptionNotActive', 'SubscriptionTransferValidationErrorCodeInsufficientPermissionOnSource', 'SubscriptionTransferValidationErrorCodeInsufficientPermissionOnDestination', 'SubscriptionTransferValidationErrorCodeDestinationBillingProfilePastDue', 'SubscriptionTransferValidationErrorCodeSubscriptionTypeNotSupported', 'SubscriptionTransferValidationErrorCodeCrossBillingAccountNotAllowed', 'SubscriptionTransferValidationErrorCodeNotAvailableForDestinationMarket' 5567 Code SubscriptionTransferValidationErrorCode `json:"code,omitempty"` 5568 // Message - The error message. 5569 Message *string `json:"message,omitempty"` 5570 // Details - Detailed error message explaining the error. 5571 Details *string `json:"details,omitempty"` 5572} 5573 5574// ValidateSubscriptionTransferEligibilityResult result of the transfer eligibility validation. 5575type ValidateSubscriptionTransferEligibilityResult struct { 5576 autorest.Response `json:"-"` 5577 // IsTransferEligible - READ-ONLY; Specifies whether the transfer is eligible or not. 5578 IsTransferEligible *bool `json:"isTransferEligible,omitempty"` 5579 // ErrorDetails - Validation error details. 5580 ErrorDetails *ValidateSubscriptionTransferEligibilityError `json:"errorDetails,omitempty"` 5581} 5582 5583// MarshalJSON is the custom marshaler for ValidateSubscriptionTransferEligibilityResult. 5584func (vster ValidateSubscriptionTransferEligibilityResult) MarshalJSON() ([]byte, error) { 5585 objectMap := make(map[string]interface{}) 5586 if vster.ErrorDetails != nil { 5587 objectMap["errorDetails"] = vster.ErrorDetails 5588 } 5589 return json.Marshal(objectMap) 5590} 5591