From 545ee83fa42e6de600dd36ea8cbfa50d1f1d5326 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 30 Mar 2018 01:10:47 +0000 Subject: [PATCH] Generated from 7a1976a9842c462ccb967f734612f1257b429ca0 Make filter a method paramter --- .../2017-04-18/cognitiveservices/accounts.go | 21 ++++++++++--------- .../cognitiveservices/checkskuavailability.go | 8 +++---- .../2017-04-18/cognitiveservices/client.go | 8 +++---- .../cognitiveservices/operations.go | 8 +++---- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/accounts.go b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/accounts.go index 7ff9ac9c7ca9..818d3885deb8 100644 --- a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/accounts.go +++ b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/accounts.go @@ -31,13 +31,13 @@ type AccountsClient struct { } // NewAccountsClient creates an instance of the AccountsClient client. -func NewAccountsClient(subscriptionID string, filter string) AccountsClient { - return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID, filter) +func NewAccountsClient(subscriptionID string) AccountsClient { + return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewAccountsClientWithBaseURI creates an instance of the AccountsClient client. -func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string, filter string) AccountsClient { - return AccountsClient{NewWithBaseURI(baseURI, subscriptionID, filter)} +func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { + return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} } // Create create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for @@ -274,8 +274,9 @@ func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result // GetUsages get usages for the requested Cognitive Services account // // resourceGroupName is the name of the resource group within the user's subscription. accountName is the name of -// Cognitive Services account. -func (client AccountsClient) GetUsages(ctx context.Context, resourceGroupName string, accountName string) (result UsagesResult, err error) { +// Cognitive Services account. filter is an OData filter expression that describes a subset of usages to return. +// The supported parameter is name.value (name of the metric, can have an or of multiple names). +func (client AccountsClient) GetUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result UsagesResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: accountName, Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, @@ -284,7 +285,7 @@ func (client AccountsClient) GetUsages(ctx context.Context, resourceGroupName st return result, validation.NewError("cognitiveservices.AccountsClient", "GetUsages", err.Error()) } - req, err := client.GetUsagesPreparer(ctx, resourceGroupName, accountName) + req, err := client.GetUsagesPreparer(ctx, resourceGroupName, accountName, filter) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "GetUsages", nil, "Failure preparing request") return @@ -306,7 +307,7 @@ func (client AccountsClient) GetUsages(ctx context.Context, resourceGroupName st } // GetUsagesPreparer prepares the GetUsages request. -func (client AccountsClient) GetUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { +func (client AccountsClient) GetUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -317,8 +318,8 @@ func (client AccountsClient) GetUsagesPreparer(ctx context.Context, resourceGrou queryParameters := map[string]interface{}{ "api-version": APIVersion, } - if len(client.Filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", client.Filter) + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) } preparer := autorest.CreatePreparer( diff --git a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/checkskuavailability.go b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/checkskuavailability.go index 35b3ec58079f..a499923c7e65 100644 --- a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/checkskuavailability.go +++ b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/checkskuavailability.go @@ -31,13 +31,13 @@ type CheckSkuAvailabilityClient struct { } // NewCheckSkuAvailabilityClient creates an instance of the CheckSkuAvailabilityClient client. -func NewCheckSkuAvailabilityClient(subscriptionID string, filter string) CheckSkuAvailabilityClient { - return NewCheckSkuAvailabilityClientWithBaseURI(DefaultBaseURI, subscriptionID, filter) +func NewCheckSkuAvailabilityClient(subscriptionID string) CheckSkuAvailabilityClient { + return NewCheckSkuAvailabilityClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewCheckSkuAvailabilityClientWithBaseURI creates an instance of the CheckSkuAvailabilityClient client. -func NewCheckSkuAvailabilityClientWithBaseURI(baseURI string, subscriptionID string, filter string) CheckSkuAvailabilityClient { - return CheckSkuAvailabilityClient{NewWithBaseURI(baseURI, subscriptionID, filter)} +func NewCheckSkuAvailabilityClientWithBaseURI(baseURI string, subscriptionID string) CheckSkuAvailabilityClient { + return CheckSkuAvailabilityClient{NewWithBaseURI(baseURI, subscriptionID)} } // List check available SKUs. diff --git a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/client.go b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/client.go index 04b153f1d7a1..83d2865d93df 100644 --- a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/client.go +++ b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/client.go @@ -34,20 +34,18 @@ type BaseClient struct { autorest.Client BaseURI string SubscriptionID string - Filter string } // New creates an instance of the BaseClient client. -func New(subscriptionID string, filter string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID, filter) +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) } // NewWithBaseURI creates an instance of the BaseClient client. -func NewWithBaseURI(baseURI string, subscriptionID string, filter string) BaseClient { +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return BaseClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, SubscriptionID: subscriptionID, - Filter: filter, } } diff --git a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/operations.go b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/operations.go index ce0e5519bb2a..997e891b497a 100644 --- a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/operations.go +++ b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/operations.go @@ -30,13 +30,13 @@ type OperationsClient struct { } // NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string, filter string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID, filter) +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, filter string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID, filter)} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // List lists all the available Cognitive Services account operations.