diff --git a/profiles/latest/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go b/profiles/latest/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go index f580fe74d7bd..42eca8c78f11 100644 --- a/profiles/latest/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go +++ b/profiles/latest/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go @@ -23,6 +23,5 @@ import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mg type AccountsClientAPI = original.AccountsClientAPI type BaseClientAPI = original.BaseClientAPI -type CheckSkuAvailabilityClientAPI = original.CheckSkuAvailabilityClientAPI type OperationsClientAPI = original.OperationsClientAPI type ResourceSkusClientAPI = original.ResourceSkusClientAPI diff --git a/profiles/latest/cognitiveservices/mgmt/cognitiveservices/models.go b/profiles/latest/cognitiveservices/mgmt/cognitiveservices/models.go index 19e381039db1..b771b01050f9 100644 --- a/profiles/latest/cognitiveservices/mgmt/cognitiveservices/models.go +++ b/profiles/latest/cognitiveservices/mgmt/cognitiveservices/models.go @@ -43,13 +43,6 @@ const ( Deny NetworkRuleAction = original.Deny ) -type NetworkRuleBypassOptions = original.NetworkRuleBypassOptions - -const ( - AzureServices NetworkRuleBypassOptions = original.AzureServices - None NetworkRuleBypassOptions = original.None -) - type ProvisioningState = original.ProvisioningState const ( @@ -105,19 +98,17 @@ const ( ) type Account = original.Account -type AccountCreateParameters = original.AccountCreateParameters +type AccountAPIProperties = original.AccountAPIProperties type AccountEnumerateSkusResult = original.AccountEnumerateSkusResult type AccountKeys = original.AccountKeys type AccountListResult = original.AccountListResult type AccountListResultIterator = original.AccountListResultIterator type AccountListResultPage = original.AccountListResultPage type AccountProperties = original.AccountProperties -type AccountUpdateParameters = original.AccountUpdateParameters type AccountsClient = original.AccountsClient type BaseClient = original.BaseClient type CheckDomainAvailabilityParameter = original.CheckDomainAvailabilityParameter type CheckDomainAvailabilityResult = original.CheckDomainAvailabilityResult -type CheckSkuAvailabilityClient = original.CheckSkuAvailabilityClient type CheckSkuAvailabilityParameter = original.CheckSkuAvailabilityParameter type CheckSkuAvailabilityResult = original.CheckSkuAvailabilityResult type CheckSkuAvailabilityResultList = original.CheckSkuAvailabilityResultList @@ -161,12 +152,6 @@ func NewAccountsClient(subscriptionID string) AccountsClient { func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { return original.NewAccountsClientWithBaseURI(baseURI, subscriptionID) } -func NewCheckSkuAvailabilityClient(subscriptionID string) CheckSkuAvailabilityClient { - return original.NewCheckSkuAvailabilityClient(subscriptionID) -} -func NewCheckSkuAvailabilityClientWithBaseURI(baseURI string, subscriptionID string) CheckSkuAvailabilityClient { - return original.NewCheckSkuAvailabilityClientWithBaseURI(baseURI, subscriptionID) -} func NewOperationEntityListResultIterator(page OperationEntityListResultPage) OperationEntityListResultIterator { return original.NewOperationEntityListResultIterator(page) } @@ -200,9 +185,6 @@ func PossibleKeyNameValues() []KeyName { func PossibleNetworkRuleActionValues() []NetworkRuleAction { return original.PossibleNetworkRuleActionValues() } -func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { - return original.PossibleNetworkRuleBypassOptionsValues() -} func PossibleProvisioningStateValues() []ProvisioningState { return original.PossibleProvisioningStateValues() } diff --git a/profiles/preview/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go b/profiles/preview/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go index f580fe74d7bd..42eca8c78f11 100644 --- a/profiles/preview/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go +++ b/profiles/preview/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go @@ -23,6 +23,5 @@ import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mg type AccountsClientAPI = original.AccountsClientAPI type BaseClientAPI = original.BaseClientAPI -type CheckSkuAvailabilityClientAPI = original.CheckSkuAvailabilityClientAPI type OperationsClientAPI = original.OperationsClientAPI type ResourceSkusClientAPI = original.ResourceSkusClientAPI diff --git a/profiles/preview/cognitiveservices/mgmt/cognitiveservices/models.go b/profiles/preview/cognitiveservices/mgmt/cognitiveservices/models.go index 31482a83c503..14ca297ee24f 100644 --- a/profiles/preview/cognitiveservices/mgmt/cognitiveservices/models.go +++ b/profiles/preview/cognitiveservices/mgmt/cognitiveservices/models.go @@ -43,13 +43,6 @@ const ( Deny NetworkRuleAction = original.Deny ) -type NetworkRuleBypassOptions = original.NetworkRuleBypassOptions - -const ( - AzureServices NetworkRuleBypassOptions = original.AzureServices - None NetworkRuleBypassOptions = original.None -) - type ProvisioningState = original.ProvisioningState const ( @@ -105,19 +98,17 @@ const ( ) type Account = original.Account -type AccountCreateParameters = original.AccountCreateParameters +type AccountAPIProperties = original.AccountAPIProperties type AccountEnumerateSkusResult = original.AccountEnumerateSkusResult type AccountKeys = original.AccountKeys type AccountListResult = original.AccountListResult type AccountListResultIterator = original.AccountListResultIterator type AccountListResultPage = original.AccountListResultPage type AccountProperties = original.AccountProperties -type AccountUpdateParameters = original.AccountUpdateParameters type AccountsClient = original.AccountsClient type BaseClient = original.BaseClient type CheckDomainAvailabilityParameter = original.CheckDomainAvailabilityParameter type CheckDomainAvailabilityResult = original.CheckDomainAvailabilityResult -type CheckSkuAvailabilityClient = original.CheckSkuAvailabilityClient type CheckSkuAvailabilityParameter = original.CheckSkuAvailabilityParameter type CheckSkuAvailabilityResult = original.CheckSkuAvailabilityResult type CheckSkuAvailabilityResultList = original.CheckSkuAvailabilityResultList @@ -161,12 +152,6 @@ func NewAccountsClient(subscriptionID string) AccountsClient { func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { return original.NewAccountsClientWithBaseURI(baseURI, subscriptionID) } -func NewCheckSkuAvailabilityClient(subscriptionID string) CheckSkuAvailabilityClient { - return original.NewCheckSkuAvailabilityClient(subscriptionID) -} -func NewCheckSkuAvailabilityClientWithBaseURI(baseURI string, subscriptionID string) CheckSkuAvailabilityClient { - return original.NewCheckSkuAvailabilityClientWithBaseURI(baseURI, subscriptionID) -} func NewOperationEntityListResultIterator(page OperationEntityListResultPage) OperationEntityListResultIterator { return original.NewOperationEntityListResultIterator(page) } @@ -200,9 +185,6 @@ func PossibleKeyNameValues() []KeyName { func PossibleNetworkRuleActionValues() []NetworkRuleAction { return original.PossibleNetworkRuleActionValues() } -func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { - return original.PossibleNetworkRuleBypassOptionsValues() -} func PossibleProvisioningStateValues() []ProvisioningState { return original.PossibleProvisioningStateValues() } diff --git a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/accounts.go b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/accounts.go index 3e3eea0f5422..96aa03010e9f 100644 --- a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/accounts.go +++ b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/accounts.go @@ -46,8 +46,8 @@ func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) Account // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. // accountName - the name of Cognitive Services account. -// parameters - the parameters to provide for the created account. -func (client AccountsClient) Create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (result Account, err error) { +// account - the parameters to provide for the created account. +func (client AccountsClient) Create(ctx context.Context, resourceGroupName string, accountName string, account Account) (result Account, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Create") defer func() { @@ -63,16 +63,25 @@ func (client AccountsClient) Create(ctx context.Context, resourceGroupName strin Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.Kind", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + {TargetValue: account, + Constraints: []validation.Constraint{{Target: "account.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties.EventHubConnectionString", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties.EventHubConnectionString", Name: validation.MaxLength, Rule: 1000, Chain: nil}, + {Target: "account.Properties.APIProperties.EventHubConnectionString", Name: validation.Pattern, Rule: `^( *)Endpoint=sb://(.*);( *)SharedAccessKeyName=(.*);( *)SharedAccessKey=(.*)$`, Chain: nil}, + }}, + {Target: "account.Properties.APIProperties.StorageAccountConnectionString", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties.StorageAccountConnectionString", Name: validation.MaxLength, Rule: 1000, Chain: nil}, + {Target: "account.Properties.APIProperties.StorageAccountConnectionString", Name: validation.Pattern, Rule: `^(( *)DefaultEndpointsProtocol=(http|https)( *);( *))?AccountName=(.*)AccountKey=(.*)EndpointSuffix=(.*)$`, Chain: nil}, + }}, + }}, + }}, + {Target: "account.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { return result, validation.NewError("cognitiveservices.AccountsClient", "Create", err.Error()) } - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, parameters) + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, account) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Create", nil, "Failure preparing request") return @@ -94,7 +103,7 @@ func (client AccountsClient) Create(ctx context.Context, resourceGroupName strin } // CreatePreparer prepares the Create request. -func (client AccountsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (*http.Request, error) { +func (client AccountsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, account Account) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -106,12 +115,16 @@ func (client AccountsClient) CreatePreparer(ctx context.Context, resourceGroupNa "api-version": APIVersion, } + account.Etag = nil + account.ID = nil + account.Name = nil + account.Type = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), + autorest.WithJSON(account), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -880,8 +893,8 @@ func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. // accountName - the name of Cognitive Services account. -// parameters - the parameters to provide for the created account. -func (client AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { +// account - the parameters to provide for the created account. +func (client AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, account Account) (result Account, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") defer func() { @@ -900,7 +913,7 @@ func (client AccountsClient) Update(ctx context.Context, resourceGroupName strin return result, validation.NewError("cognitiveservices.AccountsClient", "Update", err.Error()) } - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, parameters) + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, account) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Update", nil, "Failure preparing request") return @@ -922,7 +935,7 @@ func (client AccountsClient) Update(ctx context.Context, resourceGroupName strin } // UpdatePreparer prepares the Update request. -func (client AccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { +func (client AccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, account Account) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -934,12 +947,16 @@ func (client AccountsClient) UpdatePreparer(ctx context.Context, resourceGroupNa "api-version": APIVersion, } + account.Etag = nil + account.ID = nil + account.Name = nil + account.Type = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), + autorest.WithJSON(account), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/checkskuavailability.go b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/checkskuavailability.go deleted file mode 100644 index 4339b18a4838..000000000000 --- a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/checkskuavailability.go +++ /dev/null @@ -1,128 +0,0 @@ -package cognitiveservices - -// 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/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CheckSkuAvailabilityClient is the cognitive Services Management Client -type CheckSkuAvailabilityClient struct { - BaseClient -} - -// NewCheckSkuAvailabilityClient creates an instance of the CheckSkuAvailabilityClient client. -func NewCheckSkuAvailabilityClient(subscriptionID string) CheckSkuAvailabilityClient { - return NewCheckSkuAvailabilityClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCheckSkuAvailabilityClientWithBaseURI creates an instance of the CheckSkuAvailabilityClient client. -func NewCheckSkuAvailabilityClientWithBaseURI(baseURI string, subscriptionID string) CheckSkuAvailabilityClient { - return CheckSkuAvailabilityClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List check available SKUs. -// Parameters: -// location - resource location. -// parameters - check SKU Availability POST body. -func (client CheckSkuAvailabilityClient) List(ctx context.Context, location string, parameters CheckSkuAvailabilityParameter) (result CheckSkuAvailabilityResultList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CheckSkuAvailabilityClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Skus", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Kind", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("cognitiveservices.CheckSkuAvailabilityClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, location, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.CheckSkuAvailabilityClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "cognitiveservices.CheckSkuAvailabilityClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservices.CheckSkuAvailabilityClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client CheckSkuAvailabilityClient) ListPreparer(ctx context.Context, location string, parameters CheckSkuAvailabilityParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-18" - 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("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client CheckSkuAvailabilityClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client CheckSkuAvailabilityClient) ListResponder(resp *http.Response) (result CheckSkuAvailabilityResultList, 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/cognitiveservices/mgmt/2017-04-18/cognitiveservices/client.go b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/client.go index ba2be90e1e99..49599b4fa9a3 100644 --- a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/client.go +++ b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/client.go @@ -137,3 +137,89 @@ func (client BaseClient) CheckDomainAvailabilityResponder(resp *http.Response) ( result.Response = autorest.Response{Response: resp} return } + +// CheckSkuAvailability check available SKUs. +// Parameters: +// location - resource location. +// parameters - check SKU Availability POST body. +func (client BaseClient) CheckSkuAvailability(ctx context.Context, location string, parameters CheckSkuAvailabilityParameter) (result CheckSkuAvailabilityResultList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckSkuAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Skus", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Kind", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.BaseClient", "CheckSkuAvailability", err.Error()) + } + + req, err := client.CheckSkuAvailabilityPreparer(ctx, location, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.BaseClient", "CheckSkuAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckSkuAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.BaseClient", "CheckSkuAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckSkuAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.BaseClient", "CheckSkuAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckSkuAvailabilityPreparer prepares the CheckSkuAvailability request. +func (client BaseClient) CheckSkuAvailabilityPreparer(ctx context.Context, location string, parameters CheckSkuAvailabilityParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-04-18" + 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("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckSkuAvailabilitySender sends the CheckSkuAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckSkuAvailabilitySender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CheckSkuAvailabilityResponder handles the response to the CheckSkuAvailability request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckSkuAvailabilityResponder(resp *http.Response) (result CheckSkuAvailabilityResultList, 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/cognitiveservices/mgmt/2017-04-18/cognitiveservices/cognitiveservicesapi/interfaces.go b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/cognitiveservicesapi/interfaces.go index 41455e9a1424..c8748ef2db14 100644 --- a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/cognitiveservicesapi/interfaces.go +++ b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/cognitiveservicesapi/interfaces.go @@ -26,13 +26,14 @@ import ( // BaseClientAPI contains the set of methods on the BaseClient type. type BaseClientAPI interface { CheckDomainAvailability(ctx context.Context, parameters cognitiveservices.CheckDomainAvailabilityParameter) (result cognitiveservices.CheckDomainAvailabilityResult, err error) + CheckSkuAvailability(ctx context.Context, location string, parameters cognitiveservices.CheckSkuAvailabilityParameter) (result cognitiveservices.CheckSkuAvailabilityResultList, err error) } var _ BaseClientAPI = (*cognitiveservices.BaseClient)(nil) // AccountsClientAPI contains the set of methods on the AccountsClient type. type AccountsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, accountName string, parameters cognitiveservices.AccountCreateParameters) (result cognitiveservices.Account, err error) + Create(ctx context.Context, resourceGroupName string, accountName string, account cognitiveservices.Account) (result cognitiveservices.Account, err error) Delete(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) GetProperties(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.Account, err error) GetUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result cognitiveservices.UsagesResult, err error) @@ -41,7 +42,7 @@ type AccountsClientAPI interface { ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.AccountKeys, err error) ListSkus(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.AccountEnumerateSkusResult, err error) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, parameters cognitiveservices.RegenerateKeyParameters) (result cognitiveservices.AccountKeys, err error) - Update(ctx context.Context, resourceGroupName string, accountName string, parameters cognitiveservices.AccountUpdateParameters) (result cognitiveservices.Account, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, account cognitiveservices.Account) (result cognitiveservices.Account, err error) } var _ AccountsClientAPI = (*cognitiveservices.AccountsClient)(nil) @@ -59,10 +60,3 @@ type OperationsClientAPI interface { } var _ OperationsClientAPI = (*cognitiveservices.OperationsClient)(nil) - -// CheckSkuAvailabilityClientAPI contains the set of methods on the CheckSkuAvailabilityClient type. -type CheckSkuAvailabilityClientAPI interface { - List(ctx context.Context, location string, parameters cognitiveservices.CheckSkuAvailabilityParameter) (result cognitiveservices.CheckSkuAvailabilityResultList, err error) -} - -var _ CheckSkuAvailabilityClientAPI = (*cognitiveservices.CheckSkuAvailabilityClient)(nil) diff --git a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/models.go b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/models.go index 4478c4e38058..732c8f44c7b1 100644 --- a/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/models.go +++ b/services/cognitiveservices/mgmt/2017-04-18/cognitiveservices/models.go @@ -59,21 +59,6 @@ func PossibleNetworkRuleActionValues() []NetworkRuleAction { return []NetworkRuleAction{Allow, Deny} } -// NetworkRuleBypassOptions enumerates the values for network rule bypass options. -type NetworkRuleBypassOptions string - -const ( - // AzureServices ... - AzureServices NetworkRuleBypassOptions = "AzureServices" - // None ... - None NetworkRuleBypassOptions = "None" -) - -// PossibleNetworkRuleBypassOptionsValues returns an array of possible values for the NetworkRuleBypassOptions const type. -func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { - return []NetworkRuleBypassOptions{AzureServices, None} -} - // ProvisioningState enumerates the values for provisioning state. type ProvisioningState string @@ -192,18 +177,18 @@ func PossibleUnitTypeValues() []UnitType { // location and SKU. type Account struct { autorest.Response `json:"-"` - // Etag - Entity Tag + // Etag - READ-ONLY; Entity Tag Etag *string `json:"etag,omitempty"` // ID - READ-ONLY; The id of the created account ID *string `json:"id,omitempty"` - // Kind - Type of cognitive service account. + // Kind - The Kind of the resource. Kind *string `json:"kind,omitempty"` // Location - The location of the resource Location *string `json:"location,omitempty"` // Name - READ-ONLY; The name of the created account Name *string `json:"name,omitempty"` - // AccountProperties - Properties of Cognitive Services account. - *AccountProperties `json:"properties,omitempty"` + // Properties - Properties of Cognitive Services account. + Properties *AccountProperties `json:"properties,omitempty"` // Sku - The SKU of Cognitive Services account. Sku *Sku `json:"sku,omitempty"` // Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. @@ -215,17 +200,14 @@ type Account struct { // MarshalJSON is the custom marshaler for Account. func (a Account) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if a.Etag != nil { - objectMap["etag"] = a.Etag - } if a.Kind != nil { objectMap["kind"] = a.Kind } if a.Location != nil { objectMap["location"] = a.Location } - if a.AccountProperties != nil { - objectMap["properties"] = a.AccountProperties + if a.Properties != nil { + objectMap["properties"] = a.Properties } if a.Sku != nil { objectMap["sku"] = a.Sku @@ -236,135 +218,16 @@ func (a Account) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for Account struct. -func (a *Account) 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 "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - a.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - a.Kind = &kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - a.AccountProperties = &accountProperties - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - a.Sku = &sku - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - } - } - - return nil -} - -// AccountCreateParameters the parameters to provide for the account. -type AccountCreateParameters struct { - // Sku - Required. Gets or sets the SKU of the resource. - Sku *Sku `json:"sku,omitempty"` - // Kind - Required. Gets or sets the Kind of the resource. - Kind *string `json:"kind,omitempty"` - // Location - Required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update the request will succeed. - Location *string `json:"location,omitempty"` - // Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - Tags map[string]*string `json:"tags"` - // Properties - Must exist in the request. Must be an empty object. Must not be null. - Properties interface{} `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountCreateParameters. -func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acp.Sku != nil { - objectMap["sku"] = acp.Sku - } - if acp.Kind != nil { - objectMap["kind"] = acp.Kind - } - if acp.Location != nil { - objectMap["location"] = acp.Location - } - if acp.Tags != nil { - objectMap["tags"] = acp.Tags - } - if acp.Properties != nil { - objectMap["properties"] = acp.Properties - } - return json.Marshal(objectMap) +// AccountAPIProperties the api properties for special APIs. +type AccountAPIProperties struct { + // QnaRuntimeEndpoint - (QnAMaker Only) The runtime endpoint of QnAMaker. + QnaRuntimeEndpoint *string `json:"qnaRuntimeEndpoint,omitempty"` + // StatisticsEnabled - (Bing Search Only) The flag to enable statistics of Bing Search. + StatisticsEnabled *bool `json:"statisticsEnabled,omitempty"` + // EventHubConnectionString - (Personalization Only) The flag to enable statistics of Bing Search. + EventHubConnectionString *string `json:"eventHubConnectionString,omitempty"` + // StorageAccountConnectionString - (Personalization Only) The storage account connection string. + StorageAccountConnectionString *string `json:"storageAccountConnectionString,omitempty"` } // AccountEnumerateSkusResult the list of cognitive services accounts operation response. @@ -533,39 +396,16 @@ func NewAccountListResultPage(getNextPage func(context.Context, AccountListResul type AccountProperties struct { // ProvisioningState - READ-ONLY; Gets the status of the cognitive services account at the time the operation was called. Possible values include: 'Creating', 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Endpoint - Endpoint of the created account. + // Endpoint - READ-ONLY; Endpoint of the created account. Endpoint *string `json:"endpoint,omitempty"` - // InternalID - The internal identifier. + // InternalID - READ-ONLY; The internal identifier. InternalID *string `json:"internalId,omitempty"` // CustomSubDomainName - Optional subdomain name used for token-based authentication. CustomSubDomainName *string `json:"customSubDomainName,omitempty"` // NetworkAcls - A collection of rules governing the accessibility from specific network locations. NetworkAcls *NetworkRuleSet `json:"networkAcls,omitempty"` -} - -// AccountUpdateParameters the parameters to provide for the account. -type AccountUpdateParameters struct { - // Sku - Gets or sets the SKU of the resource. - Sku *Sku `json:"sku,omitempty"` - // Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - Tags map[string]*string `json:"tags"` - // Properties - Additional properties for Account. Only provided fields will be updated. - Properties interface{} `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountUpdateParameters. -func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aup.Sku != nil { - objectMap["sku"] = aup.Sku - } - if aup.Tags != nil { - objectMap["tags"] = aup.Tags - } - if aup.Properties != nil { - objectMap["properties"] = aup.Properties - } - return json.Marshal(objectMap) + // APIProperties - The api properties for special APIs. + APIProperties *AccountAPIProperties `json:"apiProperties,omitempty"` } // CheckDomainAvailabilityParameter check Domain availability parameter. @@ -652,8 +492,6 @@ type MetricName struct { // NetworkRuleSet a set of rules governing the network accessibility. type NetworkRuleSet struct { - // Bypass - Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: 'AzureServices', 'None' - Bypass NetworkRuleBypassOptions `json:"bypass,omitempty"` // DefaultAction - The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. Possible values include: 'Allow', 'Deny' DefaultAction NetworkRuleAction `json:"defaultAction,omitempty"` // IPRules - The list of IP address rules.