diff --git a/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go b/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go index fc6833b52934..7d015cc8d955 100644 --- a/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go +++ b/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go @@ -22,13 +22,14 @@ package billingapi import original "github.com/Azure/azure-sdk-for-go/services/preview/billing/mgmt/2018-11-01-preview/billing/billingapi" type AccountsClientAPI = original.AccountsClientAPI -type AccountsValidateAddressClientAPI = original.AccountsValidateAddressClientAPI +type AddressesClientAPI = original.AddressesClientAPI type AgreementsClientAPI = original.AgreementsClientAPI type AvailableBalancesClientAPI = original.AvailableBalancesClientAPI type DepartmentsClientAPI = original.DepartmentsClientAPI type EnrollmentAccountsClientAPI = original.EnrollmentAccountsClientAPI type InvoiceSectionsClientAPI = original.InvoiceSectionsClientAPI type InvoicesClientAPI = original.InvoicesClientAPI +type LineOfCreditsClientAPI = original.LineOfCreditsClientAPI type OperationsClientAPI = original.OperationsClientAPI type PaymentMethodsClientAPI = original.PaymentMethodsClientAPI type PermissionsClientAPI = original.PermissionsClientAPI diff --git a/profiles/preview/preview/billing/mgmt/billing/models.go b/profiles/preview/preview/billing/mgmt/billing/models.go index 3f4e81c9e0ac..1c7f3a337240 100644 --- a/profiles/preview/preview/billing/mgmt/billing/models.go +++ b/profiles/preview/preview/billing/mgmt/billing/models.go @@ -97,6 +97,20 @@ const ( NotStarted ProductTransferStatus = original.NotStarted ) +type ProductTransferValidationErrorCode = original.ProductTransferValidationErrorCode + +const ( + CrossBillingAccountNotAllowed ProductTransferValidationErrorCode = original.CrossBillingAccountNotAllowed + DestinationBillingProfilePastDue ProductTransferValidationErrorCode = original.DestinationBillingProfilePastDue + InsufficientPermissionOnDestination ProductTransferValidationErrorCode = original.InsufficientPermissionOnDestination + InsufficientPermissionOnSource ProductTransferValidationErrorCode = original.InsufficientPermissionOnSource + InvalidSource ProductTransferValidationErrorCode = original.InvalidSource + NotAvailableForDestinationMarket ProductTransferValidationErrorCode = original.NotAvailableForDestinationMarket + OneTimePurchaseProductTransferNotAllowed ProductTransferValidationErrorCode = original.OneTimePurchaseProductTransferNotAllowed + ProductNotActive ProductTransferValidationErrorCode = original.ProductNotActive + ProductTypeNotSupported ProductTransferValidationErrorCode = original.ProductTypeNotSupported +) + type ProductType = original.ProductType const ( @@ -114,10 +128,17 @@ const ( type Status = original.Status const ( - StatusDue Status = original.StatusDue - StatusPaid Status = original.StatusPaid - StatusPastDue Status = original.StatusPastDue - StatusVoid Status = original.StatusVoid + Approved Status = original.Approved + Rejected Status = original.Rejected +) + +type Status1 = original.Status1 + +const ( + Status1Due Status1 = original.Status1Due + Status1Paid Status1 = original.Status1Paid + Status1PastDue Status1 = original.Status1PastDue + Status1Void Status1 = original.Status1Void ) type SubscriptionStatusType = original.SubscriptionStatusType @@ -130,6 +151,19 @@ const ( SubscriptionStatusTypeWarning SubscriptionStatusType = original.SubscriptionStatusTypeWarning ) +type SubscriptionTransferValidationErrorCode = original.SubscriptionTransferValidationErrorCode + +const ( + SubscriptionTransferValidationErrorCodeCrossBillingAccountNotAllowed SubscriptionTransferValidationErrorCode = original.SubscriptionTransferValidationErrorCodeCrossBillingAccountNotAllowed + SubscriptionTransferValidationErrorCodeDestinationBillingProfilePastDue SubscriptionTransferValidationErrorCode = original.SubscriptionTransferValidationErrorCodeDestinationBillingProfilePastDue + SubscriptionTransferValidationErrorCodeInsufficientPermissionOnDestination SubscriptionTransferValidationErrorCode = original.SubscriptionTransferValidationErrorCodeInsufficientPermissionOnDestination + SubscriptionTransferValidationErrorCodeInsufficientPermissionOnSource SubscriptionTransferValidationErrorCode = original.SubscriptionTransferValidationErrorCodeInsufficientPermissionOnSource + SubscriptionTransferValidationErrorCodeInvalidSource SubscriptionTransferValidationErrorCode = original.SubscriptionTransferValidationErrorCodeInvalidSource + SubscriptionTransferValidationErrorCodeNotAvailableForDestinationMarket SubscriptionTransferValidationErrorCode = original.SubscriptionTransferValidationErrorCodeNotAvailableForDestinationMarket + SubscriptionTransferValidationErrorCodeSubscriptionNotActive SubscriptionTransferValidationErrorCode = original.SubscriptionTransferValidationErrorCodeSubscriptionNotActive + SubscriptionTransferValidationErrorCodeSubscriptionTypeNotSupported SubscriptionTransferValidationErrorCode = original.SubscriptionTransferValidationErrorCodeSubscriptionTypeNotSupported +) + type TransactionTypeKind = original.TransactionTypeKind const ( @@ -161,9 +195,11 @@ type AcceptTransferRequest = original.AcceptTransferRequest type Account = original.Account type AccountListResult = original.AccountListResult type AccountProperties = original.AccountProperties +type AccountUpdateProperties = original.AccountUpdateProperties type AccountsClient = original.AccountsClient -type AccountsValidateAddressClient = original.AccountsValidateAddressClient +type AccountsUpdateFuture = original.AccountsUpdateFuture type Address = original.Address +type AddressesClient = original.AddressesClient type Agreement = original.Agreement type AgreementListResult = original.AgreementListResult type AgreementProperties = original.AgreementProperties @@ -195,6 +231,7 @@ type InitiateTransferProperties = original.InitiateTransferProperties type InitiateTransferRequest = original.InitiateTransferRequest type InvoiceListResult = original.InvoiceListResult type InvoiceSection = original.InvoiceSection +type InvoiceSectionCreationRequest = original.InvoiceSectionCreationRequest type InvoiceSectionListResult = original.InvoiceSectionListResult type InvoiceSectionProperties = original.InvoiceSectionProperties type InvoiceSectionsClient = original.InvoiceSectionsClient @@ -203,6 +240,10 @@ type InvoiceSectionsUpdateFuture = original.InvoiceSectionsUpdateFuture type InvoiceSummary = original.InvoiceSummary type InvoiceSummaryProperties = original.InvoiceSummaryProperties type InvoicesClient = original.InvoicesClient +type LineOfCredit = original.LineOfCredit +type LineOfCreditProperties = original.LineOfCreditProperties +type LineOfCreditsClient = original.LineOfCreditsClient +type LineOfCreditsUpdateFuture = original.LineOfCreditsUpdateFuture type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -234,9 +275,11 @@ type ProductsListResult = original.ProductsListResult type ProductsListResultIterator = original.ProductsListResultIterator type ProductsListResultPage = original.ProductsListResultPage type Profile = original.Profile +type ProfileCreationParameters = original.ProfileCreationParameters type ProfileListResult = original.ProfileListResult type ProfileProperties = original.ProfileProperties type ProfilesClient = original.ProfilesClient +type ProfilesCreateFuture = original.ProfilesCreateFuture type ProfilesUpdateFuture = original.ProfilesUpdateFuture type Property = original.Property type PropertyClient = original.PropertyClient @@ -285,6 +328,10 @@ type UpdateAutoRenewOperationSummary = original.UpdateAutoRenewOperationSummary type UpdateAutoRenewOperationSummaryProperties = original.UpdateAutoRenewOperationSummaryProperties type UpdateAutoRenewRequest = original.UpdateAutoRenewRequest type ValidateAddressResponse = original.ValidateAddressResponse +type ValidateProductTransferEligibilityError = original.ValidateProductTransferEligibilityError +type ValidateProductTransferEligibilityResult = original.ValidateProductTransferEligibilityResult +type ValidateSubscriptionTransferEligibilityError = original.ValidateSubscriptionTransferEligibilityError +type ValidateSubscriptionTransferEligibilityResult = original.ValidateSubscriptionTransferEligibilityResult func New(subscriptionID string) BaseClient { return original.New(subscriptionID) @@ -295,11 +342,11 @@ func NewAccountsClient(subscriptionID string) AccountsClient { func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { return original.NewAccountsClientWithBaseURI(baseURI, subscriptionID) } -func NewAccountsValidateAddressClient(subscriptionID string) AccountsValidateAddressClient { - return original.NewAccountsValidateAddressClient(subscriptionID) +func NewAddressesClient(subscriptionID string) AddressesClient { + return original.NewAddressesClient(subscriptionID) } -func NewAccountsValidateAddressClientWithBaseURI(baseURI string, subscriptionID string) AccountsValidateAddressClient { - return original.NewAccountsValidateAddressClientWithBaseURI(baseURI, subscriptionID) +func NewAddressesClientWithBaseURI(baseURI string, subscriptionID string) AddressesClient { + return original.NewAddressesClientWithBaseURI(baseURI, subscriptionID) } func NewAgreementsClient(subscriptionID string) AgreementsClient { return original.NewAgreementsClient(subscriptionID) @@ -337,6 +384,12 @@ func NewInvoicesClient(subscriptionID string) InvoicesClient { func NewInvoicesClientWithBaseURI(baseURI string, subscriptionID string) InvoicesClient { return original.NewInvoicesClientWithBaseURI(baseURI, subscriptionID) } +func NewLineOfCreditsClient(subscriptionID string) LineOfCreditsClient { + return original.NewLineOfCreditsClient(subscriptionID) +} +func NewLineOfCreditsClientWithBaseURI(baseURI string, subscriptionID string) LineOfCreditsClient { + return original.NewLineOfCreditsClientWithBaseURI(baseURI, subscriptionID) +} func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { return original.NewOperationListResultIterator(page) } @@ -490,18 +543,27 @@ func PossibleProductStatusTypeValues() []ProductStatusType { func PossibleProductTransferStatusValues() []ProductTransferStatus { return original.PossibleProductTransferStatusValues() } +func PossibleProductTransferValidationErrorCodeValues() []ProductTransferValidationErrorCode { + return original.PossibleProductTransferValidationErrorCodeValues() +} func PossibleProductTypeValues() []ProductType { return original.PossibleProductTypeValues() } func PossibleReservationTypeValues() []ReservationType { return original.PossibleReservationTypeValues() } +func PossibleStatus1Values() []Status1 { + return original.PossibleStatus1Values() +} func PossibleStatusValues() []Status { return original.PossibleStatusValues() } func PossibleSubscriptionStatusTypeValues() []SubscriptionStatusType { return original.PossibleSubscriptionStatusTypeValues() } +func PossibleSubscriptionTransferValidationErrorCodeValues() []SubscriptionTransferValidationErrorCode { + return original.PossibleSubscriptionTransferValidationErrorCodeValues() +} func PossibleTransactionTypeKindValues() []TransactionTypeKind { return original.PossibleTransactionTypeKindValues() } diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/accounts.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/accounts.go index 605447199594..4ae7a3680fbe 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/accounts.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/accounts.go @@ -190,3 +190,80 @@ func (client AccountsClient) ListResponder(resp *http.Response) (result AccountL result.Response = autorest.Response{Response: resp} return } + +// Update the operation to update a billing account. +// Parameters: +// billingAccountName - billing Account Id. +// parameters - parameters supplied to the update billing account operation. +func (client AccountsClient) Update(ctx context.Context, billingAccountName string, parameters AccountUpdateProperties) (result AccountsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, billingAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.AccountsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.AccountsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountsClient) UpdatePreparer(ctx context.Context, billingAccountName string, parameters AccountUpdateProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) UpdateSender(req *http.Request) (future AccountsUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/accountsvalidateaddress.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/accountsvalidateaddress.go deleted file mode 100644 index b87e8a2701c7..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/accountsvalidateaddress.go +++ /dev/null @@ -1,117 +0,0 @@ -package billing - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AccountsValidateAddressClient is the billing client provides access to billing resources for Azure subscriptions. -type AccountsValidateAddressClient struct { - BaseClient -} - -// NewAccountsValidateAddressClient creates an instance of the AccountsValidateAddressClient client. -func NewAccountsValidateAddressClient(subscriptionID string) AccountsValidateAddressClient { - return NewAccountsValidateAddressClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountsValidateAddressClientWithBaseURI creates an instance of the AccountsValidateAddressClient client. -func NewAccountsValidateAddressClientWithBaseURI(baseURI string, subscriptionID string) AccountsValidateAddressClient { - return AccountsValidateAddressClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Post validates the address. -// Parameters: -// billingAccountName - billing Account Id. -func (client AccountsValidateAddressClient) Post(ctx context.Context, billingAccountName string, address Address) (result ValidateAddressResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsValidateAddressClient.Post") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.PostPreparer(ctx, billingAccountName, address) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountsValidateAddressClient", "Post", nil, "Failure preparing request") - return - } - - resp, err := client.PostSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.AccountsValidateAddressClient", "Post", resp, "Failure sending request") - return - } - - result, err = client.PostResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountsValidateAddressClient", "Post", resp, "Failure responding to request") - } - - return -} - -// PostPreparer prepares the Post request. -func (client AccountsValidateAddressClient) PostPreparer(ctx context.Context, billingAccountName string, address Address) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/validateAddress", pathParameters), - autorest.WithJSON(address), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PostSender sends the Post request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsValidateAddressClient) PostSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// PostResponder handles the response to the Post request. The method always -// closes the http.Response Body. -func (client AccountsValidateAddressClient) PostResponder(resp *http.Response) (result ValidateAddressResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/addresses.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/addresses.go new file mode 100644 index 000000000000..56333fe01201 --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/addresses.go @@ -0,0 +1,111 @@ +package billing + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AddressesClient is the billing client provides access to billing resources for Azure subscriptions. +type AddressesClient struct { + BaseClient +} + +// NewAddressesClient creates an instance of the AddressesClient client. +func NewAddressesClient(subscriptionID string) AddressesClient { + return NewAddressesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAddressesClientWithBaseURI creates an instance of the AddressesClient client. +func NewAddressesClientWithBaseURI(baseURI string, subscriptionID string) AddressesClient { + return AddressesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Validate validates the address. +func (client AddressesClient) Validate(ctx context.Context, address Address) (result ValidateAddressResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AddressesClient.Validate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ValidatePreparer(ctx, address) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.AddressesClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.AddressesClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.AddressesClient", "Validate", resp, "Failure responding to request") + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client AddressesClient) ValidatePreparer(ctx context.Context, address Address) (*http.Request, error) { + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Billing/validateAddress"), + autorest.WithJSON(address), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client AddressesClient) ValidateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client AddressesClient) ValidateResponder(resp *http.Response) (result ValidateAddressResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/billingapi/interfaces.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/billingapi/interfaces.go index 0b134982d1ca..d4dbd586a09b 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/billingapi/interfaces.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/billingapi/interfaces.go @@ -27,6 +27,7 @@ import ( type AccountsClientAPI interface { Get(ctx context.Context, billingAccountName string, expand string) (result billing.Account, err error) List(ctx context.Context, expand string) (result billing.AccountListResult, err error) + Update(ctx context.Context, billingAccountName string, parameters billing.AccountUpdateProperties) (result billing.AccountsUpdateFuture, err error) } var _ AccountsClientAPI = (*billing.AccountsClient)(nil) @@ -39,12 +40,12 @@ type PaymentMethodsClientAPI interface { var _ PaymentMethodsClientAPI = (*billing.PaymentMethodsClient)(nil) -// AccountsValidateAddressClientAPI contains the set of methods on the AccountsValidateAddressClient type. -type AccountsValidateAddressClientAPI interface { - Post(ctx context.Context, billingAccountName string, address billing.Address) (result billing.ValidateAddressResponse, err error) +// AddressesClientAPI contains the set of methods on the AddressesClient type. +type AddressesClientAPI interface { + Validate(ctx context.Context, address billing.Address) (result billing.ValidateAddressResponse, err error) } -var _ AccountsValidateAddressClientAPI = (*billing.AccountsValidateAddressClient)(nil) +var _ AddressesClientAPI = (*billing.AddressesClient)(nil) // AvailableBalancesClientAPI contains the set of methods on the AvailableBalancesClient type. type AvailableBalancesClientAPI interface { @@ -55,6 +56,7 @@ var _ AvailableBalancesClientAPI = (*billing.AvailableBalancesClient)(nil) // ProfilesClientAPI contains the set of methods on the ProfilesClient type. type ProfilesClientAPI interface { + Create(ctx context.Context, billingAccountName string, parameters billing.ProfileCreationParameters) (result billing.ProfilesCreateFuture, err error) Get(ctx context.Context, billingAccountName string, billingProfileName string, expand string) (result billing.Profile, err error) ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string) (result billing.ProfileListResult, err error) Update(ctx context.Context, billingAccountName string, billingProfileName string, parameters billing.Profile) (result billing.ProfilesUpdateFuture, err error) @@ -64,7 +66,7 @@ var _ ProfilesClientAPI = (*billing.ProfilesClient)(nil) // InvoiceSectionsClientAPI contains the set of methods on the InvoiceSectionsClient type. type InvoiceSectionsClientAPI interface { - Create(ctx context.Context, billingAccountName string, parameters billing.InvoiceSectionProperties) (result billing.InvoiceSectionsCreateFuture, err error) + Create(ctx context.Context, billingAccountName string, parameters billing.InvoiceSectionCreationRequest) (result billing.InvoiceSectionsCreateFuture, err error) ElevateToBillingProfile(ctx context.Context, billingAccountName string, invoiceSectionName string) (result autorest.Response, err error) Get(ctx context.Context, billingAccountName string, invoiceSectionName string, expand string) (result billing.InvoiceSection, err error) ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string) (result billing.InvoiceSectionListResult, err error) @@ -114,6 +116,7 @@ type SubscriptionsClientAPI interface { ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.SubscriptionsListResult, err error) ListByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string) (result billing.SubscriptionsListResult, err error) Transfer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string, parameters billing.TransferBillingSubscriptionRequestProperties) (result billing.SubscriptionsTransferFuture, err error) + ValidateTransfer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string, parameters billing.TransferBillingSubscriptionRequestProperties) (result billing.ValidateSubscriptionTransferEligibilityResult, err error) } var _ SubscriptionsClientAPI = (*billing.SubscriptionsClient)(nil) @@ -126,6 +129,7 @@ type ProductsClientAPI interface { Transfer(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, parameters billing.TransferProductRequestProperties) (result billing.ProductSummary, err error) UpdateAutoRenewByBillingAccountName(ctx context.Context, billingAccountName string, productName string, body billing.UpdateAutoRenewRequest) (result billing.UpdateAutoRenewOperationSummary, err error) UpdateAutoRenewByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, body billing.UpdateAutoRenewRequest) (result billing.UpdateAutoRenewOperationSummary, err error) + ValidateTransfer(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, parameters billing.TransferProductRequestProperties) (result billing.ValidateProductTransferEligibilityResult, err error) } var _ ProductsClientAPI = (*billing.ProductsClient)(nil) @@ -227,3 +231,11 @@ type AgreementsClientAPI interface { } var _ AgreementsClientAPI = (*billing.AgreementsClient)(nil) + +// LineOfCreditsClientAPI contains the set of methods on the LineOfCreditsClient type. +type LineOfCreditsClientAPI interface { + Get(ctx context.Context) (result billing.LineOfCredit, err error) + Update(ctx context.Context, parameters billing.LineOfCredit) (result billing.LineOfCreditsUpdateFuture, err error) +} + +var _ LineOfCreditsClientAPI = (*billing.LineOfCreditsClient)(nil) diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesections.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesections.go index 8786a6a894cb..5ca7c1d620b7 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesections.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesections.go @@ -44,7 +44,7 @@ func NewInvoiceSectionsClientWithBaseURI(baseURI string, subscriptionID string) // Parameters: // billingAccountName - billing Account Id. // parameters - parameters supplied to the Create InvoiceSection operation. -func (client InvoiceSectionsClient) Create(ctx context.Context, billingAccountName string, parameters InvoiceSectionProperties) (result InvoiceSectionsCreateFuture, err error) { +func (client InvoiceSectionsClient) Create(ctx context.Context, billingAccountName string, parameters InvoiceSectionCreationRequest) (result InvoiceSectionsCreateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionsClient.Create") defer func() { @@ -71,7 +71,7 @@ func (client InvoiceSectionsClient) Create(ctx context.Context, billingAccountNa } // CreatePreparer prepares the Create request. -func (client InvoiceSectionsClient) CreatePreparer(ctx context.Context, billingAccountName string, parameters InvoiceSectionProperties) (*http.Request, error) { +func (client InvoiceSectionsClient) CreatePreparer(ctx context.Context, billingAccountName string, parameters InvoiceSectionCreationRequest) (*http.Request, error) { pathParameters := map[string]interface{}{ "billingAccountName": autorest.Encode("path", billingAccountName), } diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/lineofcredits.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/lineofcredits.go new file mode 100644 index 000000000000..0e5e7279d832 --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/lineofcredits.go @@ -0,0 +1,189 @@ +package billing + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LineOfCreditsClient is the billing client provides access to billing resources for Azure subscriptions. +type LineOfCreditsClient struct { + BaseClient +} + +// NewLineOfCreditsClient creates an instance of the LineOfCreditsClient client. +func NewLineOfCreditsClient(subscriptionID string) LineOfCreditsClient { + return NewLineOfCreditsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLineOfCreditsClientWithBaseURI creates an instance of the LineOfCreditsClient client. +func NewLineOfCreditsClientWithBaseURI(baseURI string, subscriptionID string) LineOfCreditsClient { + return LineOfCreditsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the current line of credit. +func (client LineOfCreditsClient) Get(ctx context.Context) (result LineOfCredit, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LineOfCreditsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.LineOfCreditsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.LineOfCreditsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.LineOfCreditsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LineOfCreditsClient) GetPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingAccounts/default/lineOfCredit/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LineOfCreditsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LineOfCreditsClient) GetResponder(resp *http.Response) (result LineOfCredit, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update increase the current line of credit. +// Parameters: +// parameters - parameters supplied to the increase line of credit operation. +func (client LineOfCreditsClient) Update(ctx context.Context, parameters LineOfCredit) (result LineOfCreditsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LineOfCreditsClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.LineOfCreditsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.LineOfCreditsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client LineOfCreditsClient) UpdatePreparer(ctx context.Context, parameters LineOfCredit) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingAccounts/default/lineOfCredit/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client LineOfCreditsClient) UpdateSender(req *http.Request) (future LineOfCreditsUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client LineOfCreditsClient) UpdateResponder(resp *http.Response) (result LineOfCredit, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/models.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/models.go index e7e1fad0c2cb..0c33e5243237 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/models.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/models.go @@ -176,6 +176,35 @@ func PossibleProductTransferStatusValues() []ProductTransferStatus { return []ProductTransferStatus{Completed, Failed, InProgress, NotStarted} } +// ProductTransferValidationErrorCode enumerates the values for product transfer validation error code. +type ProductTransferValidationErrorCode string + +const ( + // CrossBillingAccountNotAllowed ... + CrossBillingAccountNotAllowed ProductTransferValidationErrorCode = "CrossBillingAccountNotAllowed" + // DestinationBillingProfilePastDue ... + DestinationBillingProfilePastDue ProductTransferValidationErrorCode = "DestinationBillingProfilePastDue" + // InsufficientPermissionOnDestination ... + InsufficientPermissionOnDestination ProductTransferValidationErrorCode = "InsufficientPermissionOnDestination" + // InsufficientPermissionOnSource ... + InsufficientPermissionOnSource ProductTransferValidationErrorCode = "InsufficientPermissionOnSource" + // InvalidSource ... + InvalidSource ProductTransferValidationErrorCode = "InvalidSource" + // NotAvailableForDestinationMarket ... + NotAvailableForDestinationMarket ProductTransferValidationErrorCode = "NotAvailableForDestinationMarket" + // OneTimePurchaseProductTransferNotAllowed ... + OneTimePurchaseProductTransferNotAllowed ProductTransferValidationErrorCode = "OneTimePurchaseProductTransferNotAllowed" + // ProductNotActive ... + ProductNotActive ProductTransferValidationErrorCode = "ProductNotActive" + // ProductTypeNotSupported ... + ProductTypeNotSupported ProductTransferValidationErrorCode = "ProductTypeNotSupported" +) + +// PossibleProductTransferValidationErrorCodeValues returns an array of possible values for the ProductTransferValidationErrorCode const type. +func PossibleProductTransferValidationErrorCodeValues() []ProductTransferValidationErrorCode { + return []ProductTransferValidationErrorCode{CrossBillingAccountNotAllowed, DestinationBillingProfilePastDue, InsufficientPermissionOnDestination, InsufficientPermissionOnSource, InvalidSource, NotAvailableForDestinationMarket, OneTimePurchaseProductTransferNotAllowed, ProductNotActive, ProductTypeNotSupported} +} + // ProductType enumerates the values for product type. type ProductType string @@ -210,19 +239,34 @@ func PossibleReservationTypeValues() []ReservationType { type Status string const ( - // StatusDue ... - StatusDue Status = "Due" - // StatusPaid ... - StatusPaid Status = "Paid" - // StatusPastDue ... - StatusPastDue Status = "PastDue" - // StatusVoid ... - StatusVoid Status = "Void" + // Approved ... + Approved Status = "Approved" + // Rejected ... + Rejected Status = "Rejected" ) // PossibleStatusValues returns an array of possible values for the Status const type. func PossibleStatusValues() []Status { - return []Status{StatusDue, StatusPaid, StatusPastDue, StatusVoid} + return []Status{Approved, Rejected} +} + +// Status1 enumerates the values for status 1. +type Status1 string + +const ( + // Status1Due ... + Status1Due Status1 = "Due" + // Status1Paid ... + Status1Paid Status1 = "Paid" + // Status1PastDue ... + Status1PastDue Status1 = "PastDue" + // Status1Void ... + Status1Void Status1 = "Void" +) + +// PossibleStatus1Values returns an array of possible values for the Status1 const type. +func PossibleStatus1Values() []Status1 { + return []Status1{Status1Due, Status1Paid, Status1PastDue, Status1Void} } // SubscriptionStatusType enumerates the values for subscription status type. @@ -246,6 +290,34 @@ func PossibleSubscriptionStatusTypeValues() []SubscriptionStatusType { return []SubscriptionStatusType{SubscriptionStatusTypeAbandoned, SubscriptionStatusTypeActive, SubscriptionStatusTypeDeleted, SubscriptionStatusTypeInactive, SubscriptionStatusTypeWarning} } +// SubscriptionTransferValidationErrorCode enumerates the values for subscription transfer validation error +// code. +type SubscriptionTransferValidationErrorCode string + +const ( + // SubscriptionTransferValidationErrorCodeCrossBillingAccountNotAllowed ... + SubscriptionTransferValidationErrorCodeCrossBillingAccountNotAllowed SubscriptionTransferValidationErrorCode = "CrossBillingAccountNotAllowed" + // SubscriptionTransferValidationErrorCodeDestinationBillingProfilePastDue ... + SubscriptionTransferValidationErrorCodeDestinationBillingProfilePastDue SubscriptionTransferValidationErrorCode = "DestinationBillingProfilePastDue" + // SubscriptionTransferValidationErrorCodeInsufficientPermissionOnDestination ... + SubscriptionTransferValidationErrorCodeInsufficientPermissionOnDestination SubscriptionTransferValidationErrorCode = "InsufficientPermissionOnDestination" + // SubscriptionTransferValidationErrorCodeInsufficientPermissionOnSource ... + SubscriptionTransferValidationErrorCodeInsufficientPermissionOnSource SubscriptionTransferValidationErrorCode = "InsufficientPermissionOnSource" + // SubscriptionTransferValidationErrorCodeInvalidSource ... + SubscriptionTransferValidationErrorCodeInvalidSource SubscriptionTransferValidationErrorCode = "InvalidSource" + // SubscriptionTransferValidationErrorCodeNotAvailableForDestinationMarket ... + SubscriptionTransferValidationErrorCodeNotAvailableForDestinationMarket SubscriptionTransferValidationErrorCode = "NotAvailableForDestinationMarket" + // SubscriptionTransferValidationErrorCodeSubscriptionNotActive ... + SubscriptionTransferValidationErrorCodeSubscriptionNotActive SubscriptionTransferValidationErrorCode = "SubscriptionNotActive" + // SubscriptionTransferValidationErrorCodeSubscriptionTypeNotSupported ... + SubscriptionTransferValidationErrorCodeSubscriptionTypeNotSupported SubscriptionTransferValidationErrorCode = "SubscriptionTypeNotSupported" +) + +// PossibleSubscriptionTransferValidationErrorCodeValues returns an array of possible values for the SubscriptionTransferValidationErrorCode const type. +func PossibleSubscriptionTransferValidationErrorCodeValues() []SubscriptionTransferValidationErrorCode { + return []SubscriptionTransferValidationErrorCode{SubscriptionTransferValidationErrorCodeCrossBillingAccountNotAllowed, SubscriptionTransferValidationErrorCodeDestinationBillingProfilePastDue, SubscriptionTransferValidationErrorCodeInsufficientPermissionOnDestination, SubscriptionTransferValidationErrorCodeInsufficientPermissionOnSource, SubscriptionTransferValidationErrorCodeInvalidSource, SubscriptionTransferValidationErrorCodeNotAvailableForDestinationMarket, SubscriptionTransferValidationErrorCodeSubscriptionNotActive, SubscriptionTransferValidationErrorCodeSubscriptionTypeNotSupported} +} + // TransactionTypeKind enumerates the values for transaction type kind. type TransactionTypeKind string @@ -454,6 +526,74 @@ type AccountProperties struct { HasReadAccess *bool `json:"hasReadAccess,omitempty"` } +// AccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *AccountsUpdateFuture) Result(client AccountsClient) (a Account, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.AccountsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("billing.AccountsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.UpdateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.AccountsUpdateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + +// AccountUpdateProperties the properties of the billing account that can be updated. +type AccountUpdateProperties struct { + // AccountProperties - A billing property. + *AccountProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountUpdateProperties. +func (aup AccountUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aup.AccountProperties != nil { + objectMap["properties"] = aup.AccountProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccountUpdateProperties struct. +func (aup *AccountUpdateProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var accountProperties AccountProperties + err = json.Unmarshal(*v, &accountProperties) + if err != nil { + return err + } + aup.AccountProperties = &accountProperties + } + } + } + + return nil +} + // Address address details. type Address struct { // FirstName - First Name. @@ -578,7 +718,7 @@ type AgreementProperties struct { type Amount struct { // Currency - READ-ONLY; The currency for the amount value. Currency *string `json:"currency,omitempty"` - // Value - READ-ONLY; Amount value. + // Value - Amount value. Value *float64 `json:"value,omitempty"` } @@ -785,7 +925,7 @@ type DownloadURL struct { // EnabledAzureSKUs details about the enabled azure sku. type EnabledAzureSKUs struct { - // SkuID - READ-ONLY; The sku id. + // SkuID - The sku id. SkuID *string `json:"skuId,omitempty"` // SkuDescription - READ-ONLY; The sku description. SkuDescription *string `json:"skuDescription,omitempty"` @@ -1091,6 +1231,14 @@ func (is *InvoiceSection) UnmarshalJSON(body []byte) error { return nil } +// InvoiceSectionCreationRequest the properties of an InvoiceSection. +type InvoiceSectionCreationRequest struct { + // DisplayName - The name of the InvoiceSection. + DisplayName *string `json:"displayName,omitempty"` + // BillingProfileID - The billing profile id. + BillingProfileID *string `json:"billingProfileId,omitempty"` +} + // InvoiceSectionListResult result of listing invoice sections. type InvoiceSectionListResult struct { autorest.Response `json:"-"` @@ -1245,8 +1393,8 @@ type InvoiceSummaryProperties struct { DueDate *date.Time `json:"dueDate,omitempty"` // InvoiceDate - READ-ONLY; The date when invoice was created. InvoiceDate *date.Time `json:"invoiceDate,omitempty"` - // Status - READ-ONLY; Invoice status. Possible values include: 'StatusPastDue', 'StatusDue', 'StatusPaid', 'StatusVoid' - Status Status `json:"status,omitempty"` + // Status - READ-ONLY; Invoice status. Possible values include: 'Status1PastDue', 'Status1Due', 'Status1Paid', 'Status1Void' + Status Status1 `json:"status,omitempty"` // AmountDue - READ-ONLY; Amount due. AmountDue *Amount `json:"amountDue,omitempty"` // BilledAmount - READ-ONLY; Amount billed. @@ -1267,6 +1415,120 @@ type InvoiceSummaryProperties struct { Payments *[]PaymentProperties `json:"payments,omitempty"` } +// LineOfCredit line of credit resource. +type LineOfCredit struct { + autorest.Response `json:"-"` + // LineOfCreditProperties - A line of credit. + *LineOfCreditProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LineOfCredit. +func (loc LineOfCredit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if loc.LineOfCreditProperties != nil { + objectMap["properties"] = loc.LineOfCreditProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LineOfCredit struct. +func (loc *LineOfCredit) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var lineOfCreditProperties LineOfCreditProperties + err = json.Unmarshal(*v, &lineOfCreditProperties) + if err != nil { + return err + } + loc.LineOfCreditProperties = &lineOfCreditProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + loc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + loc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + loc.Type = &typeVar + } + } + } + + return nil +} + +// LineOfCreditProperties the properties of the line of credit. +type LineOfCreditProperties struct { + // CreditLimit - The current credit limit. + CreditLimit *Amount `json:"creditLimit,omitempty"` + // Reason - READ-ONLY; The reason for the line of credit status when not approved. + Reason *string `json:"reason,omitempty"` + // RemainingBalance - READ-ONLY; Remaining balance. + RemainingBalance *Amount `json:"remainingBalance,omitempty"` + // Status - The line of credit status. Possible values include: 'Approved', 'Rejected' + Status Status `json:"status,omitempty"` +} + +// LineOfCreditsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type LineOfCreditsUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *LineOfCreditsUpdateFuture) Result(client LineOfCreditsClient) (loc LineOfCredit, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.LineOfCreditsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("billing.LineOfCreditsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if loc.Response.Response, err = future.GetResult(sender); err == nil && loc.Response.Response.StatusCode != http.StatusNoContent { + loc, err = client.UpdateResponder(loc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.LineOfCreditsUpdateFuture", "Result", loc.Response.Response, "Failure responding to request") + } + } + return +} + // Operation a Billing REST API operation. type Operation struct { // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}. @@ -2158,6 +2420,20 @@ func (p *Profile) UnmarshalJSON(body []byte) error { return nil } +// ProfileCreationParameters the parameters for creating a new billing profile. +type ProfileCreationParameters struct { + // DisplayName - The billing profile name. + DisplayName *string `json:"displayName,omitempty"` + // PoNumber - Purchase order number. + PoNumber *string `json:"poNumber,omitempty"` + // Address - Billing address. + Address *Address `json:"address,omitempty"` + // InvoiceEmailOptIn - If the billing profile is opted in to receive invoices via email. + InvoiceEmailOptIn *bool `json:"invoiceEmailOptIn,omitempty"` + // EnableAzureSKUs - Azure skus to enable for this billing profile.. + EnableAzureSKUs *[]EnabledAzureSKUs `json:"enableAzureSKUs,omitempty"` +} + // ProfileListResult result of listing billing profiles. type ProfileListResult struct { autorest.Response `json:"-"` @@ -2189,6 +2465,35 @@ type ProfileProperties struct { InvoiceSections *[]InvoiceSection `json:"invoiceSections,omitempty"` } +// ProfilesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ProfilesCreateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ProfilesCreateFuture) Result(client ProfilesClient) (p Profile, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProfilesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("billing.ProfilesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent { + p, err = client.CreateResponder(p.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProfilesCreateFuture", "Result", p.Response.Response, "Failure responding to request") + } + } + return +} + // ProfilesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type ProfilesUpdateFuture struct { @@ -2620,10 +2925,10 @@ type RoleAssignmentListResult struct { // RoleAssignmentPayload the payload use to update role assignment on a scope type RoleAssignmentPayload struct { - // PrincipalID - READ-ONLY; The user's principal id that the role gets assigned to + // PrincipalID - The user's principal id that the role gets assigned to PrincipalID *string `json:"principalId,omitempty"` - // BillingRoleDefinitionName - READ-ONLY; The role definition id - BillingRoleDefinitionName *string `json:"billingRoleDefinitionName,omitempty"` + // BillingRoleDefinitionID - The role definition id + BillingRoleDefinitionID *string `json:"billingRoleDefinitionId,omitempty"` } // RoleAssignmentProperties the properties of the a role assignment. @@ -3358,6 +3663,8 @@ func (tbsr *TransferBillingSubscriptionRequest) UnmarshalJSON(body []byte) error type TransferBillingSubscriptionRequestProperties struct { // DestinationInvoiceSectionID - The destination invoice section id. DestinationInvoiceSectionID *string `json:"destinationInvoiceSectionId,omitempty"` + // DestinationBillingProfileID - The destination billing profile id. + DestinationBillingProfileID *string `json:"destinationBillingProfileId,omitempty"` } // TransferBillingSubscriptionResult request parameters to transfer billing subscription. @@ -3594,8 +3901,10 @@ func NewTransferDetailsListResultPage(getNextPage func(context.Context, Transfer // TransferProductRequestProperties the properties of the product to initiate a transfer. type TransferProductRequestProperties struct { - // DestinationInvoiceSectionID - Destination invoice section id. + // DestinationInvoiceSectionID - The destination invoice section id. DestinationInvoiceSectionID *string `json:"destinationInvoiceSectionId,omitempty"` + // DestinationBillingProfileID - The destination billing profile id. + DestinationBillingProfileID *string `json:"destinationBillingProfileId,omitempty"` } // TransferProperties transfer details @@ -3684,3 +3993,41 @@ type ValidateAddressResponse struct { // ValidationMessage - Validation error message. ValidationMessage *string `json:"validationMessage,omitempty"` } + +// ValidateProductTransferEligibilityError error details of the product transfer eligibility validation. +type ValidateProductTransferEligibilityError struct { + // Code - Error code for the product transfer validation. Possible values include: 'InvalidSource', 'ProductNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', 'OneTimePurchaseProductTransferNotAllowed' + Code ProductTransferValidationErrorCode `json:"code,omitempty"` + // Message - The error message. + Message *string `json:"message,omitempty"` + // Details - Detailed error message explaining the error. + Details *string `json:"details,omitempty"` +} + +// ValidateProductTransferEligibilityResult result of the product transfer eligibility validation. +type ValidateProductTransferEligibilityResult struct { + autorest.Response `json:"-"` + // IsTransferEligible - READ-ONLY; Specifies whether the transfer is eligible or not. + IsTransferEligible *bool `json:"isTransferEligible,omitempty"` + // ErrorDetails - Validation error details. + ErrorDetails *ValidateProductTransferEligibilityError `json:"errorDetails,omitempty"` +} + +// ValidateSubscriptionTransferEligibilityError error details of the transfer eligibility validation +type ValidateSubscriptionTransferEligibilityError struct { + // Code - Error code for the product transfer validation. Possible values include: 'SubscriptionTransferValidationErrorCodeInvalidSource', 'SubscriptionTransferValidationErrorCodeSubscriptionNotActive', 'SubscriptionTransferValidationErrorCodeInsufficientPermissionOnSource', 'SubscriptionTransferValidationErrorCodeInsufficientPermissionOnDestination', 'SubscriptionTransferValidationErrorCodeDestinationBillingProfilePastDue', 'SubscriptionTransferValidationErrorCodeSubscriptionTypeNotSupported', 'SubscriptionTransferValidationErrorCodeCrossBillingAccountNotAllowed', 'SubscriptionTransferValidationErrorCodeNotAvailableForDestinationMarket' + Code SubscriptionTransferValidationErrorCode `json:"code,omitempty"` + // Message - The error message. + Message *string `json:"message,omitempty"` + // Details - Detailed error message explaining the error. + Details *string `json:"details,omitempty"` +} + +// ValidateSubscriptionTransferEligibilityResult result of the transfer eligibility validation. +type ValidateSubscriptionTransferEligibilityResult struct { + autorest.Response `json:"-"` + // IsTransferEligible - READ-ONLY; Specifies whether the transfer is eligible or not. + IsTransferEligible *bool `json:"isTransferEligible,omitempty"` + // ErrorDetails - Validation error details. + ErrorDetails *ValidateSubscriptionTransferEligibilityError `json:"errorDetails,omitempty"` +} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/products.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/products.go index 105baa3911d4..ae06bdc61f83 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/products.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/products.go @@ -558,3 +558,78 @@ func (client ProductsClient) UpdateAutoRenewByInvoiceSectionNameResponder(resp * result.Response = autorest.Response{Response: resp} return } + +// ValidateTransfer validates the transfer of products across invoice sections. +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +// productName - invoice Id. +// parameters - parameters supplied to the Transfer Products operation. +func (client ProductsClient) ValidateTransfer(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, parameters TransferProductRequestProperties) (result ValidateProductTransferEligibilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProductsClient.ValidateTransfer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ValidateTransferPreparer(ctx, billingAccountName, invoiceSectionName, productName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "ValidateTransfer", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateTransferSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "ValidateTransfer", resp, "Failure sending request") + return + } + + result, err = client.ValidateTransferResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "ValidateTransfer", resp, "Failure responding to request") + } + + return +} + +// ValidateTransferPreparer prepares the ValidateTransfer request. +func (client ProductsClient) ValidateTransferPreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, parameters TransferProductRequestProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "invoiceSectionName": autorest.Encode("path", invoiceSectionName), + "productName": autorest.Encode("path", productName), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/validateTransferEligibility", pathParameters), + autorest.WithJSON(parameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateTransferSender sends the ValidateTransfer request. The method will close the +// http.Response Body if it receives an error. +func (client ProductsClient) ValidateTransferSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ValidateTransferResponder handles the response to the ValidateTransfer request. The method always +// closes the http.Response Body. +func (client ProductsClient) ValidateTransferResponder(resp *http.Response) (result ValidateProductTransferEligibilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/profiles.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/profiles.go index 9a1816f2ede7..90e2d4bb91e3 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/profiles.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/profiles.go @@ -40,6 +40,83 @@ func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) Profile return ProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} } +// Create the operation to create a BillingProfile. +// Parameters: +// billingAccountName - billing Account Id. +// parameters - parameters supplied to the Create BillingProfile operation. +func (client ProfilesClient) Create(ctx context.Context, billingAccountName string, parameters ProfileCreationParameters) (result ProfilesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Create") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreatePreparer(ctx, billingAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProfilesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProfilesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ProfilesClient) CreatePreparer(ctx context.Context, billingAccountName string, parameters ProfileCreationParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) CreateSender(req *http.Request) (future ProfilesCreateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ProfilesClient) CreateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Get get the billing profile by id. // Parameters: // billingAccountName - billing Account Id. diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/roleassignments.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/roleassignments.go index a36a28825a23..aa5728b948db 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/roleassignments.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/roleassignments.go @@ -87,8 +87,6 @@ func (client RoleAssignmentsClient) AddByBillingAccountNamePreparer(ctx context. "api-version": APIVersion, } - parameters.PrincipalID = nil - parameters.BillingRoleDefinitionName = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), @@ -168,8 +166,6 @@ func (client RoleAssignmentsClient) AddByBillingProfileNamePreparer(ctx context. "api-version": APIVersion, } - parameters.PrincipalID = nil - parameters.BillingRoleDefinitionName = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), @@ -249,8 +245,6 @@ func (client RoleAssignmentsClient) AddByInvoiceSectionNamePreparer(ctx context. "api-version": APIVersion, } - parameters.PrincipalID = nil - parameters.BillingRoleDefinitionName = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptions.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptions.go index f07d50706cd4..300f8fb73f31 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptions.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptions.go @@ -456,3 +456,78 @@ func (client SubscriptionsClient) TransferResponder(resp *http.Response) (result result.Response = autorest.Response{Response: resp} return } + +// ValidateTransfer validates the transfer of billing subscriptions across invoice sections. +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +// billingSubscriptionName - billing Subscription Id. +// parameters - parameters supplied to the Transfer Billing Subscription operation. +func (client SubscriptionsClient) ValidateTransfer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string, parameters TransferBillingSubscriptionRequestProperties) (result ValidateSubscriptionTransferEligibilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.ValidateTransfer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ValidateTransferPreparer(ctx, billingAccountName, invoiceSectionName, billingSubscriptionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ValidateTransfer", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateTransferSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ValidateTransfer", resp, "Failure sending request") + return + } + + result, err = client.ValidateTransferResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ValidateTransfer", resp, "Failure responding to request") + } + + return +} + +// ValidateTransferPreparer prepares the ValidateTransfer request. +func (client SubscriptionsClient) ValidateTransferPreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string, parameters TransferBillingSubscriptionRequestProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingSubscriptionName": autorest.Encode("path", billingSubscriptionName), + "invoiceSectionName": autorest.Encode("path", invoiceSectionName), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/validateTransferEligibility", pathParameters), + autorest.WithJSON(parameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateTransferSender sends the ValidateTransfer request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) ValidateTransferSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ValidateTransferResponder handles the response to the ValidateTransfer request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) ValidateTransferResponder(resp *http.Response) (result ValidateSubscriptionTransferEligibilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +}