From 7a2838bc19190d6164b6072b28ea30c27847fd5d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 29 Mar 2019 15:59:03 +0000 Subject: [PATCH] Generated from 500edc5f2eb47bc507a3b25a61d575530ba33675 InvoiceSection_ElevateToBillingProfile -> InvoiceSections_ElevateToBillingProfile. --- .../billing/billingapi/interfaces.go | 3 + .../billing/invoicesections.go | 145 ++++++++++++++++++ .../invoicesectionsbybillingaccountname.go | 2 +- ...ectionswithcreatesubscriptionpermission.go | 2 +- .../mgmt/2018-11-01-preview/billing/models.go | 4 +- 5 files changed, 152 insertions(+), 4 deletions(-) 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 280a25ff4195..d3977eaf4eb6 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 @@ -20,6 +20,7 @@ package billingapi import ( "context" "github.com/Azure/azure-sdk-for-go/services/preview/billing/mgmt/2018-11-01-preview/billing" + "github.com/Azure/go-autorest/autorest" ) // BaseClientAPI contains the set of methods on the BaseClient type. @@ -85,7 +86,9 @@ var _ InvoiceSectionsByBillingAccountNameClientAPI = (*billing.InvoiceSectionsBy // 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) + 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) + ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.InvoiceSectionListResult, err error) Update(ctx context.Context, billingAccountName string, invoiceSectionName string, parameters billing.InvoiceSection) (result billing.InvoiceSectionsUpdateFuture, err error) } 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 b6b53d07a515..0c9c42d47af6 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 @@ -117,6 +117,75 @@ func (client InvoiceSectionsClient) CreateResponder(resp *http.Response) (result return } +// ElevateToBillingProfile elevates the caller's access to match their billing profile access. +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +func (client InvoiceSectionsClient) ElevateToBillingProfile(ctx context.Context, billingAccountName string, invoiceSectionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionsClient.ElevateToBillingProfile") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ElevateToBillingProfilePreparer(ctx, billingAccountName, invoiceSectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsClient", "ElevateToBillingProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ElevateToBillingProfileSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsClient", "ElevateToBillingProfile", resp, "Failure sending request") + return + } + + result, err = client.ElevateToBillingProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsClient", "ElevateToBillingProfile", resp, "Failure responding to request") + } + + return +} + +// ElevateToBillingProfilePreparer prepares the ElevateToBillingProfile request. +func (client InvoiceSectionsClient) ElevateToBillingProfilePreparer(ctx context.Context, billingAccountName string, invoiceSectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "invoiceSectionName": autorest.Encode("path", invoiceSectionName), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/elevate", pathParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ElevateToBillingProfileSender sends the ElevateToBillingProfile request. The method will close the +// http.Response Body if it receives an error. +func (client InvoiceSectionsClient) ElevateToBillingProfileSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ElevateToBillingProfileResponder handles the response to the ElevateToBillingProfile request. The method always +// closes the http.Response Body. +func (client InvoiceSectionsClient) ElevateToBillingProfileResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + // Get get the InvoiceSection by id. // Parameters: // billingAccountName - billing Account Id. @@ -197,6 +266,82 @@ func (client InvoiceSectionsClient) GetResponder(resp *http.Response) (result In return } +// ListByBillingProfileName lists all invoice sections under a billing profile for a user which he has access to. +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +func (client InvoiceSectionsClient) ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result InvoiceSectionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionsClient.ListByBillingProfileName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByBillingProfileNamePreparer(ctx, billingAccountName, billingProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsClient", "ListByBillingProfileName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingProfileNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsClient", "ListByBillingProfileName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingProfileNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsClient", "ListByBillingProfileName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingProfileNamePreparer prepares the ListByBillingProfileName request. +func (client InvoiceSectionsClient) ListByBillingProfileNamePreparer(ctx context.Context, billingAccountName string, billingProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingProfileName": autorest.Encode("path", billingProfileName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBillingProfileNameSender sends the ListByBillingProfileName request. The method will close the +// http.Response Body if it receives an error. +func (client InvoiceSectionsClient) ListByBillingProfileNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByBillingProfileNameResponder handles the response to the ListByBillingProfileName request. The method always +// closes the http.Response Body. +func (client InvoiceSectionsClient) ListByBillingProfileNameResponder(resp *http.Response) (result InvoiceSectionListResult, 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 the operation to update a InvoiceSection. // Parameters: // billingAccountName - billing Account Id. diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionsbybillingaccountname.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionsbybillingaccountname.go index 53421e61167d..e2a46dd86e12 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionsbybillingaccountname.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionsbybillingaccountname.go @@ -114,7 +114,7 @@ func (client InvoiceSectionsByBillingAccountNameClient) ListResponder(resp *http err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionswithcreatesubscriptionpermission.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionswithcreatesubscriptionpermission.go index 2348a3045a23..f94e2b820c55 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionswithcreatesubscriptionpermission.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionswithcreatesubscriptionpermission.go @@ -114,7 +114,7 @@ func (client InvoiceSectionsWithCreateSubscriptionPermissionClient) ListResponde err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} 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 46fad9783176..85c81de7c112 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 @@ -1766,7 +1766,7 @@ type PolicyProperties struct { // ProductDetails details of the product to be transferred. type ProductDetails struct { - // ProductType - Type of the prouct to be transferred. Possible values include: 'ProductTypeAzureSubscription', 'ProductTypeAzureReservation' + // ProductType - Type of the product to be transferred. Possible values include: 'ProductTypeAzureSubscription', 'ProductTypeAzureReservation' ProductType ProductType `json:"productType,omitempty"` // ProductID - Id of product to be transferred. ProductID *string `json:"productId,omitempty"` @@ -3530,7 +3530,7 @@ type TransferProperties struct { CreationTime *date.Time `json:"creationTime,omitempty"` // ExpirationTime - Transfer expiration time. ExpirationTime *date.Time `json:"expirationTime,omitempty"` - // InvoiceSectionID - Target invoice setion Id. + // InvoiceSectionID - Target invoice section Id. InvoiceSectionID *string `json:"invoiceSectionId,omitempty"` // BillingAccountID - Target billing account Id. BillingAccountID *string `json:"billingAccountId,omitempty"`