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