From 8580554a790e183d9b676e31852d3f645d7b12de Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 6 Apr 2018 14:53:10 -0700 Subject: [PATCH] Generated from def63250017ef0071aadd68a751623913f788af3 (#1525) Updated path Updated path --- .../mgmt/2018-03-31/consumption/budgets.go | 8 +- .../mgmt/2018-03-31/consumption/client.go | 8 +- .../consumption/costallocationtags.go | 174 ++++++++++++++++++ .../2018-03-31/consumption/marketplaces.go | 8 +- .../mgmt/2018-03-31/consumption/models.go | 107 +++++++++++ .../mgmt/2018-03-31/consumption/operations.go | 8 +- .../mgmt/2018-03-31/consumption/pricesheet.go | 8 +- .../consumption/reservationrecommendations.go | 8 +- .../consumption/reservationsdetails.go | 8 +- .../consumption/reservationssummaries.go | 41 +++-- .../2018-03-31/consumption/usagedetails.go | 8 +- 11 files changed, 333 insertions(+), 53 deletions(-) create mode 100644 services/consumption/mgmt/2018-03-31/consumption/costallocationtags.go diff --git a/services/consumption/mgmt/2018-03-31/consumption/budgets.go b/services/consumption/mgmt/2018-03-31/consumption/budgets.go index e4c57f0555a0..69cb26c491ea 100644 --- a/services/consumption/mgmt/2018-03-31/consumption/budgets.go +++ b/services/consumption/mgmt/2018-03-31/consumption/budgets.go @@ -32,13 +32,13 @@ type BudgetsClient struct { } // NewBudgetsClient creates an instance of the BudgetsClient client. -func NewBudgetsClient(subscriptionID string, grain Datagrain) BudgetsClient { - return NewBudgetsClientWithBaseURI(DefaultBaseURI, subscriptionID, grain) +func NewBudgetsClient(subscriptionID string) BudgetsClient { + return NewBudgetsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewBudgetsClientWithBaseURI creates an instance of the BudgetsClient client. -func NewBudgetsClientWithBaseURI(baseURI string, subscriptionID string, grain Datagrain) BudgetsClient { - return BudgetsClient{NewWithBaseURI(baseURI, subscriptionID, grain)} +func NewBudgetsClientWithBaseURI(baseURI string, subscriptionID string) BudgetsClient { + return BudgetsClient{NewWithBaseURI(baseURI, subscriptionID)} } // CreateOrUpdate the operation to create or update a budget. Update operation requires latest eTag to be set in the diff --git a/services/consumption/mgmt/2018-03-31/consumption/client.go b/services/consumption/mgmt/2018-03-31/consumption/client.go index 495938bd8338..8fdda610a9f5 100644 --- a/services/consumption/mgmt/2018-03-31/consumption/client.go +++ b/services/consumption/mgmt/2018-03-31/consumption/client.go @@ -34,20 +34,18 @@ type BaseClient struct { autorest.Client BaseURI string SubscriptionID string - Grain Datagrain } // New creates an instance of the BaseClient client. -func New(subscriptionID string, grain Datagrain) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID, grain) +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) } // NewWithBaseURI creates an instance of the BaseClient client. -func NewWithBaseURI(baseURI string, subscriptionID string, grain Datagrain) BaseClient { +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return BaseClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, SubscriptionID: subscriptionID, - Grain: grain, } } diff --git a/services/consumption/mgmt/2018-03-31/consumption/costallocationtags.go b/services/consumption/mgmt/2018-03-31/consumption/costallocationtags.go new file mode 100644 index 000000000000..082add1a9632 --- /dev/null +++ b/services/consumption/mgmt/2018-03-31/consumption/costallocationtags.go @@ -0,0 +1,174 @@ +package consumption + +// 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" + "net/http" +) + +// CostAllocationTagsClient is the consumption management client provides access to consumption resources for Azure +// Enterprise Subscriptions. +type CostAllocationTagsClient struct { + BaseClient +} + +// NewCostAllocationTagsClient creates an instance of the CostAllocationTagsClient client. +func NewCostAllocationTagsClient(subscriptionID string) CostAllocationTagsClient { + return NewCostAllocationTagsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCostAllocationTagsClientWithBaseURI creates an instance of the CostAllocationTagsClient client. +func NewCostAllocationTagsClientWithBaseURI(baseURI string, subscriptionID string) CostAllocationTagsClient { + return CostAllocationTagsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the operation to create or update cost allocation tags assiciated with a billing account. Update +// operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a +// get operation. Create operation does not require eTag. +// +// billingAccountID is azure Billing Account ID. parameters is parameters supplied to the Create cost allocation +// tags operation. +func (client CostAllocationTagsClient) CreateOrUpdate(ctx context.Context, billingAccountID string, parameters CostAllocationTags) (result CostAllocationTags, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, billingAccountID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "consumption.CostAllocationTagsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "consumption.CostAllocationTagsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "consumption.CostAllocationTagsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CostAllocationTagsClient) CreateOrUpdatePreparer(ctx context.Context, billingAccountID string, parameters CostAllocationTags) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountId": autorest.Encode("path", billingAccountID), + } + + const APIVersion = "2018-03-31" + 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("/providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costAllocationTags", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CostAllocationTagsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CostAllocationTagsClient) CreateOrUpdateResponder(resp *http.Response) (result CostAllocationTags, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get cost allocation tags for a billing account. +// +// billingAccountID is azure Billing Account ID. +func (client CostAllocationTagsClient) Get(ctx context.Context, billingAccountID string) (result CostAllocationTags, err error) { + req, err := client.GetPreparer(ctx, billingAccountID) + if err != nil { + err = autorest.NewErrorWithError(err, "consumption.CostAllocationTagsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "consumption.CostAllocationTagsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "consumption.CostAllocationTagsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client CostAllocationTagsClient) GetPreparer(ctx context.Context, billingAccountID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountId": autorest.Encode("path", billingAccountID), + } + + const APIVersion = "2018-03-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costAllocationTags", 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 CostAllocationTagsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CostAllocationTagsClient) GetResponder(resp *http.Response) (result CostAllocationTags, 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/consumption/mgmt/2018-03-31/consumption/marketplaces.go b/services/consumption/mgmt/2018-03-31/consumption/marketplaces.go index b1f30daca9ab..e6691954ac3e 100644 --- a/services/consumption/mgmt/2018-03-31/consumption/marketplaces.go +++ b/services/consumption/mgmt/2018-03-31/consumption/marketplaces.go @@ -32,13 +32,13 @@ type MarketplacesClient struct { } // NewMarketplacesClient creates an instance of the MarketplacesClient client. -func NewMarketplacesClient(subscriptionID string, grain Datagrain) MarketplacesClient { - return NewMarketplacesClientWithBaseURI(DefaultBaseURI, subscriptionID, grain) +func NewMarketplacesClient(subscriptionID string) MarketplacesClient { + return NewMarketplacesClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewMarketplacesClientWithBaseURI creates an instance of the MarketplacesClient client. -func NewMarketplacesClientWithBaseURI(baseURI string, subscriptionID string, grain Datagrain) MarketplacesClient { - return MarketplacesClient{NewWithBaseURI(baseURI, subscriptionID, grain)} +func NewMarketplacesClientWithBaseURI(baseURI string, subscriptionID string) MarketplacesClient { + return MarketplacesClient{NewWithBaseURI(baseURI, subscriptionID)} } // List lists the marketplaces for a scope by subscriptionId. Marketplaces are available via this API only for May 1, diff --git a/services/consumption/mgmt/2018-03-31/consumption/models.go b/services/consumption/mgmt/2018-03-31/consumption/models.go index d011c22bc063..82e71de8b42c 100644 --- a/services/consumption/mgmt/2018-03-31/consumption/models.go +++ b/services/consumption/mgmt/2018-03-31/consumption/models.go @@ -341,6 +341,113 @@ type BudgetTimePeriod struct { EndDate *date.Time `json:"endDate,omitempty"` } +// CostAllocationTag the cost allocation tag. +type CostAllocationTag struct { + // Key - Cost allocation tag key. + Key *string `json:"key,omitempty"` +} + +// CostAllocationTagProperties the properties of the cost allocation tag. +type CostAllocationTagProperties struct { + // CostAllocationTags - Cost allocation tags. + CostAllocationTags *[]CostAllocationTag `json:"costAllocationTags,omitempty"` +} + +// CostAllocationTags a cost allocation tag resource. +type CostAllocationTags struct { + autorest.Response `json:"-"` + *CostAllocationTagProperties `json:"properties,omitempty"` + // ID - Resource Id. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ETag - eTag of the resource. To handle concurrent update scenarion, this field will be used to determine whether the user is updating the latest version or not. + ETag *string `json:"eTag,omitempty"` +} + +// MarshalJSON is the custom marshaler for CostAllocationTags. +func (cat CostAllocationTags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cat.CostAllocationTagProperties != nil { + objectMap["properties"] = cat.CostAllocationTagProperties + } + if cat.ID != nil { + objectMap["id"] = cat.ID + } + if cat.Name != nil { + objectMap["name"] = cat.Name + } + if cat.Type != nil { + objectMap["type"] = cat.Type + } + if cat.ETag != nil { + objectMap["eTag"] = cat.ETag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CostAllocationTags struct. +func (cat *CostAllocationTags) 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 costAllocationTagProperties CostAllocationTagProperties + err = json.Unmarshal(*v, &costAllocationTagProperties) + if err != nil { + return err + } + cat.CostAllocationTagProperties = &costAllocationTagProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cat.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cat.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cat.Type = &typeVar + } + case "eTag": + if v != nil { + var eTag string + err = json.Unmarshal(*v, &eTag) + if err != nil { + return err + } + cat.ETag = &eTag + } + } + } + + return nil +} + // CurrentSpend the current amount of cost which is being tracked for a budget. type CurrentSpend struct { // Amount - The total amount of cost which is being tracked by the budget. diff --git a/services/consumption/mgmt/2018-03-31/consumption/operations.go b/services/consumption/mgmt/2018-03-31/consumption/operations.go index c108a0ef8e6c..f563ad8a87d5 100644 --- a/services/consumption/mgmt/2018-03-31/consumption/operations.go +++ b/services/consumption/mgmt/2018-03-31/consumption/operations.go @@ -31,13 +31,13 @@ type OperationsClient struct { } // NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string, grain Datagrain) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID, grain) +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, grain Datagrain) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID, grain)} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // List lists all of the available consumption REST API operations. diff --git a/services/consumption/mgmt/2018-03-31/consumption/pricesheet.go b/services/consumption/mgmt/2018-03-31/consumption/pricesheet.go index ce5e9a637bf9..90275fbd1f86 100644 --- a/services/consumption/mgmt/2018-03-31/consumption/pricesheet.go +++ b/services/consumption/mgmt/2018-03-31/consumption/pricesheet.go @@ -32,13 +32,13 @@ type PriceSheetClient struct { } // NewPriceSheetClient creates an instance of the PriceSheetClient client. -func NewPriceSheetClient(subscriptionID string, grain Datagrain) PriceSheetClient { - return NewPriceSheetClientWithBaseURI(DefaultBaseURI, subscriptionID, grain) +func NewPriceSheetClient(subscriptionID string) PriceSheetClient { + return NewPriceSheetClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewPriceSheetClientWithBaseURI creates an instance of the PriceSheetClient client. -func NewPriceSheetClientWithBaseURI(baseURI string, subscriptionID string, grain Datagrain) PriceSheetClient { - return PriceSheetClient{NewWithBaseURI(baseURI, subscriptionID, grain)} +func NewPriceSheetClientWithBaseURI(baseURI string, subscriptionID string) PriceSheetClient { + return PriceSheetClient{NewWithBaseURI(baseURI, subscriptionID)} } // Get gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 diff --git a/services/consumption/mgmt/2018-03-31/consumption/reservationrecommendations.go b/services/consumption/mgmt/2018-03-31/consumption/reservationrecommendations.go index c1a6119a548b..7428fff7d5e6 100644 --- a/services/consumption/mgmt/2018-03-31/consumption/reservationrecommendations.go +++ b/services/consumption/mgmt/2018-03-31/consumption/reservationrecommendations.go @@ -31,13 +31,13 @@ type ReservationRecommendationsClient struct { } // NewReservationRecommendationsClient creates an instance of the ReservationRecommendationsClient client. -func NewReservationRecommendationsClient(subscriptionID string, grain Datagrain) ReservationRecommendationsClient { - return NewReservationRecommendationsClientWithBaseURI(DefaultBaseURI, subscriptionID, grain) +func NewReservationRecommendationsClient(subscriptionID string) ReservationRecommendationsClient { + return NewReservationRecommendationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewReservationRecommendationsClientWithBaseURI creates an instance of the ReservationRecommendationsClient client. -func NewReservationRecommendationsClientWithBaseURI(baseURI string, subscriptionID string, grain Datagrain) ReservationRecommendationsClient { - return ReservationRecommendationsClient{NewWithBaseURI(baseURI, subscriptionID, grain)} +func NewReservationRecommendationsClientWithBaseURI(baseURI string, subscriptionID string) ReservationRecommendationsClient { + return ReservationRecommendationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // List list of recomendations for purchasing reserved instances. diff --git a/services/consumption/mgmt/2018-03-31/consumption/reservationsdetails.go b/services/consumption/mgmt/2018-03-31/consumption/reservationsdetails.go index 1f1566bc2138..c1369b8dee8b 100644 --- a/services/consumption/mgmt/2018-03-31/consumption/reservationsdetails.go +++ b/services/consumption/mgmt/2018-03-31/consumption/reservationsdetails.go @@ -31,13 +31,13 @@ type ReservationsDetailsClient struct { } // NewReservationsDetailsClient creates an instance of the ReservationsDetailsClient client. -func NewReservationsDetailsClient(subscriptionID string, grain Datagrain) ReservationsDetailsClient { - return NewReservationsDetailsClientWithBaseURI(DefaultBaseURI, subscriptionID, grain) +func NewReservationsDetailsClient(subscriptionID string) ReservationsDetailsClient { + return NewReservationsDetailsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewReservationsDetailsClientWithBaseURI creates an instance of the ReservationsDetailsClient client. -func NewReservationsDetailsClientWithBaseURI(baseURI string, subscriptionID string, grain Datagrain) ReservationsDetailsClient { - return ReservationsDetailsClient{NewWithBaseURI(baseURI, subscriptionID, grain)} +func NewReservationsDetailsClientWithBaseURI(baseURI string, subscriptionID string) ReservationsDetailsClient { + return ReservationsDetailsClient{NewWithBaseURI(baseURI, subscriptionID)} } // ListByReservationOrder lists the reservations details for provided date range. diff --git a/services/consumption/mgmt/2018-03-31/consumption/reservationssummaries.go b/services/consumption/mgmt/2018-03-31/consumption/reservationssummaries.go index 59f106458c56..8c9cd5d13604 100644 --- a/services/consumption/mgmt/2018-03-31/consumption/reservationssummaries.go +++ b/services/consumption/mgmt/2018-03-31/consumption/reservationssummaries.go @@ -31,22 +31,22 @@ type ReservationsSummariesClient struct { } // NewReservationsSummariesClient creates an instance of the ReservationsSummariesClient client. -func NewReservationsSummariesClient(subscriptionID string, grain Datagrain) ReservationsSummariesClient { - return NewReservationsSummariesClientWithBaseURI(DefaultBaseURI, subscriptionID, grain) +func NewReservationsSummariesClient(subscriptionID string) ReservationsSummariesClient { + return NewReservationsSummariesClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewReservationsSummariesClientWithBaseURI creates an instance of the ReservationsSummariesClient client. -func NewReservationsSummariesClientWithBaseURI(baseURI string, subscriptionID string, grain Datagrain) ReservationsSummariesClient { - return ReservationsSummariesClient{NewWithBaseURI(baseURI, subscriptionID, grain)} +func NewReservationsSummariesClientWithBaseURI(baseURI string, subscriptionID string) ReservationsSummariesClient { + return ReservationsSummariesClient{NewWithBaseURI(baseURI, subscriptionID)} } // ListByReservationOrder lists the reservations summaries for daily or monthly grain. // -// reservationOrderID is order Id of the reservation filter is required only for daily grain. The -// properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' -func (client ReservationsSummariesClient) ListByReservationOrder(ctx context.Context, reservationOrderID string, filter string) (result ReservationSummariesListResultPage, err error) { +// reservationOrderID is order Id of the reservation grain is can be daily or monthly filter is required only for +// daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' +func (client ReservationsSummariesClient) ListByReservationOrder(ctx context.Context, reservationOrderID string, grain Datagrain, filter string) (result ReservationSummariesListResultPage, err error) { result.fn = client.listByReservationOrderNextResults - req, err := client.ListByReservationOrderPreparer(ctx, reservationOrderID, filter) + req, err := client.ListByReservationOrderPreparer(ctx, reservationOrderID, grain, filter) if err != nil { err = autorest.NewErrorWithError(err, "consumption.ReservationsSummariesClient", "ListByReservationOrder", nil, "Failure preparing request") return @@ -68,7 +68,7 @@ func (client ReservationsSummariesClient) ListByReservationOrder(ctx context.Con } // ListByReservationOrderPreparer prepares the ListByReservationOrder request. -func (client ReservationsSummariesClient) ListByReservationOrderPreparer(ctx context.Context, reservationOrderID string, filter string) (*http.Request, error) { +func (client ReservationsSummariesClient) ListByReservationOrderPreparer(ctx context.Context, reservationOrderID string, grain Datagrain, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ "reservationOrderId": autorest.Encode("path", reservationOrderID), } @@ -76,7 +76,7 @@ func (client ReservationsSummariesClient) ListByReservationOrderPreparer(ctx con const APIVersion = "2018-03-31" queryParameters := map[string]interface{}{ "api-version": APIVersion, - "grain": autorest.Encode("query", client.Grain), + "grain": autorest.Encode("query", grain), } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -132,18 +132,19 @@ func (client ReservationsSummariesClient) listByReservationOrderNextResults(last } // ListByReservationOrderComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReservationsSummariesClient) ListByReservationOrderComplete(ctx context.Context, reservationOrderID string, filter string) (result ReservationSummariesListResultIterator, err error) { - result.page, err = client.ListByReservationOrder(ctx, reservationOrderID, filter) +func (client ReservationsSummariesClient) ListByReservationOrderComplete(ctx context.Context, reservationOrderID string, grain Datagrain, filter string) (result ReservationSummariesListResultIterator, err error) { + result.page, err = client.ListByReservationOrder(ctx, reservationOrderID, grain, filter) return } // ListByReservationOrderAndReservation lists the reservations summaries for daily or monthly grain. // -// reservationOrderID is order Id of the reservation reservationID is id of the reservation filter is required only -// for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' -func (client ReservationsSummariesClient) ListByReservationOrderAndReservation(ctx context.Context, reservationOrderID string, reservationID string, filter string) (result ReservationSummariesListResultPage, err error) { +// reservationOrderID is order Id of the reservation reservationID is id of the reservation grain is can be daily +// or monthly filter is required only for daily grain. The properties/UsageDate for start date and end date. The +// filter supports 'le' and 'ge' +func (client ReservationsSummariesClient) ListByReservationOrderAndReservation(ctx context.Context, reservationOrderID string, reservationID string, grain Datagrain, filter string) (result ReservationSummariesListResultPage, err error) { result.fn = client.listByReservationOrderAndReservationNextResults - req, err := client.ListByReservationOrderAndReservationPreparer(ctx, reservationOrderID, reservationID, filter) + req, err := client.ListByReservationOrderAndReservationPreparer(ctx, reservationOrderID, reservationID, grain, filter) if err != nil { err = autorest.NewErrorWithError(err, "consumption.ReservationsSummariesClient", "ListByReservationOrderAndReservation", nil, "Failure preparing request") return @@ -165,7 +166,7 @@ func (client ReservationsSummariesClient) ListByReservationOrderAndReservation(c } // ListByReservationOrderAndReservationPreparer prepares the ListByReservationOrderAndReservation request. -func (client ReservationsSummariesClient) ListByReservationOrderAndReservationPreparer(ctx context.Context, reservationOrderID string, reservationID string, filter string) (*http.Request, error) { +func (client ReservationsSummariesClient) ListByReservationOrderAndReservationPreparer(ctx context.Context, reservationOrderID string, reservationID string, grain Datagrain, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ "reservationId": autorest.Encode("path", reservationID), "reservationOrderId": autorest.Encode("path", reservationOrderID), @@ -174,7 +175,7 @@ func (client ReservationsSummariesClient) ListByReservationOrderAndReservationPr const APIVersion = "2018-03-31" queryParameters := map[string]interface{}{ "api-version": APIVersion, - "grain": autorest.Encode("query", client.Grain), + "grain": autorest.Encode("query", grain), } if len(filter) > 0 { queryParameters["$filter"] = autorest.Encode("query", filter) @@ -230,7 +231,7 @@ func (client ReservationsSummariesClient) listByReservationOrderAndReservationNe } // ListByReservationOrderAndReservationComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReservationsSummariesClient) ListByReservationOrderAndReservationComplete(ctx context.Context, reservationOrderID string, reservationID string, filter string) (result ReservationSummariesListResultIterator, err error) { - result.page, err = client.ListByReservationOrderAndReservation(ctx, reservationOrderID, reservationID, filter) +func (client ReservationsSummariesClient) ListByReservationOrderAndReservationComplete(ctx context.Context, reservationOrderID string, reservationID string, grain Datagrain, filter string) (result ReservationSummariesListResultIterator, err error) { + result.page, err = client.ListByReservationOrderAndReservation(ctx, reservationOrderID, reservationID, grain, filter) return } diff --git a/services/consumption/mgmt/2018-03-31/consumption/usagedetails.go b/services/consumption/mgmt/2018-03-31/consumption/usagedetails.go index 28e58f195a4e..ebfb7ffdbec5 100644 --- a/services/consumption/mgmt/2018-03-31/consumption/usagedetails.go +++ b/services/consumption/mgmt/2018-03-31/consumption/usagedetails.go @@ -32,13 +32,13 @@ type UsageDetailsClient struct { } // NewUsageDetailsClient creates an instance of the UsageDetailsClient client. -func NewUsageDetailsClient(subscriptionID string, grain Datagrain) UsageDetailsClient { - return NewUsageDetailsClientWithBaseURI(DefaultBaseURI, subscriptionID, grain) +func NewUsageDetailsClient(subscriptionID string) UsageDetailsClient { + return NewUsageDetailsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewUsageDetailsClientWithBaseURI creates an instance of the UsageDetailsClient client. -func NewUsageDetailsClientWithBaseURI(baseURI string, subscriptionID string, grain Datagrain) UsageDetailsClient { - return UsageDetailsClient{NewWithBaseURI(baseURI, subscriptionID, grain)} +func NewUsageDetailsClientWithBaseURI(baseURI string, subscriptionID string) UsageDetailsClient { + return UsageDetailsClient{NewWithBaseURI(baseURI, subscriptionID)} } // List lists the usage details for a scope by billing period. Usage details are available via this API only for May 1,