From d6766fee23d3783544b20235d5defd495901a507 Mon Sep 17 00:00:00 2001 From: Peng Jiahui <46921893+Alancere@users.noreply.github.com> Date: Mon, 24 Jul 2023 14:39:26 +0800 Subject: [PATCH] [Release] sdk/resourcemanager/cognitiveservices/armcognitiveservices/1.5.0 generation from spec commit: 310a0100f5b020c1900c527a6aa70d21992f078a (#21112) --- .../armcognitiveservices/CHANGELOG.md | 27 +++ .../armcognitiveservices/accounts_client.go | 50 ++-- .../accounts_client_example_test.go | 24 +- .../armcognitiveservices/autorest.md | 7 +- .../armcognitiveservices/client_factory.go | 10 + .../commitmentplans_client.go | 68 +++--- .../commitmentplans_client_example_test.go | 28 +-- .../commitmenttiers_client.go | 4 +- .../commitmenttiers_client_example_test.go | 2 +- .../armcognitiveservices/constants.go | 42 +++- .../deletedaccounts_client.go | 14 +- .../deletedaccounts_client_example_test.go | 6 +- .../deployments_client.go | 24 +- .../deployments_client_example_test.go | 24 +- .../armcognitiveservices/go.mod | 16 +- .../armcognitiveservices/go.sum | 36 +-- .../armcognitiveservices/management_client.go | 8 +- .../management_client_example_test.go | 4 +- .../armcognitiveservices/models.go | 116 ++++++++- .../armcognitiveservices/models_client.go | 109 +++++++++ .../models_client_example_test.go | 94 ++++++++ .../armcognitiveservices/models_serde.go | 223 ++++++++++++++++++ .../armcognitiveservices/operations_client.go | 4 +- .../operations_client_example_test.go | 2 +- .../privateendpointconnections_client.go | 20 +- ...endpointconnections_client_example_test.go | 8 +- .../privatelinkresources_client.go | 4 +- ...rivatelinkresources_client_example_test.go | 2 +- .../resourceskus_client.go | 4 +- .../resourceskus_client_example_test.go | 2 +- .../armcognitiveservices/response_types.go | 10 + .../armcognitiveservices/usages_client.go | 112 +++++++++ .../usages_client_example_test.go | 55 +++++ 33 files changed, 977 insertions(+), 182 deletions(-) create mode 100644 sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go create mode 100644 sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client_example_test.go create mode 100644 sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go create mode 100644 sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client_example_test.go diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md index f9ccd532246f..7e89fc6764a4 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md @@ -1,5 +1,32 @@ # Release History +## 1.5.0 (2023-07-28) +### Features Added + +- New value `DeploymentProvisioningStateCanceled`, `DeploymentProvisioningStateDisabled` added to enum type `DeploymentProvisioningState` +- New value `HostingModelProvisionedWeb` added to enum type `HostingModel` +- New enum type `AbusePenaltyAction` with values `AbusePenaltyActionBlock`, `AbusePenaltyActionThrottle` +- New enum type `DeploymentModelVersionUpgradeOption` with values `DeploymentModelVersionUpgradeOptionNoAutoUpgrade`, `DeploymentModelVersionUpgradeOptionOnceCurrentVersionExpired`, `DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable` +- New function `*ClientFactory.NewModelsClient() *ModelsClient` +- New function `*ClientFactory.NewUsagesClient() *UsagesClient` +- New function `NewModelsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ModelsClient, error)` +- New function `*ModelsClient.NewListPager(string, *ModelsClientListOptions) *runtime.Pager[ModelsClientListResponse]` +- New function `NewUsagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*UsagesClient, error)` +- New function `*UsagesClient.NewListPager(string, *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse]` +- New struct `AbusePenalty` +- New struct `CapacityConfig` +- New struct `Model` +- New struct `ModelListResult` +- New struct `ModelSKU` +- New field `IsDefaultVersion`, `SKUs`, `Source` in struct `AccountModel` +- New field `AbusePenalty` in struct `AccountProperties` +- New field `ProvisioningIssues` in struct `CommitmentPlanProperties` +- New field `SKU` in struct `Deployment` +- New field `Source` in struct `DeploymentModel` +- New field `RateLimits`, `VersionUpgradeOption` in struct `DeploymentProperties` +- New field `NextLink` in struct `UsageListResult` + + ## 1.4.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go index e64d3c2edbd7..02fd86bcbeab 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go @@ -48,7 +48,7 @@ func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, // developer to access intelligent APIs. It's also the resource type for billing. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - account - The parameters to provide for the created account. @@ -69,7 +69,7 @@ func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName // to access intelligent APIs. It's also the resource type for billing. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *AccountsClient) create(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, account, options) if err != nil { @@ -105,7 +105,7 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, account) @@ -114,7 +114,7 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Deletes a Cognitive Services account from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. @@ -133,7 +133,7 @@ func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a Cognitive Services account from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { @@ -169,7 +169,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -178,7 +178,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Returns a Cognitive Services account specified by the parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. @@ -217,7 +217,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,7 +234,7 @@ func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsCl // NewListPager - Returns all the resources of a particular type belonging to a subscription. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - options - AccountsClientListOptions contains the optional parameters for the AccountsClient.NewListPager method. func (client *AccountsClient) NewListPager(options *AccountsClientListOptions) *runtime.Pager[AccountsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[AccountsClientListResponse]{ @@ -276,7 +276,7 @@ func (client *AccountsClient) listCreateRequest(ctx context.Context, options *Ac return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -293,7 +293,7 @@ func (client *AccountsClient) listHandleResponse(resp *http.Response) (AccountsC // NewListByResourceGroupPager - Returns all the resources of a particular type belonging to a resource group // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager // method. @@ -341,7 +341,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -359,7 +359,7 @@ func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Respo // ListKeys - Lists the account keys for the specified Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListKeysOptions contains the optional parameters for the AccountsClient.ListKeys method. @@ -398,7 +398,7 @@ func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -415,7 +415,7 @@ func (client *AccountsClient) listKeysHandleResponse(resp *http.Response) (Accou // NewListModelsPager - List available Models for the requested Cognitive Services account // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListModelsOptions contains the optional parameters for the AccountsClient.NewListModelsPager method. @@ -467,7 +467,7 @@ func (client *AccountsClient) listModelsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -485,7 +485,7 @@ func (client *AccountsClient) listModelsHandleResponse(resp *http.Response) (Acc // ListSKUs - List available SKUs for the requested Cognitive Services account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListSKUsOptions contains the optional parameters for the AccountsClient.ListSKUs method. @@ -524,7 +524,7 @@ func (client *AccountsClient) listSKUsCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -542,7 +542,7 @@ func (client *AccountsClient) listSKUsHandleResponse(resp *http.Response) (Accou // ListUsages - Get usages for the requested Cognitive Services account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListUsagesOptions contains the optional parameters for the AccountsClient.ListUsages method. @@ -581,7 +581,7 @@ func (client *AccountsClient) listUsagesCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -602,7 +602,7 @@ func (client *AccountsClient) listUsagesHandleResponse(resp *http.Response) (Acc // RegenerateKey - Regenerates the specified account key for the specified Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - parameters - regenerate key parameters. @@ -642,7 +642,7 @@ func (client *AccountsClient) regenerateKeyCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -660,7 +660,7 @@ func (client *AccountsClient) regenerateKeyHandleResponse(resp *http.Response) ( // BeginUpdate - Updates a Cognitive Services account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - account - The parameters to provide for the created account. @@ -680,7 +680,7 @@ func (client *AccountsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates a Cognitive Services account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *AccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, account, options) if err != nil { @@ -716,7 +716,7 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, account) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client_example_test.go index 95f0fef2918d..9c804a4f8b85 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/CreateAccount.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateAccount.json func ExampleAccountsClient_BeginCreate_createAccount() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -97,7 +97,7 @@ func ExampleAccountsClient_BeginCreate_createAccount() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/CreateAccountMin.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateAccountMin.json func ExampleAccountsClient_BeginCreate_createAccountMin() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -151,7 +151,7 @@ func ExampleAccountsClient_BeginCreate_createAccountMin() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/UpdateAccount.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/UpdateAccount.json func ExampleAccountsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -195,7 +195,7 @@ func ExampleAccountsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/DeleteAccount.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteAccount.json func ExampleAccountsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -216,7 +216,7 @@ func ExampleAccountsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/GetAccount.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetAccount.json func ExampleAccountsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -255,7 +255,7 @@ func ExampleAccountsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListAccountsByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListAccountsByResourceGroup.json func ExampleAccountsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -319,7 +319,7 @@ func ExampleAccountsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListAccountsBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListAccountsBySubscription.json func ExampleAccountsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -410,7 +410,7 @@ func ExampleAccountsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListKeys.json func ExampleAccountsClient_ListKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -434,7 +434,7 @@ func ExampleAccountsClient_ListKeys() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/RegenerateKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/RegenerateKey.json func ExampleAccountsClient_RegenerateKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -460,7 +460,7 @@ func ExampleAccountsClient_RegenerateKey() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListSkus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSkus.json func ExampleAccountsClient_ListSKUs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -497,7 +497,7 @@ func ExampleAccountsClient_ListSKUs() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/GetUsages.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetUsages.json func ExampleAccountsClient_ListUsages() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -532,7 +532,7 @@ func ExampleAccountsClient_ListUsages() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListAccountModels.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListAccountModels.json func ExampleAccountsClient_NewListModelsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md index b981db3524ac..4a9c572b5db3 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md @@ -5,8 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.4.1 +module-version: 1.5.0 +tag: package-2023-05 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go index bcbdf82b0b84..e492cb29dcbf 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go @@ -53,6 +53,11 @@ func (c *ClientFactory) NewResourceSKUsClient() *ResourceSKUsClient { return subClient } +func (c *ClientFactory) NewUsagesClient() *UsagesClient { + subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient @@ -68,6 +73,11 @@ func (c *ClientFactory) NewCommitmentTiersClient() *CommitmentTiersClient { return subClient } +func (c *ClientFactory) NewModelsClient() *ModelsClient { + subClient, _ := NewModelsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go index f29c10adc801..577d27e34620 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go @@ -47,7 +47,7 @@ func NewCommitmentPlansClient(subscriptionID string, credential azcore.TokenCred // CreateOrUpdate - Update the state of specified commitmentPlans associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account @@ -93,7 +93,7 @@ func (client *CommitmentPlansClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, commitmentPlan) @@ -111,7 +111,7 @@ func (client *CommitmentPlansClient) createOrUpdateHandleResponse(resp *http.Res // BeginCreateOrUpdateAssociation - Create or update the association of the Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlanAssociationName - The name of the commitment plan association with the Cognitive Services Account @@ -135,7 +135,7 @@ func (client *CommitmentPlansClient) BeginCreateOrUpdateAssociation(ctx context. // CreateOrUpdateAssociation - Create or update the association of the Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *CommitmentPlansClient) createOrUpdateAssociation(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, association CommitmentPlanAccountAssociation, options *CommitmentPlansClientBeginCreateOrUpdateAssociationOptions) (*http.Response, error) { req, err := client.createOrUpdateAssociationCreateRequest(ctx, resourceGroupName, commitmentPlanName, commitmentPlanAssociationName, association, options) if err != nil { @@ -175,7 +175,7 @@ func (client *CommitmentPlansClient) createOrUpdateAssociationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, association) @@ -184,7 +184,7 @@ func (client *CommitmentPlansClient) createOrUpdateAssociationCreateRequest(ctx // BeginCreateOrUpdatePlan - Create Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlan - The parameters to provide for the created commitment plan. @@ -207,7 +207,7 @@ func (client *CommitmentPlansClient) BeginCreateOrUpdatePlan(ctx context.Context // CreateOrUpdatePlan - Create Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *CommitmentPlansClient) createOrUpdatePlan(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlan CommitmentPlan, options *CommitmentPlansClientBeginCreateOrUpdatePlanOptions) (*http.Response, error) { req, err := client.createOrUpdatePlanCreateRequest(ctx, resourceGroupName, commitmentPlanName, commitmentPlan, options) if err != nil { @@ -243,7 +243,7 @@ func (client *CommitmentPlansClient) createOrUpdatePlanCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, commitmentPlan) @@ -252,7 +252,7 @@ func (client *CommitmentPlansClient) createOrUpdatePlanCreateRequest(ctx context // BeginDelete - Deletes the specified commitmentPlan associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account @@ -273,7 +273,7 @@ func (client *CommitmentPlansClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deletes the specified commitmentPlan associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *CommitmentPlansClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, options *CommitmentPlansClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, commitmentPlanName, options) if err != nil { @@ -313,7 +313,7 @@ func (client *CommitmentPlansClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +322,7 @@ func (client *CommitmentPlansClient) deleteCreateRequest(ctx context.Context, re // BeginDeleteAssociation - Deletes the association of the Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlanAssociationName - The name of the commitment plan association with the Cognitive Services Account @@ -345,7 +345,7 @@ func (client *CommitmentPlansClient) BeginDeleteAssociation(ctx context.Context, // DeleteAssociation - Deletes the association of the Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *CommitmentPlansClient) deleteAssociation(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, options *CommitmentPlansClientBeginDeleteAssociationOptions) (*http.Response, error) { req, err := client.deleteAssociationCreateRequest(ctx, resourceGroupName, commitmentPlanName, commitmentPlanAssociationName, options) if err != nil { @@ -385,7 +385,7 @@ func (client *CommitmentPlansClient) deleteAssociationCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -394,7 +394,7 @@ func (client *CommitmentPlansClient) deleteAssociationCreateRequest(ctx context. // BeginDeletePlan - Deletes a Cognitive Services commitment plan from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - options - CommitmentPlansClientBeginDeletePlanOptions contains the optional parameters for the CommitmentPlansClient.BeginDeletePlan @@ -416,7 +416,7 @@ func (client *CommitmentPlansClient) BeginDeletePlan(ctx context.Context, resour // DeletePlan - Deletes a Cognitive Services commitment plan from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *CommitmentPlansClient) deletePlan(ctx context.Context, resourceGroupName string, commitmentPlanName string, options *CommitmentPlansClientBeginDeletePlanOptions) (*http.Response, error) { req, err := client.deletePlanCreateRequest(ctx, resourceGroupName, commitmentPlanName, options) if err != nil { @@ -452,7 +452,7 @@ func (client *CommitmentPlansClient) deletePlanCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -461,7 +461,7 @@ func (client *CommitmentPlansClient) deletePlanCreateRequest(ctx context.Context // Get - Gets the specified commitmentPlans associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account @@ -505,7 +505,7 @@ func (client *CommitmentPlansClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -523,7 +523,7 @@ func (client *CommitmentPlansClient) getHandleResponse(resp *http.Response) (Com // GetAssociation - Gets the association of the Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlanAssociationName - The name of the commitment plan association with the Cognitive Services Account @@ -568,7 +568,7 @@ func (client *CommitmentPlansClient) getAssociationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -586,7 +586,7 @@ func (client *CommitmentPlansClient) getAssociationHandleResponse(resp *http.Res // GetPlan - Returns a Cognitive Services commitment plan specified by the parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - options - CommitmentPlansClientGetPlanOptions contains the optional parameters for the CommitmentPlansClient.GetPlan method. @@ -625,7 +625,7 @@ func (client *CommitmentPlansClient) getPlanCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -642,7 +642,7 @@ func (client *CommitmentPlansClient) getPlanHandleResponse(resp *http.Response) // NewListPager - Gets the commitmentPlans associated with the Cognitive Services account. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - CommitmentPlansClientListOptions contains the optional parameters for the CommitmentPlansClient.NewListPager @@ -695,7 +695,7 @@ func (client *CommitmentPlansClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -712,7 +712,7 @@ func (client *CommitmentPlansClient) listHandleResponse(resp *http.Response) (Co // NewListAssociationsPager - Gets the associations of the Cognitive Services commitment plan. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - options - CommitmentPlansClientListAssociationsOptions contains the optional parameters for the CommitmentPlansClient.NewListAssociationsPager @@ -765,7 +765,7 @@ func (client *CommitmentPlansClient) listAssociationsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -782,7 +782,7 @@ func (client *CommitmentPlansClient) listAssociationsHandleResponse(resp *http.R // NewListPlansByResourceGroupPager - Returns all the resources of a particular type belonging to a resource group // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CommitmentPlansClientListPlansByResourceGroupOptions contains the optional parameters for the CommitmentPlansClient.NewListPlansByResourceGroupPager // method. @@ -830,7 +830,7 @@ func (client *CommitmentPlansClient) listPlansByResourceGroupCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -847,7 +847,7 @@ func (client *CommitmentPlansClient) listPlansByResourceGroupHandleResponse(resp // NewListPlansBySubscriptionPager - Returns all the resources of a particular type belonging to a subscription. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - options - CommitmentPlansClientListPlansBySubscriptionOptions contains the optional parameters for the CommitmentPlansClient.NewListPlansBySubscriptionPager // method. func (client *CommitmentPlansClient) NewListPlansBySubscriptionPager(options *CommitmentPlansClientListPlansBySubscriptionOptions) *runtime.Pager[CommitmentPlansClientListPlansBySubscriptionResponse] { @@ -890,7 +890,7 @@ func (client *CommitmentPlansClient) listPlansBySubscriptionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -908,7 +908,7 @@ func (client *CommitmentPlansClient) listPlansBySubscriptionHandleResponse(resp // BeginUpdatePlan - Create Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlan - The parameters to provide for the created commitment plan. @@ -931,7 +931,7 @@ func (client *CommitmentPlansClient) BeginUpdatePlan(ctx context.Context, resour // UpdatePlan - Create Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *CommitmentPlansClient) updatePlan(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlan PatchResourceTagsAndSKU, options *CommitmentPlansClientBeginUpdatePlanOptions) (*http.Response, error) { req, err := client.updatePlanCreateRequest(ctx, resourceGroupName, commitmentPlanName, commitmentPlan, options) if err != nil { @@ -967,7 +967,7 @@ func (client *CommitmentPlansClient) updatePlanCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, commitmentPlan) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client_example_test.go index 2a4bb074bce3..9121bbb326a7 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListCommitmentPlans.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListCommitmentPlans.json func ExampleCommitmentPlansClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -59,7 +59,7 @@ func ExampleCommitmentPlansClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/GetCommitmentPlan.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetCommitmentPlan.json func ExampleCommitmentPlansClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -92,7 +92,7 @@ func ExampleCommitmentPlansClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/PutCommitmentPlan.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PutCommitmentPlan.json func ExampleCommitmentPlansClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -134,7 +134,7 @@ func ExampleCommitmentPlansClient_CreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/DeleteCommitmentPlan.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteCommitmentPlan.json func ExampleCommitmentPlansClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -155,7 +155,7 @@ func ExampleCommitmentPlansClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/CreateSharedCommitmentPlan.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateSharedCommitmentPlan.json func ExampleCommitmentPlansClient_BeginCreateOrUpdatePlan() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -212,7 +212,7 @@ func ExampleCommitmentPlansClient_BeginCreateOrUpdatePlan() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/UpdateSharedCommitmentPlan.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/UpdateSharedCommitmentPlan.json func ExampleCommitmentPlansClient_BeginUpdatePlan() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -262,7 +262,7 @@ func ExampleCommitmentPlansClient_BeginUpdatePlan() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/DeleteSharedCommitmentPlan.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteSharedCommitmentPlan.json func ExampleCommitmentPlansClient_BeginDeletePlan() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -283,7 +283,7 @@ func ExampleCommitmentPlansClient_BeginDeletePlan() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/GetSharedCommitmentPlan.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlan.json func ExampleCommitmentPlansClient_GetPlan() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -322,7 +322,7 @@ func ExampleCommitmentPlansClient_GetPlan() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListSharedCommitmentPlansByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSharedCommitmentPlansByResourceGroup.json func ExampleCommitmentPlansClient_NewListPlansByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -369,7 +369,7 @@ func ExampleCommitmentPlansClient_NewListPlansByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListSharedCommitmentPlansBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSharedCommitmentPlansBySubscription.json func ExampleCommitmentPlansClient_NewListPlansBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -416,7 +416,7 @@ func ExampleCommitmentPlansClient_NewListPlansBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListSharedCommitmentPlanAssociations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSharedCommitmentPlanAssociations.json func ExampleCommitmentPlansClient_NewListAssociationsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -452,7 +452,7 @@ func ExampleCommitmentPlansClient_NewListAssociationsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/GetSharedCommitmentPlanAssociation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlanAssociation.json func ExampleCommitmentPlansClient_GetAssociation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -480,7 +480,7 @@ func ExampleCommitmentPlansClient_GetAssociation() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/CreateSharedCommitmentPlanAssociation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateSharedCommitmentPlanAssociation.json func ExampleCommitmentPlansClient_BeginCreateOrUpdateAssociation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -516,7 +516,7 @@ func ExampleCommitmentPlansClient_BeginCreateOrUpdateAssociation() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/DeleteSharedCommitmentPlanAssociation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteSharedCommitmentPlanAssociation.json func ExampleCommitmentPlansClient_BeginDeleteAssociation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go index ca87db87cdf5..dd311f3f08aa 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go @@ -46,7 +46,7 @@ func NewCommitmentTiersClient(subscriptionID string, credential azcore.TokenCred // NewListPager - List Commitment Tiers. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - location - Resource location. // - options - CommitmentTiersClientListOptions contains the optional parameters for the CommitmentTiersClient.NewListPager // method. @@ -94,7 +94,7 @@ func (client *CommitmentTiersClient) listCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client_example_test.go index eebcb7837432..7b2cb39cca98 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListCommitmentTiers.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListCommitmentTiers.json func ExampleCommitmentTiersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go index 0c46ca97ffdc..197f6cf1e3c2 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go @@ -11,9 +11,25 @@ package armcognitiveservices const ( moduleName = "armcognitiveservices" - moduleVersion = "v1.4.1" + moduleVersion = "v1.5.0" ) +// AbusePenaltyAction - The action of AbusePenalty. +type AbusePenaltyAction string + +const ( + AbusePenaltyActionBlock AbusePenaltyAction = "Block" + AbusePenaltyActionThrottle AbusePenaltyAction = "Throttle" +) + +// PossibleAbusePenaltyActionValues returns the possible values for the AbusePenaltyAction const type. +func PossibleAbusePenaltyActionValues() []AbusePenaltyAction { + return []AbusePenaltyAction{ + AbusePenaltyActionBlock, + AbusePenaltyActionThrottle, + } +} + // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. type ActionType string @@ -74,13 +90,33 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// DeploymentModelVersionUpgradeOption - Deployment model version upgrade option. +type DeploymentModelVersionUpgradeOption string + +const ( + DeploymentModelVersionUpgradeOptionNoAutoUpgrade DeploymentModelVersionUpgradeOption = "NoAutoUpgrade" + DeploymentModelVersionUpgradeOptionOnceCurrentVersionExpired DeploymentModelVersionUpgradeOption = "OnceCurrentVersionExpired" + DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable DeploymentModelVersionUpgradeOption = "OnceNewDefaultVersionAvailable" +) + +// PossibleDeploymentModelVersionUpgradeOptionValues returns the possible values for the DeploymentModelVersionUpgradeOption const type. +func PossibleDeploymentModelVersionUpgradeOptionValues() []DeploymentModelVersionUpgradeOption { + return []DeploymentModelVersionUpgradeOption{ + DeploymentModelVersionUpgradeOptionNoAutoUpgrade, + DeploymentModelVersionUpgradeOptionOnceCurrentVersionExpired, + DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable, + } +} + // DeploymentProvisioningState - Gets the status of the resource at the time the operation was called. type DeploymentProvisioningState string const ( DeploymentProvisioningStateAccepted DeploymentProvisioningState = "Accepted" + DeploymentProvisioningStateCanceled DeploymentProvisioningState = "Canceled" DeploymentProvisioningStateCreating DeploymentProvisioningState = "Creating" DeploymentProvisioningStateDeleting DeploymentProvisioningState = "Deleting" + DeploymentProvisioningStateDisabled DeploymentProvisioningState = "Disabled" DeploymentProvisioningStateFailed DeploymentProvisioningState = "Failed" DeploymentProvisioningStateMoving DeploymentProvisioningState = "Moving" DeploymentProvisioningStateSucceeded DeploymentProvisioningState = "Succeeded" @@ -90,8 +126,10 @@ const ( func PossibleDeploymentProvisioningStateValues() []DeploymentProvisioningState { return []DeploymentProvisioningState{ DeploymentProvisioningStateAccepted, + DeploymentProvisioningStateCanceled, DeploymentProvisioningStateCreating, DeploymentProvisioningStateDeleting, + DeploymentProvisioningStateDisabled, DeploymentProvisioningStateFailed, DeploymentProvisioningStateMoving, DeploymentProvisioningStateSucceeded, @@ -120,6 +158,7 @@ type HostingModel string const ( HostingModelConnectedContainer HostingModel = "ConnectedContainer" HostingModelDisconnectedContainer HostingModel = "DisconnectedContainer" + HostingModelProvisionedWeb HostingModel = "ProvisionedWeb" HostingModelWeb HostingModel = "Web" ) @@ -128,6 +167,7 @@ func PossibleHostingModelValues() []HostingModel { return []HostingModel{ HostingModelConnectedContainer, HostingModelDisconnectedContainer, + HostingModelProvisionedWeb, HostingModelWeb, } } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go index 968c42dcc038..0b48f0be0130 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go @@ -47,7 +47,7 @@ func NewDeletedAccountsClient(subscriptionID string, credential azcore.TokenCred // Get - Returns a Cognitive Services account specified by the parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - location - Resource location. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. @@ -91,7 +91,7 @@ func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,7 +108,7 @@ func (client *DeletedAccountsClient) getHandleResponse(resp *http.Response) (Del // NewListPager - Returns all the resources of a particular type belonging to a subscription. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - options - DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.NewListPager // method. func (client *DeletedAccountsClient) NewListPager(options *DeletedAccountsClientListOptions) *runtime.Pager[DeletedAccountsClientListResponse] { @@ -151,7 +151,7 @@ func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -169,7 +169,7 @@ func (client *DeletedAccountsClient) listHandleResponse(resp *http.Response) (De // BeginPurge - Deletes a Cognitive Services account from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - location - Resource location. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. @@ -190,7 +190,7 @@ func (client *DeletedAccountsClient) BeginPurge(ctx context.Context, location st // Purge - Deletes a Cognitive Services account from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *DeletedAccountsClient) purge(ctx context.Context, location string, resourceGroupName string, accountName string, options *DeletedAccountsClientBeginPurgeOptions) (*http.Response, error) { req, err := client.purgeCreateRequest(ctx, location, resourceGroupName, accountName, options) if err != nil { @@ -230,7 +230,7 @@ func (client *DeletedAccountsClient) purgeCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client_example_test.go index 8f4c80194797..35c9a5c0fc40 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/GetDeletedAccount.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeletedAccount.json func ExampleDeletedAccountsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,7 +56,7 @@ func ExampleDeletedAccountsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/PurgeDeletedAccount.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PurgeDeletedAccount.json func ExampleDeletedAccountsClient_BeginPurge() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,7 +77,7 @@ func ExampleDeletedAccountsClient_BeginPurge() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListDeletedAccountsBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListDeletedAccountsBySubscription.json func ExampleDeletedAccountsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go index 41812582d467..ea6df40a7bc0 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go @@ -47,7 +47,7 @@ func NewDeploymentsClient(subscriptionID string, credential azcore.TokenCredenti // BeginCreateOrUpdate - Update the state of specified deployments associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -60,7 +60,9 @@ func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,7 +71,7 @@ func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resour // CreateOrUpdate - Update the state of specified deployments associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, deploymentName, deployment, options) if err != nil { @@ -109,7 +111,7 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, deployment) @@ -118,7 +120,7 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context // BeginDelete - Deletes the specified deployment associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -138,7 +140,7 @@ func (client *DeploymentsClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Deletes the specified deployment associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *DeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, deploymentName, options) if err != nil { @@ -178,7 +180,7 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,7 +189,7 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour // Get - Gets the specified deployments associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -231,7 +233,7 @@ func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +250,7 @@ func (client *DeploymentsClient) getHandleResponse(resp *http.Response) (Deploym // NewListPager - Gets the deployments associated with the Cognitive Services account. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - DeploymentsClientListOptions contains the optional parameters for the DeploymentsClient.NewListPager method. @@ -300,7 +302,7 @@ func (client *DeploymentsClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client_example_test.go index eb195ef93314..a21b28844be9 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListDeployments.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListDeployments.json func ExampleDeploymentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -63,7 +63,7 @@ func ExampleDeploymentsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/GetDeployment.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeployment.json func ExampleDeploymentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -100,7 +100,7 @@ func ExampleDeploymentsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/PutDeployment.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PutDeployment.json func ExampleDeploymentsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -118,10 +118,10 @@ func ExampleDeploymentsClient_BeginCreateOrUpdate() { Format: to.Ptr("OpenAI"), Version: to.Ptr("1"), }, - ScaleSettings: &armcognitiveservices.DeploymentScaleSettings{ - Capacity: to.Ptr[int32](1), - ScaleType: to.Ptr(armcognitiveservices.DeploymentScaleTypeManual), - }, + }, + SKU: &armcognitiveservices.SKU{ + Name: to.Ptr("Standard"), + Capacity: to.Ptr[int32](1), }, }, nil) if err != nil { @@ -145,15 +145,15 @@ func ExampleDeploymentsClient_BeginCreateOrUpdate() { // Version: to.Ptr("1"), // }, // ProvisioningState: to.Ptr(armcognitiveservices.DeploymentProvisioningStateSucceeded), - // ScaleSettings: &armcognitiveservices.DeploymentScaleSettings{ - // Capacity: to.Ptr[int32](1), - // ScaleType: to.Ptr(armcognitiveservices.DeploymentScaleTypeManual), - // }, + // }, + // SKU: &armcognitiveservices.SKU{ + // Name: to.Ptr("Standard"), + // Capacity: to.Ptr[int32](1), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/DeleteDeployment.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteDeployment.json func ExampleDeploymentsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod index b30190bce877..2dca3544cf48 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod @@ -3,19 +3,19 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/a go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect ) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum index 8ba445a8c4da..21718b486698 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum @@ -1,13 +1,13 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= +github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -18,14 +18,14 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go index 96e8e3e4c428..ad71b8889c3f 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go @@ -47,7 +47,7 @@ func NewManagementClient(subscriptionID string, credential azcore.TokenCredentia // CheckDomainAvailability - Check whether a domain is available. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - parameters - Check Domain Availability parameter. // - options - ManagementClientCheckDomainAvailabilityOptions contains the optional parameters for the ManagementClient.CheckDomainAvailability // method. @@ -78,7 +78,7 @@ func (client *ManagementClient) checkDomainAvailabilityCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -96,7 +96,7 @@ func (client *ManagementClient) checkDomainAvailabilityHandleResponse(resp *http // CheckSKUAvailability - Check available SKUs. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - location - Resource location. // - parameters - Check SKU Availability POST body. // - options - ManagementClientCheckSKUAvailabilityOptions contains the optional parameters for the ManagementClient.CheckSKUAvailability @@ -132,7 +132,7 @@ func (client *ManagementClient) checkSKUAvailabilityCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client_example_test.go index 7e9af7970ad5..31a6490a5fd7 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/CheckSkuAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CheckSkuAvailability.json func ExampleManagementClient_CheckSKUAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -52,7 +52,7 @@ func ExampleManagementClient_CheckSKUAvailability() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/CheckDomainAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CheckDomainAvailability.json func ExampleManagementClient_CheckDomainAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go index 800a8fd9285d..339e26625bf4 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go @@ -56,6 +56,18 @@ type APIProperties struct { WebsiteName *string } +// AbusePenalty - The abuse penalty. +type AbusePenalty struct { + // The action of AbusePenalty. + Action *AbusePenaltyAction + + // The datetime of expiration of the AbusePenalty. + Expiration *time.Time + + // The percentage of rate limit. + RateLimitPercentage *float32 +} + // Account - Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and // SKU. type Account struct { @@ -119,6 +131,9 @@ type AccountModel struct { // Deployment model format. Format *string + // If the model is default version. + IsDefaultVersion *bool + // Model lifecycle status. LifecycleStatus *ModelLifecycleStatus @@ -128,7 +143,15 @@ type AccountModel struct { // Deployment model name. Name *string - // Deployment model version. + // The list of Model Sku. + SKUs []*ModelSKU + + // Optional. Deployment model source ARM resource ID. + Source *string + + // Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version + // is different for different models and might change when there is new version + // available for a model. Default version for a model could be found from list models API. Version *string // READ-ONLY; The call rate limit Cognitive Services account. @@ -180,6 +203,9 @@ type AccountProperties struct { // The storage accounts for this resource. UserOwnedStorage []*UserOwnedStorage + // READ-ONLY; The abuse penalty. + AbusePenalty *AbusePenalty + // READ-ONLY; The call rate limit Cognitive Services account. CallRateLimit *CallRateLimit @@ -325,6 +351,21 @@ type CallRateLimit struct { Rules []*ThrottlingRule } +// CapacityConfig - The capacity configuration. +type CapacityConfig struct { + // The default capacity. + Default *int32 + + // The maximum capacity. + Maximum *int32 + + // The minimum capacity. + Minimum *int32 + + // The minimal incremental between allowed values for capacity. + Step *int32 +} + // CheckDomainAvailabilityParameter - Check Domain availability parameter. type CheckDomainAvailabilityParameter struct { // REQUIRED; The subdomain name to use. @@ -487,6 +528,9 @@ type CommitmentPlanProperties struct { // READ-ONLY; Cognitive Services account commitment period. Last *CommitmentPeriod + // READ-ONLY; The list of ProvisioningIssue. + ProvisioningIssues []*string + // READ-ONLY; Gets the status of the resource at the time the operation was called. ProvisioningState *CommitmentPlanProvisioningState } @@ -648,6 +692,9 @@ type Deployment struct { // Properties of Cognitive Services account deployment. Properties *DeploymentProperties + // The resource model definition representing SKU + SKU *SKU + // READ-ONLY; Resource Etag. Etag *string @@ -681,7 +728,12 @@ type DeploymentModel struct { // Deployment model name. Name *string - // Deployment model version. + // Optional. Deployment model source ARM resource ID. + Source *string + + // Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version + // is different for different models and might change when there is new version + // available for a model. Default version for a model could be found from list models API. Version *string // READ-ONLY; The call rate limit Cognitive Services account. @@ -699,6 +751,9 @@ type DeploymentProperties struct { // Properties of Cognitive Services account deployment model. ScaleSettings *DeploymentScaleSettings + // Deployment model version upgrade option. + VersionUpgradeOption *DeploymentModelVersionUpgradeOption + // READ-ONLY; The call rate limit Cognitive Services account. CallRateLimit *CallRateLimit @@ -707,6 +762,9 @@ type DeploymentProperties struct { // READ-ONLY; Gets the status of the resource at the time the operation was called. ProvisioningState *DeploymentProvisioningState + + // READ-ONLY + RateLimits []*ThrottlingRule } // DeploymentScaleSettings - Properties of Cognitive Services account deployment model. @@ -864,6 +922,18 @@ type MetricName struct { Value *string } +// Model - Cognitive Services Model. +type Model struct { + // The Kind of the Model. + Kind *string + + // Model Metadata. + Model *AccountModel + + // The SKU of the Model. + SKUName *string +} + // ModelDeprecationInfo - Cognitive Services account ModelDeprecationInfo. type ModelDeprecationInfo struct { // The datetime of deprecation of the fineTune Model. @@ -873,6 +943,38 @@ type ModelDeprecationInfo struct { Inference *string } +// ModelListResult - The list of cognitive services models. +type ModelListResult struct { + // The link used to get the next page of Model. + NextLink *string + + // Gets the list of Cognitive Services accounts Model and their properties. + Value []*Model +} + +// ModelSKU - Describes an available Cognitive Services Model SKU. +type ModelSKU struct { + // The capacity configuration. + Capacity *CapacityConfig + + // The datetime of deprecation of the model SKU. + DeprecationDate *time.Time + + // The name of the model SKU. + Name *string + + // The list of rateLimit. + RateLimits []*CallRateLimit + + // The usage name of the model SKU. + UsageName *string +} + +// ModelsClientListOptions contains the optional parameters for the ModelsClient.NewListPager method. +type ModelsClientListOptions struct { + // placeholder for future optional parameters +} + // MultiRegionSettings - The multiregion settings Cognitive Services account. type MultiRegionSettings struct { Regions []*RegionSetting @@ -1331,10 +1433,20 @@ type Usage struct { // UsageListResult - The response to a list usage request. type UsageListResult struct { + // The link used to get the next page of Usages. + NextLink *string + // The list of usages for Cognitive Service account. Value []*Usage } +// UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. +type UsagesClientListOptions struct { + // 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). + Filter *string +} + // UserAssignedIdentity - User-assigned managed identity. type UserAssignedIdentity struct { // READ-ONLY; Client App Id associated with this identity. diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go new file mode 100644 index 000000000000..8c4744377039 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcognitiveservices + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ModelsClient contains the methods for the Models group. +// Don't use this type directly, use NewModelsClient() instead. +type ModelsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewModelsClient creates a new instance of ModelsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewModelsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ModelsClient, error) { + cl, err := arm.NewClient(moduleName+".ModelsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ModelsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - List Models. +// +// Generated from API version 2023-05-01 +// - location - Resource location. +// - options - ModelsClientListOptions contains the optional parameters for the ModelsClient.NewListPager method. +func (client *ModelsClient) NewListPager(location string, options *ModelsClientListOptions) *runtime.Pager[ModelsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ModelsClientListResponse]{ + More: func(page ModelsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ModelsClientListResponse) (ModelsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ModelsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ModelsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ModelsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ModelsClient) listCreateRequest(ctx context.Context, location string, options *ModelsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/models" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ModelsClient) listHandleResponse(resp *http.Response) (ModelsClientListResponse, error) { + result := ModelsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ModelListResult); err != nil { + return ModelsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client_example_test.go new file mode 100644 index 000000000000..c055fce95e7a --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client_example_test.go @@ -0,0 +1,94 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcognitiveservices_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListModels.json +func ExampleModelsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewModelsClient().NewListPager("WestUS", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.ModelListResult = armcognitiveservices.ModelListResult{ + // Value: []*armcognitiveservices.Model{ + // { + // Kind: to.Ptr("OpenAI"), + // Model: &armcognitiveservices.AccountModel{ + // Name: to.Ptr("ada"), + // Format: to.Ptr("OpenAI"), + // Version: to.Ptr("1"), + // Capabilities: map[string]*string{ + // "FineTuneTokensMaxValue": to.Ptr("37500000"), + // "completion": to.Ptr("true"), + // "fineTune": to.Ptr("true"), + // "inference": to.Ptr("false"), + // "scaleType": to.Ptr("Manual"), + // "search": to.Ptr("true"), + // }, + // Deprecation: &armcognitiveservices.ModelDeprecationInfo{ + // FineTune: to.Ptr("2024-01-01T00:00:00Z"), + // Inference: to.Ptr("2024-01-01T00:00:00Z"), + // }, + // FinetuneCapabilities: map[string]*string{ + // "FineTuneTokensMaxValue": to.Ptr("37500000"), + // "completion": to.Ptr("true"), + // "fineTune": to.Ptr("true"), + // "inference": to.Ptr("false"), + // "scaleType": to.Ptr("Manual,Standard"), + // "search": to.Ptr("true"), + // }, + // LifecycleStatus: to.Ptr(armcognitiveservices.ModelLifecycleStatusPreview), + // MaxCapacity: to.Ptr[int32](3), + // SKUs: []*armcognitiveservices.ModelSKU{ + // { + // Name: to.Ptr("provisioned"), + // Capacity: &armcognitiveservices.CapacityConfig{ + // Default: to.Ptr[int32](100), + // Maximum: to.Ptr[int32](1000), + // Minimum: to.Ptr[int32](100), + // Step: to.Ptr[int32](100), + // }, + // UsageName: to.Ptr("OpenAI.Provisioned.Class1"), + // }}, + // SystemData: &armcognitiveservices.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-07T00:00:00Z"); return t}()), + // CreatedBy: to.Ptr("Microsoft"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-07T00:00:00Z"); return t}()), + // LastModifiedBy: to.Ptr("Microsoft"), + // }, + // }, + // SKUName: to.Ptr("S0"), + // }}, + // } + } +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go index 6dc3d9d6d964..81f1baeea28c 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go @@ -125,6 +125,41 @@ func (a *APIProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AbusePenalty. +func (a AbusePenalty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", a.Action) + populateTimeRFC3339(objectMap, "expiration", a.Expiration) + populate(objectMap, "rateLimitPercentage", a.RateLimitPercentage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AbusePenalty. +func (a *AbusePenalty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &a.Action) + delete(rawMsg, key) + case "expiration": + err = unpopulateTimeRFC3339(val, "Expiration", &a.Expiration) + delete(rawMsg, key) + case "rateLimitPercentage": + err = unpopulate(val, "RateLimitPercentage", &a.RateLimitPercentage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Account. func (a Account) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -232,9 +267,12 @@ func (a AccountModel) MarshalJSON() ([]byte, error) { populate(objectMap, "deprecation", a.Deprecation) populate(objectMap, "finetuneCapabilities", a.FinetuneCapabilities) populate(objectMap, "format", a.Format) + populate(objectMap, "isDefaultVersion", a.IsDefaultVersion) populate(objectMap, "lifecycleStatus", a.LifecycleStatus) populate(objectMap, "maxCapacity", a.MaxCapacity) populate(objectMap, "name", a.Name) + populate(objectMap, "skus", a.SKUs) + populate(objectMap, "source", a.Source) populate(objectMap, "systemData", a.SystemData) populate(objectMap, "version", a.Version) return json.Marshal(objectMap) @@ -267,6 +305,9 @@ func (a *AccountModel) UnmarshalJSON(data []byte) error { case "format": err = unpopulate(val, "Format", &a.Format) delete(rawMsg, key) + case "isDefaultVersion": + err = unpopulate(val, "IsDefaultVersion", &a.IsDefaultVersion) + delete(rawMsg, key) case "lifecycleStatus": err = unpopulate(val, "LifecycleStatus", &a.LifecycleStatus) delete(rawMsg, key) @@ -276,6 +317,12 @@ func (a *AccountModel) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) + case "skus": + err = unpopulate(val, "SKUs", &a.SKUs) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &a.Source) + delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &a.SystemData) delete(rawMsg, key) @@ -325,6 +372,7 @@ func (a *AccountModelListResult) UnmarshalJSON(data []byte) error { func (a AccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "apiProperties", a.APIProperties) + populate(objectMap, "abusePenalty", a.AbusePenalty) populate(objectMap, "allowedFqdnList", a.AllowedFqdnList) populate(objectMap, "callRateLimit", a.CallRateLimit) populate(objectMap, "capabilities", a.Capabilities) @@ -366,6 +414,9 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { case "apiProperties": err = unpopulate(val, "APIProperties", &a.APIProperties) delete(rawMsg, key) + case "abusePenalty": + err = unpopulate(val, "AbusePenalty", &a.AbusePenalty) + delete(rawMsg, key) case "allowedFqdnList": err = unpopulate(val, "AllowedFqdnList", &a.AllowedFqdnList) delete(rawMsg, key) @@ -584,6 +635,45 @@ func (c *CallRateLimit) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CapacityConfig. +func (c CapacityConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "default", c.Default) + populate(objectMap, "maximum", c.Maximum) + populate(objectMap, "minimum", c.Minimum) + populate(objectMap, "step", c.Step) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityConfig. +func (c *CapacityConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "default": + err = unpopulate(val, "Default", &c.Default) + delete(rawMsg, key) + case "maximum": + err = unpopulate(val, "Maximum", &c.Maximum) + delete(rawMsg, key) + case "minimum": + err = unpopulate(val, "Minimum", &c.Minimum) + delete(rawMsg, key) + case "step": + err = unpopulate(val, "Step", &c.Step) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CheckDomainAvailabilityParameter. func (c CheckDomainAvailabilityParameter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -968,6 +1058,7 @@ func (c CommitmentPlanProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "last", c.Last) populate(objectMap, "next", c.Next) populate(objectMap, "planType", c.PlanType) + populate(objectMap, "provisioningIssues", c.ProvisioningIssues) populate(objectMap, "provisioningState", c.ProvisioningState) return json.Marshal(objectMap) } @@ -1002,6 +1093,9 @@ func (c *CommitmentPlanProperties) UnmarshalJSON(data []byte) error { case "planType": err = unpopulate(val, "PlanType", &c.PlanType) delete(rawMsg, key) + case "provisioningIssues": + err = unpopulate(val, "ProvisioningIssues", &c.ProvisioningIssues) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) delete(rawMsg, key) @@ -1137,6 +1231,7 @@ func (d Deployment) MarshalJSON() ([]byte, error) { populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) + populate(objectMap, "sku", d.SKU) populate(objectMap, "systemData", d.SystemData) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) @@ -1163,6 +1258,9 @@ func (d *Deployment) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) + delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) @@ -1214,6 +1312,7 @@ func (d DeploymentModel) MarshalJSON() ([]byte, error) { populate(objectMap, "callRateLimit", d.CallRateLimit) populate(objectMap, "format", d.Format) populate(objectMap, "name", d.Name) + populate(objectMap, "source", d.Source) populate(objectMap, "version", d.Version) return json.Marshal(objectMap) } @@ -1236,6 +1335,9 @@ func (d *DeploymentModel) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &d.Source) + delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &d.Version) delete(rawMsg, key) @@ -1255,7 +1357,9 @@ func (d DeploymentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "model", d.Model) populate(objectMap, "provisioningState", d.ProvisioningState) populate(objectMap, "raiPolicyName", d.RaiPolicyName) + populate(objectMap, "rateLimits", d.RateLimits) populate(objectMap, "scaleSettings", d.ScaleSettings) + populate(objectMap, "versionUpgradeOption", d.VersionUpgradeOption) return json.Marshal(objectMap) } @@ -1283,9 +1387,15 @@ func (d *DeploymentProperties) UnmarshalJSON(data []byte) error { case "raiPolicyName": err = unpopulate(val, "RaiPolicyName", &d.RaiPolicyName) delete(rawMsg, key) + case "rateLimits": + err = unpopulate(val, "RateLimits", &d.RateLimits) + delete(rawMsg, key) case "scaleSettings": err = unpopulate(val, "ScaleSettings", &d.ScaleSettings) delete(rawMsg, key) + case "versionUpgradeOption": + err = unpopulate(val, "VersionUpgradeOption", &d.VersionUpgradeOption) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -1640,6 +1750,41 @@ func (m *MetricName) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Model. +func (m Model) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kind", m.Kind) + populate(objectMap, "model", m.Model) + populate(objectMap, "skuName", m.SKUName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Model. +func (m *Model) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "model": + err = unpopulate(val, "Model", &m.Model) + delete(rawMsg, key) + case "skuName": + err = unpopulate(val, "SKUName", &m.SKUName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ModelDeprecationInfo. func (m ModelDeprecationInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1671,6 +1816,80 @@ func (m *ModelDeprecationInfo) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ModelListResult. +func (m ModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ModelListResult. +func (m *ModelListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ModelSKU. +func (m ModelSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", m.Capacity) + populateTimeRFC3339(objectMap, "deprecationDate", m.DeprecationDate) + populate(objectMap, "name", m.Name) + populate(objectMap, "rateLimits", m.RateLimits) + populate(objectMap, "usageName", m.UsageName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ModelSKU. +func (m *ModelSKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &m.Capacity) + delete(rawMsg, key) + case "deprecationDate": + err = unpopulateTimeRFC3339(val, "DeprecationDate", &m.DeprecationDate) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "rateLimits": + err = unpopulate(val, "RateLimits", &m.RateLimits) + delete(rawMsg, key) + case "usageName": + err = unpopulate(val, "UsageName", &m.UsageName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MultiRegionSettings. func (m MultiRegionSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2869,6 +3088,7 @@ func (u *Usage) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UsageListResult. func (u UsageListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", u.NextLink) populate(objectMap, "value", u.Value) return json.Marshal(objectMap) } @@ -2882,6 +3102,9 @@ func (u *UsageListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &u.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &u.Value) delete(rawMsg, key) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go index fa54a9d9cf60..45a7d42ba4ab 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go @@ -40,7 +40,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all the available Cognitive Services account operations. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +78,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client_example_test.go index 569054c8fcfe..635a8ecd5b91 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/GetOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetOperations.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go index ae83b0b15d57..02a98e136aca 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go @@ -48,7 +48,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Cognitive Services Account @@ -70,7 +70,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Update the state of specified private endpoint connection associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, properties, options) if err != nil { @@ -110,7 +110,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, properties) @@ -119,7 +119,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes the specified private endpoint connection associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Cognitive Services Account @@ -140,7 +140,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes the specified private endpoint connection associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) if err != nil { @@ -180,7 +180,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,7 +189,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets the specified private endpoint connection associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Cognitive Services Account @@ -234,7 +234,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +252,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // List - Gets the private endpoint connections associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List @@ -292,7 +292,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client_example_test.go index dd8a8179c2e6..889e91fa38a0 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListPrivateEndpointConnections.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListPrivateEndpointConnections.json func ExamplePrivateEndpointConnectionsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -56,7 +56,7 @@ func ExamplePrivateEndpointConnectionsClient_List() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/GetPrivateEndpointConnection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetPrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -91,7 +91,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/PutPrivateEndpointConnection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PutPrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -137,7 +137,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/DeletePrivateEndpointConnection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeletePrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go index 767c60d038d0..47cb85e4f9f5 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go @@ -47,7 +47,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // List - Gets the private link resources that need to be created for a Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List @@ -87,7 +87,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client_example_test.go index 9059358465a5..3e5948db7604 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/ListPrivateLinkResources.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListPrivateLinkResources.json func ExamplePrivateLinkResourcesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go index e4db8126b6a9..1f1b04d90c94 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go @@ -46,7 +46,7 @@ func NewResourceSKUsClient(subscriptionID string, credential azcore.TokenCredent // NewListPager - Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. // -// Generated from API version 2022-12-01 +// Generated from API version 2023-05-01 // - options - ResourceSKUsClientListOptions contains the optional parameters for the ResourceSKUsClient.NewListPager method. func (client *ResourceSKUsClient) NewListPager(options *ResourceSKUsClientListOptions) *runtime.Pager[ResourceSKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ResourceSKUsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *ResourceSKUsClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01") + reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client_example_test.go index 1832799ba7d6..a0e3bb471a19 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2022-12-01/examples/GetSkus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSkus.json func ExampleResourceSKUsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/response_types.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/response_types.go index 963bea546cf7..e74eb06f93f5 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/response_types.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/response_types.go @@ -184,6 +184,11 @@ type ManagementClientCheckSKUAvailabilityResponse struct { SKUAvailabilityListResult } +// ModelsClientListResponse contains the response from method ModelsClient.NewListPager. +type ModelsClientListResponse struct { + ModelListResult +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult @@ -218,3 +223,8 @@ type PrivateLinkResourcesClientListResponse struct { type ResourceSKUsClientListResponse struct { ResourceSKUListResult } + +// UsagesClientListResponse contains the response from method UsagesClient.NewListPager. +type UsagesClientListResponse struct { + UsageListResult +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go new file mode 100644 index 000000000000..dbf6c88cd251 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcognitiveservices + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// UsagesClient contains the methods for the Usages group. +// Don't use this type directly, use NewUsagesClient() instead. +type UsagesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewUsagesClient creates a new instance of UsagesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { + cl, err := arm.NewClient(moduleName+".UsagesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UsagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Get usages for the requested subscription +// +// Generated from API version 2023-05-01 +// - location - Resource location. +// - options - UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. +func (client *UsagesClient) NewListPager(location string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[UsagesClientListResponse]{ + More: func(page UsagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UsagesClientListResponse) (UsagesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, location, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return UsagesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UsagesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UsagesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *UsagesClient) listCreateRequest(ctx context.Context, location string, options *UsagesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/usages" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *UsagesClient) listHandleResponse(resp *http.Response) (UsagesClientListResponse, error) { + result := UsagesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.UsageListResult); err != nil { + return UsagesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client_example_test.go new file mode 100644 index 000000000000..8c52dec67481 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client_example_test.go @@ -0,0 +1,55 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armcognitiveservices_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListUsages.json +func ExampleUsagesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewUsagesClient().NewListPager("WestUS", &armcognitiveservices.UsagesClientListOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.UsageListResult = armcognitiveservices.UsageListResult{ + // Value: []*armcognitiveservices.Usage{ + // { + // Name: &armcognitiveservices.MetricName{ + // LocalizedValue: to.Ptr("Cognitive Services total account limit"), + // Value: to.Ptr("AccountCount"), + // }, + // CurrentValue: to.Ptr[float64](3), + // Limit: to.Ptr[float64](200), + // Unit: to.Ptr(armcognitiveservices.UnitTypeCount), + // }}, + // } + } +}