diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md index 7e89fc6764a4..ca3a360e3b70 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md @@ -1,5 +1,73 @@ # Release History +## 1.6.0-beta.1 (2023-10-17) +### Features Added + +- New enum type `AllowedContentLevel` with values `AllowedContentLevelHigh`, `AllowedContentLevelLow`, `AllowedContentLevelMedium` +- New enum type `ByPassSelection` with values `ByPassSelectionAzureServices`, `ByPassSelectionNone` +- New enum type `EncryptionScopeProvisioningState` with values `EncryptionScopeProvisioningStateAccepted`, `EncryptionScopeProvisioningStateCanceled`, `EncryptionScopeProvisioningStateCreating`, `EncryptionScopeProvisioningStateDeleting`, `EncryptionScopeProvisioningStateFailed`, `EncryptionScopeProvisioningStateMoving`, `EncryptionScopeProvisioningStateSucceeded` +- New enum type `EncryptionScopeState` with values `EncryptionScopeStateDisabled`, `EncryptionScopeStateEnabled` +- New enum type `RaiContentFilterType` with values `RaiContentFilterTypeMultiLevel`, `RaiContentFilterTypeSwitch` +- New enum type `RaiPolicyContentSource` with values `RaiPolicyContentSourceCompletion`, `RaiPolicyContentSourcePrompt` +- New enum type `RaiPolicyMode` with values `RaiPolicyModeBlocking`, `RaiPolicyModeDefault`, `RaiPolicyModeDeferred` +- New enum type `RaiPolicyType` with values `RaiPolicyTypeSystemManaged`, `RaiPolicyTypeUserManaged` +- New function `*ClientFactory.NewEncryptionScopesClient() *EncryptionScopesClient` +- New function `*ClientFactory.NewRaiBlocklistItemsClient() *RaiBlocklistItemsClient` +- New function `*ClientFactory.NewRaiBlocklistsClient() *RaiBlocklistsClient` +- New function `*ClientFactory.NewRaiContentFiltersClient() *RaiContentFiltersClient` +- New function `*ClientFactory.NewRaiPoliciesClient() *RaiPoliciesClient` +- New function `*DeploymentsClient.NewListSKUsPager(string, string, string, *DeploymentsClientListSKUsOptions) *runtime.Pager[DeploymentsClientListSKUsResponse]` +- New function `*DeploymentsClient.BeginUpdate(context.Context, string, string, string, PatchResourceTagsAndSKU, *DeploymentsClientBeginUpdateOptions) (*runtime.Poller[DeploymentsClientUpdateResponse], error)` +- New function `NewEncryptionScopesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*EncryptionScopesClient, error)` +- New function `*EncryptionScopesClient.CreateOrUpdate(context.Context, string, string, string, EncryptionScope, *EncryptionScopesClientCreateOrUpdateOptions) (EncryptionScopesClientCreateOrUpdateResponse, error)` +- New function `*EncryptionScopesClient.BeginDelete(context.Context, string, string, string, *EncryptionScopesClientBeginDeleteOptions) (*runtime.Poller[EncryptionScopesClientDeleteResponse], error)` +- New function `*EncryptionScopesClient.Get(context.Context, string, string, string, *EncryptionScopesClientGetOptions) (EncryptionScopesClientGetResponse, error)` +- New function `*EncryptionScopesClient.NewListPager(string, string, *EncryptionScopesClientListOptions) *runtime.Pager[EncryptionScopesClientListResponse]` +- New function `NewRaiBlocklistItemsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*RaiBlocklistItemsClient, error)` +- New function `*RaiBlocklistItemsClient.CreateOrUpdate(context.Context, string, string, string, string, RaiBlocklistItem, *RaiBlocklistItemsClientCreateOrUpdateOptions) (RaiBlocklistItemsClientCreateOrUpdateResponse, error)` +- New function `*RaiBlocklistItemsClient.BeginDelete(context.Context, string, string, string, string, *RaiBlocklistItemsClientBeginDeleteOptions) (*runtime.Poller[RaiBlocklistItemsClientDeleteResponse], error)` +- New function `*RaiBlocklistItemsClient.Get(context.Context, string, string, string, string, *RaiBlocklistItemsClientGetOptions) (RaiBlocklistItemsClientGetResponse, error)` +- New function `*RaiBlocklistItemsClient.NewListPager(string, string, string, *RaiBlocklistItemsClientListOptions) *runtime.Pager[RaiBlocklistItemsClientListResponse]` +- New function `NewRaiBlocklistsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*RaiBlocklistsClient, error)` +- New function `*RaiBlocklistsClient.CreateOrUpdate(context.Context, string, string, string, RaiBlocklist, *RaiBlocklistsClientCreateOrUpdateOptions) (RaiBlocklistsClientCreateOrUpdateResponse, error)` +- New function `*RaiBlocklistsClient.BeginDelete(context.Context, string, string, string, *RaiBlocklistsClientBeginDeleteOptions) (*runtime.Poller[RaiBlocklistsClientDeleteResponse], error)` +- New function `*RaiBlocklistsClient.Get(context.Context, string, string, string, *RaiBlocklistsClientGetOptions) (RaiBlocklistsClientGetResponse, error)` +- New function `*RaiBlocklistsClient.NewListPager(string, string, *RaiBlocklistsClientListOptions) *runtime.Pager[RaiBlocklistsClientListResponse]` +- New function `NewRaiContentFiltersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*RaiContentFiltersClient, error)` +- New function `*RaiContentFiltersClient.List(context.Context, string, *RaiContentFiltersClientListOptions) (RaiContentFiltersClientListResponse, error)` +- New function `NewRaiPoliciesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*RaiPoliciesClient, error)` +- New function `*RaiPoliciesClient.CreateOrUpdate(context.Context, string, string, string, RaiPolicy, *RaiPoliciesClientCreateOrUpdateOptions) (RaiPoliciesClientCreateOrUpdateResponse, error)` +- New function `*RaiPoliciesClient.BeginDelete(context.Context, string, string, string, *RaiPoliciesClientBeginDeleteOptions) (*runtime.Poller[RaiPoliciesClientDeleteResponse], error)` +- New function `*RaiPoliciesClient.Get(context.Context, string, string, string, *RaiPoliciesClientGetOptions) (RaiPoliciesClientGetResponse, error)` +- New function `*RaiPoliciesClient.NewListPager(string, string, *RaiPoliciesClientListOptions) *runtime.Pager[RaiPoliciesClientListResponse]` +- New struct `DeploymentCapacitySettings` +- New struct `DeploymentSKUListResult` +- New struct `EncryptionScope` +- New struct `EncryptionScopeListResult` +- New struct `EncryptionScopeProperties` +- New struct `RaiBlockListItemsResult` +- New struct `RaiBlockListResult` +- New struct `RaiBlocklist` +- New struct `RaiBlocklistConfig` +- New struct `RaiBlocklistItem` +- New struct `RaiBlocklistItemProperties` +- New struct `RaiBlocklistProperties` +- New struct `RaiContentFilter` +- New struct `RaiContentFilterListResult` +- New struct `RaiPolicy` +- New struct `RaiPolicyContentFilter` +- New struct `RaiPolicyListResult` +- New struct `RaiPolicyProperties` +- New struct `SKUResource` +- New struct `UserOwnedAmlWorkspace` +- New field `AmlWorkspace` in struct `AccountProperties` +- New field `AllowedValues` in struct `CapacityConfig` +- New field `Tags` in struct `CommitmentPlanAccountAssociation` +- New field `Tags` in struct `Deployment` +- New field `CapacitySettings`, `CurrentCapacity`, `DynamicThrottlingEnabled` in struct `DeploymentProperties` +- New field `Bypass` in struct `NetworkRuleSet` + + ## 1.5.0 (2023-07-28) ### Features Added diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go index 02fd86bcbeab..e7ea1e32cfc7 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -48,7 +47,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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. @@ -59,7 +58,8 @@ func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[AccountsClientCreateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[AccountsClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[AccountsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *AccountsClient) create(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, account, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -105,16 +107,19 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, account) + if err := runtime.MarshalAsJSON(req, account); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a Cognitive Services account from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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. @@ -124,7 +129,8 @@ func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[AccountsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[AccountsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[AccountsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -133,20 +139,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -169,7 +177,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -178,23 +186,26 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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. func (client *AccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientGetOptions) (AccountsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return AccountsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AccountsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -217,7 +228,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -234,7 +245,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 +287,7 @@ func (client *AccountsClient) listCreateRequest(ctx context.Context, options *Ac return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -293,7 +304,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 +352,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -359,23 +370,26 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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. func (client *AccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientListKeysOptions) (AccountsClientListKeysResponse, error) { + var err error req, err := client.listKeysCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return AccountsClientListKeysResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientListKeysResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AccountsClientListKeysResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientListKeysResponse{}, err } - return client.listKeysHandleResponse(resp) + resp, err := client.listKeysHandleResponse(httpResp) + return resp, err } // listKeysCreateRequest creates the ListKeys request. @@ -398,7 +412,7 @@ func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -415,7 +429,7 @@ func (client *AccountsClient) listKeysHandleResponse(resp *http.Response) (Accou // NewListModelsPager - List available Models for the requested Cognitive Services account // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 +481,7 @@ func (client *AccountsClient) listModelsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -485,23 +499,26 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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. func (client *AccountsClient) ListSKUs(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientListSKUsOptions) (AccountsClientListSKUsResponse, error) { + var err error req, err := client.listSKUsCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return AccountsClientListSKUsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientListSKUsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AccountsClientListSKUsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientListSKUsResponse{}, err } - return client.listSKUsHandleResponse(resp) + resp, err := client.listSKUsHandleResponse(httpResp) + return resp, err } // listSKUsCreateRequest creates the ListSKUs request. @@ -524,7 +541,7 @@ func (client *AccountsClient) listSKUsCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -542,23 +559,26 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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. func (client *AccountsClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientListUsagesOptions) (AccountsClientListUsagesResponse, error) { + var err error req, err := client.listUsagesCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return AccountsClientListUsagesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientListUsagesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AccountsClientListUsagesResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientListUsagesResponse{}, err } - return client.listUsagesHandleResponse(resp) + resp, err := client.listUsagesHandleResponse(httpResp) + return resp, err } // listUsagesCreateRequest creates the ListUsages request. @@ -581,7 +601,7 @@ func (client *AccountsClient) listUsagesCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -602,24 +622,27 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - parameters - regenerate key parameters. // - options - AccountsClientRegenerateKeyOptions contains the optional parameters for the AccountsClient.RegenerateKey method. func (client *AccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, parameters RegenerateKeyParameters, options *AccountsClientRegenerateKeyOptions) (AccountsClientRegenerateKeyResponse, error) { + var err error req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { return AccountsClientRegenerateKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientRegenerateKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AccountsClientRegenerateKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientRegenerateKeyResponse{}, err } - return client.regenerateKeyHandleResponse(resp) + resp, err := client.regenerateKeyHandleResponse(httpResp) + return resp, err } // regenerateKeyCreateRequest creates the RegenerateKey request. @@ -642,10 +665,13 @@ func (client *AccountsClient) regenerateKeyCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // regenerateKeyHandleResponse handles the RegenerateKey response. @@ -660,7 +686,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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. @@ -671,7 +697,8 @@ func (client *AccountsClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[AccountsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[AccountsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[AccountsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -680,20 +707,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *AccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, account, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -716,8 +745,11 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, account) + if err := runtime.MarshalAsJSON(req, account); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client_example_test.go deleted file mode 100644 index 9c804a4f8b85..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client_example_test.go +++ /dev/null @@ -1,592 +0,0 @@ -//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/azcore/to" - "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/CreateAccount.json -func ExampleAccountsClient_BeginCreate_createAccount() { - 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) - } - poller, err := clientFactory.NewAccountsClient().BeginCreate(ctx, "myResourceGroup", "testCreate1", armcognitiveservices.Account{ - Identity: &armcognitiveservices.Identity{ - Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeSystemAssigned), - }, - Kind: to.Ptr("Emotion"), - Location: to.Ptr("West US"), - Properties: &armcognitiveservices.AccountProperties{ - Encryption: &armcognitiveservices.Encryption{ - KeySource: to.Ptr(armcognitiveservices.KeySourceMicrosoftKeyVault), - KeyVaultProperties: &armcognitiveservices.KeyVaultProperties{ - KeyName: to.Ptr("KeyName"), - KeyVaultURI: to.Ptr("https://pltfrmscrts-use-pc-dev.vault.azure.net/"), - KeyVersion: to.Ptr("891CF236-D241-4738-9462-D506AF493DFA"), - }, - }, - UserOwnedStorage: []*armcognitiveservices.UserOwnedStorage{ - { - ResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - }}, - }, - SKU: &armcognitiveservices.SKU{ - Name: to.Ptr("S0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armcognitiveservices.Account{ - // Name: to.Ptr("testCreate1"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1"), - // Etag: to.Ptr("W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\""), - // Identity: &armcognitiveservices.Identity{ - // Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("b5cf119e-a5c2-42c7-802f-592e0efb169f"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Kind: to.Ptr("Emotion"), - // Location: to.Ptr("West US"), - // Properties: &armcognitiveservices.AccountProperties{ - // Encryption: &armcognitiveservices.Encryption{ - // KeySource: to.Ptr(armcognitiveservices.KeySourceMicrosoftKeyVault), - // KeyVaultProperties: &armcognitiveservices.KeyVaultProperties{ - // KeyName: to.Ptr("FakeKeyName"), - // KeyVaultURI: to.Ptr("https://pltfrmscrts-use-pc-dev.vault.azure.net/"), - // KeyVersion: to.Ptr("891CF236-D241-4738-9462-D506AF493DFA"), - // }, - // }, - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/emotion/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // UserOwnedStorage: []*armcognitiveservices.UserOwnedStorage{ - // { - // ResourceID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), - // }}, - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewAccountsClient().BeginCreate(ctx, "myResourceGroup", "testCreate1", armcognitiveservices.Account{ - Identity: &armcognitiveservices.Identity{ - Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeSystemAssigned), - }, - Kind: to.Ptr("CognitiveServices"), - Location: to.Ptr("West US"), - Properties: &armcognitiveservices.AccountProperties{}, - SKU: &armcognitiveservices.SKU{ - Name: to.Ptr("S0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armcognitiveservices.Account{ - // Name: to.Ptr("testCreate1"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/testCreate1"), - // Etag: to.Ptr("W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\""), - // Identity: &armcognitiveservices.Identity{ - // Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("b5cf119e-a5c2-42c7-802f-592e0efb169f"), - // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // Kind: to.Ptr("Emotion"), - // Location: to.Ptr("West US"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/emotion/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewAccountsClient().BeginUpdate(ctx, "bvttest", "bingSearch", armcognitiveservices.Account{ - Location: to.Ptr("global"), - SKU: &armcognitiveservices.SKU{ - Name: to.Ptr("S2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armcognitiveservices.Account{ - // Name: to.Ptr("bingSearch"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/bingSearch"), - // Etag: to.Ptr("W/\"datetime'2017-04-10T07%3A46%3A21.5618831Z'\""), - // Kind: to.Ptr("Bing.Search"), - // Location: to.Ptr("global"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://api.cognitive.microsoft.com/bing/v5.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S2"), - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewAccountsClient().BeginDelete(ctx, "myResourceGroup", "PropTest01", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// 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 { - 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) - } - res, err := clientFactory.NewAccountsClient().Get(ctx, "myResourceGroup", "myAccount", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armcognitiveservices.Account{ - // Name: to.Ptr("myAccount"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/myAccount"), - // Etag: to.Ptr("W/\"datetime'2017-04-10T04%3A42%3A19.7067387Z'\""), - // Kind: to.Ptr("Emotion"), - // Location: to.Ptr("westus"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/emotion/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("F0"), - // }, - // Tags: map[string]*string{ - // "ExpiredDate": to.Ptr("2017/09/01"), - // "Owner": to.Ptr("felixwa"), - // }, - // } -} - -// 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 { - 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.NewAccountsClient().NewListByResourceGroupPager("myResourceGroup", 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.AccountListResult = armcognitiveservices.AccountListResult{ - // Value: []*armcognitiveservices.Account{ - // { - // Name: to.Ptr("myAccount"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/myAccount"), - // Etag: to.Ptr("W/\"datetime'2017-04-10T04%3A42%3A19.7067387Z'\""), - // Kind: to.Ptr("Emotion"), - // Location: to.Ptr("westus"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/emotion/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("F0"), - // }, - // Tags: map[string]*string{ - // "ExpiredDate": to.Ptr("2017/09/01"), - // "Owner": to.Ptr("felixwa"), - // }, - // }, - // { - // Name: to.Ptr("TestPropertyWU2"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/TestPropertyWU2"), - // Etag: to.Ptr("W/\"datetime'2017-04-07T04%3A32%3A38.9187216Z'\""), - // Kind: to.Ptr("Face"), - // Location: to.Ptr("westus"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/face/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// 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 { - 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.NewAccountsClient().NewListPager(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.AccountListResult = armcognitiveservices.AccountListResult{ - // Value: []*armcognitiveservices.Account{ - // { - // Name: to.Ptr("bingSearch"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/bingSearch"), - // Etag: to.Ptr("W/\"datetime'2017-03-27T11%3A19%3A08.762494Z'\""), - // Kind: to.Ptr("Bing.Search"), - // Location: to.Ptr("global"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://api.cognitive.microsoft.com/bing/v5.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S1"), - // }, - // }, - // { - // Name: to.Ptr("CrisProd"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/CrisProd"), - // Etag: to.Ptr("W/\"datetime'2017-03-31T08%3A57%3A07.4499566Z'\""), - // Kind: to.Ptr("CRIS"), - // Location: to.Ptr("westus"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/sts/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // Tags: map[string]*string{ - // "can't delete it successfully": to.Ptr("v-yunjin"), - // }, - // }, - // { - // Name: to.Ptr("rayrptest0308"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/rayrptest0308"), - // Etag: to.Ptr("W/\"datetime'2017-03-27T11%3A15%3A23.5232645Z'\""), - // Kind: to.Ptr("Face"), - // Location: to.Ptr("westus"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/face/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // }, - // { - // Name: to.Ptr("raytest02"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/raytest02"), - // Etag: to.Ptr("W/\"datetime'2017-04-04T02%3A07%3A07.3957572Z'\""), - // Kind: to.Ptr("Emotion"), - // Location: to.Ptr("westus"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/emotion/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // }}, - // } - } -} - -// 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 { - 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) - } - res, err := clientFactory.NewAccountsClient().ListKeys(ctx, "myResourceGroup", "myAccount", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.APIKeys = armcognitiveservices.APIKeys{ - // Key1: to.Ptr("KEY1"), - // Key2: to.Ptr("KEY2"), - // } -} - -// 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 { - 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) - } - res, err := clientFactory.NewAccountsClient().RegenerateKey(ctx, "myResourceGroup", "myAccount", armcognitiveservices.RegenerateKeyParameters{ - KeyName: to.Ptr(armcognitiveservices.KeyNameKey2), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.APIKeys = armcognitiveservices.APIKeys{ - // Key1: to.Ptr("KEY1"), - // Key2: to.Ptr("KEY2"), - // } -} - -// 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 { - 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) - } - res, err := clientFactory.NewAccountsClient().ListSKUs(ctx, "myResourceGroup", "myAccount", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccountSKUListResult = armcognitiveservices.AccountSKUListResult{ - // Value: []*armcognitiveservices.AccountSKU{ - // { - // ResourceType: to.Ptr("Microsoft.CognitiveServices/accounts"), - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("F0"), - // Tier: to.Ptr(armcognitiveservices.SKUTierFree), - // }, - // }, - // { - // ResourceType: to.Ptr("Microsoft.CognitiveServices/accounts"), - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // Tier: to.Ptr(armcognitiveservices.SKUTierStandard), - // }, - // }}, - // } -} - -// 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 { - 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) - } - res, err := clientFactory.NewAccountsClient().ListUsages(ctx, "myResourceGroup", "TestUsage02", &armcognitiveservices.AccountsClientListUsagesOptions{Filter: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UsageListResult = armcognitiveservices.UsageListResult{ - // Value: []*armcognitiveservices.Usage{ - // { - // Name: &armcognitiveservices.MetricName{ - // LocalizedValue: to.Ptr("Face.Transactions"), - // Value: to.Ptr("Face.Transactions"), - // }, - // CurrentValue: to.Ptr[float64](3), - // Limit: to.Ptr[float64](30000), - // NextResetTime: to.Ptr("2018-03-28T09:33:51Z"), - // QuotaPeriod: to.Ptr("30.00:00:00"), - // Status: to.Ptr(armcognitiveservices.QuotaUsageStatusIncluded), - // Unit: to.Ptr(armcognitiveservices.UnitTypeCount), - // }}, - // } -} - -// 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 { - 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.NewAccountsClient().NewListModelsPager("resourceGroupName", "accountName", 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.AccountModelListResult = armcognitiveservices.AccountModelListResult{ - // Value: []*armcognitiveservices.AccountModel{ - // { - // Name: to.Ptr("ada.1"), - // Format: to.Ptr("OpenAI"), - // Version: to.Ptr("1"), - // BaseModel: &armcognitiveservices.DeploymentModel{ - // Name: to.Ptr("ada"), - // Format: to.Ptr("OpenAI"), - // Version: to.Ptr("1"), - // }, - // Capabilities: map[string]*string{ - // "fineTune": to.Ptr("true"), - // }, - // Deprecation: &armcognitiveservices.ModelDeprecationInfo{ - // FineTune: to.Ptr("2024-01-01T00:00:00Z"), - // Inference: to.Ptr("2024-01-01T00:00:00Z"), - // }, - // MaxCapacity: to.Ptr[int32](10), - // }, - // { - // Name: to.Ptr("davinci"), - // Format: to.Ptr("OpenAI"), - // Version: to.Ptr("1"), - // Capabilities: map[string]*string{ - // "fineTune": to.Ptr("true"), - // }, - // Deprecation: &armcognitiveservices.ModelDeprecationInfo{ - // FineTune: to.Ptr("2024-01-01T00:00:00Z"), - // Inference: to.Ptr("2024-01-01T00:00:00Z"), - // }, - // MaxCapacity: to.Ptr[int32](10), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md index 4a9c572b5db3..bcb1381899ef 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- 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 +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cognitiveservices/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cognitiveservices/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.5.0 -tag: package-2023-05 +module-version: 1.6.0-beta.1 ``` \ 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 e492cb29dcbf..eb9d2363f82f 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -43,33 +42,33 @@ func (c *ClientFactory) NewAccountsClient() *AccountsClient { return subClient } -func (c *ClientFactory) NewDeletedAccountsClient() *DeletedAccountsClient { - subClient, _ := NewDeletedAccountsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCommitmentPlansClient() *CommitmentPlansClient { + subClient, _ := NewCommitmentPlansClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewResourceSKUsClient() *ResourceSKUsClient { - subClient, _ := NewResourceSKUsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCommitmentTiersClient() *CommitmentTiersClient { + subClient, _ := NewCommitmentTiersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewUsagesClient() *UsagesClient { - subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDeletedAccountsClient() *DeletedAccountsClient { + subClient, _ := NewDeletedAccountsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewDeploymentsClient() *DeploymentsClient { + subClient, _ := NewDeploymentsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagementClient() *ManagementClient { - subClient, _ := NewManagementClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewEncryptionScopesClient() *EncryptionScopesClient { + subClient, _ := NewEncryptionScopesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewCommitmentTiersClient() *CommitmentTiersClient { - subClient, _ := NewCommitmentTiersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagementClient() *ManagementClient { + subClient, _ := NewManagementClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -78,6 +77,11 @@ func (c *ClientFactory) NewModelsClient() *ModelsClient { return subClient } +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -88,12 +92,32 @@ func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesCli return subClient } -func (c *ClientFactory) NewDeploymentsClient() *DeploymentsClient { - subClient, _ := NewDeploymentsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRaiBlocklistItemsClient() *RaiBlocklistItemsClient { + subClient, _ := NewRaiBlocklistItemsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewCommitmentPlansClient() *CommitmentPlansClient { - subClient, _ := NewCommitmentPlansClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRaiBlocklistsClient() *RaiBlocklistsClient { + subClient, _ := NewRaiBlocklistsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRaiContentFiltersClient() *RaiContentFiltersClient { + subClient, _ := NewRaiContentFiltersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRaiPoliciesClient() *RaiPoliciesClient { + subClient, _ := NewRaiPoliciesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewResourceSKUsClient() *ResourceSKUsClient { + subClient, _ := NewResourceSKUsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewUsagesClient() *UsagesClient { + subClient, _ := NewUsagesClient(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 577d27e34620..6f1c372d9228 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -47,7 +46,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 @@ -55,18 +54,21 @@ func NewCommitmentPlansClient(subscriptionID string, credential azcore.TokenCred // - options - CommitmentPlansClientCreateOrUpdateOptions contains the optional parameters for the CommitmentPlansClient.CreateOrUpdate // method. func (client *CommitmentPlansClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, commitmentPlan CommitmentPlan, options *CommitmentPlansClientCreateOrUpdateOptions) (CommitmentPlansClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, commitmentPlanName, commitmentPlan, options) if err != nil { return CommitmentPlansClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CommitmentPlansClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return CommitmentPlansClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return CommitmentPlansClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -93,10 +95,13 @@ func (client *CommitmentPlansClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, commitmentPlan) + if err := runtime.MarshalAsJSON(req, commitmentPlan); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -111,7 +116,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 @@ -124,9 +129,10 @@ func (client *CommitmentPlansClient) BeginCreateOrUpdateAssociation(ctx context. if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommitmentPlansClientCreateOrUpdateAssociationResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommitmentPlansClientCreateOrUpdateAssociationResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CommitmentPlansClientCreateOrUpdateAssociationResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -135,20 +141,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *CommitmentPlansClient) createOrUpdateAssociation(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, association CommitmentPlanAccountAssociation, options *CommitmentPlansClientBeginCreateOrUpdateAssociationOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateAssociationCreateRequest(ctx, resourceGroupName, commitmentPlanName, commitmentPlanAssociationName, association, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateAssociationCreateRequest creates the CreateOrUpdateAssociation request. @@ -175,16 +183,19 @@ func (client *CommitmentPlansClient) createOrUpdateAssociationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, association) + if err := runtime.MarshalAsJSON(req, association); err != nil { + return nil, err + } + return req, nil } // BeginCreateOrUpdatePlan - Create Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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. @@ -196,9 +207,10 @@ func (client *CommitmentPlansClient) BeginCreateOrUpdatePlan(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommitmentPlansClientCreateOrUpdatePlanResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommitmentPlansClientCreateOrUpdatePlanResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CommitmentPlansClientCreateOrUpdatePlanResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -207,20 +219,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *CommitmentPlansClient) createOrUpdatePlan(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlan CommitmentPlan, options *CommitmentPlansClientBeginCreateOrUpdatePlanOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdatePlanCreateRequest(ctx, resourceGroupName, commitmentPlanName, commitmentPlan, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdatePlanCreateRequest creates the CreateOrUpdatePlan request. @@ -243,16 +257,19 @@ func (client *CommitmentPlansClient) createOrUpdatePlanCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, commitmentPlan) + if err := runtime.MarshalAsJSON(req, commitmentPlan); err != nil { + return nil, err + } + return req, nil } // 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 @@ -264,7 +281,8 @@ func (client *CommitmentPlansClient) BeginDelete(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[CommitmentPlansClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CommitmentPlansClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CommitmentPlansClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -273,20 +291,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *CommitmentPlansClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, options *CommitmentPlansClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, commitmentPlanName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -313,7 +333,7 @@ func (client *CommitmentPlansClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +342,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 @@ -334,9 +354,10 @@ func (client *CommitmentPlansClient) BeginDeleteAssociation(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommitmentPlansClientDeleteAssociationResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommitmentPlansClientDeleteAssociationResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CommitmentPlansClientDeleteAssociationResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -345,20 +366,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *CommitmentPlansClient) deleteAssociation(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, options *CommitmentPlansClientBeginDeleteAssociationOptions) (*http.Response, error) { + var err error req, err := client.deleteAssociationCreateRequest(ctx, resourceGroupName, commitmentPlanName, commitmentPlanAssociationName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteAssociationCreateRequest creates the DeleteAssociation request. @@ -385,7 +408,7 @@ func (client *CommitmentPlansClient) deleteAssociationCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -394,7 +417,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 @@ -405,9 +428,10 @@ func (client *CommitmentPlansClient) BeginDeletePlan(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommitmentPlansClientDeletePlanResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommitmentPlansClientDeletePlanResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CommitmentPlansClientDeletePlanResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -416,20 +440,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *CommitmentPlansClient) deletePlan(ctx context.Context, resourceGroupName string, commitmentPlanName string, options *CommitmentPlansClientBeginDeletePlanOptions) (*http.Response, error) { + var err error req, err := client.deletePlanCreateRequest(ctx, resourceGroupName, commitmentPlanName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deletePlanCreateRequest creates the DeletePlan request. @@ -452,7 +478,7 @@ func (client *CommitmentPlansClient) deletePlanCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -461,24 +487,27 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 // - options - CommitmentPlansClientGetOptions contains the optional parameters for the CommitmentPlansClient.Get method. func (client *CommitmentPlansClient) Get(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, options *CommitmentPlansClientGetOptions) (CommitmentPlansClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, commitmentPlanName, options) if err != nil { return CommitmentPlansClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CommitmentPlansClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CommitmentPlansClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CommitmentPlansClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -505,7 +534,7 @@ func (client *CommitmentPlansClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -523,25 +552,28 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 // - options - CommitmentPlansClientGetAssociationOptions contains the optional parameters for the CommitmentPlansClient.GetAssociation // method. func (client *CommitmentPlansClient) GetAssociation(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, options *CommitmentPlansClientGetAssociationOptions) (CommitmentPlansClientGetAssociationResponse, error) { + var err error req, err := client.getAssociationCreateRequest(ctx, resourceGroupName, commitmentPlanName, commitmentPlanAssociationName, options) if err != nil { return CommitmentPlansClientGetAssociationResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CommitmentPlansClientGetAssociationResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CommitmentPlansClientGetAssociationResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CommitmentPlansClientGetAssociationResponse{}, err } - return client.getAssociationHandleResponse(resp) + resp, err := client.getAssociationHandleResponse(httpResp) + return resp, err } // getAssociationCreateRequest creates the GetAssociation request. @@ -568,7 +600,7 @@ func (client *CommitmentPlansClient) getAssociationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -586,23 +618,26 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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. func (client *CommitmentPlansClient) GetPlan(ctx context.Context, resourceGroupName string, commitmentPlanName string, options *CommitmentPlansClientGetPlanOptions) (CommitmentPlansClientGetPlanResponse, error) { + var err error req, err := client.getPlanCreateRequest(ctx, resourceGroupName, commitmentPlanName, options) if err != nil { return CommitmentPlansClientGetPlanResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CommitmentPlansClientGetPlanResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CommitmentPlansClientGetPlanResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CommitmentPlansClientGetPlanResponse{}, err } - return client.getPlanHandleResponse(resp) + resp, err := client.getPlanHandleResponse(httpResp) + return resp, err } // getPlanCreateRequest creates the GetPlan request. @@ -625,7 +660,7 @@ func (client *CommitmentPlansClient) getPlanCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -642,7 +677,7 @@ func (client *CommitmentPlansClient) getPlanHandleResponse(resp *http.Response) // NewListPager - Gets the commitmentPlans associated with the Cognitive Services account. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 +730,7 @@ func (client *CommitmentPlansClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -712,7 +747,7 @@ func (client *CommitmentPlansClient) listHandleResponse(resp *http.Response) (Co // NewListAssociationsPager - Gets the associations of the Cognitive Services commitment plan. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 +800,7 @@ func (client *CommitmentPlansClient) listAssociationsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -782,7 +817,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 +865,7 @@ func (client *CommitmentPlansClient) listPlansByResourceGroupCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -847,7 +882,7 @@ func (client *CommitmentPlansClient) listPlansByResourceGroupHandleResponse(resp // NewListPlansBySubscriptionPager - Returns all the resources of a particular type belonging to a subscription. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - options - CommitmentPlansClientListPlansBySubscriptionOptions contains the optional parameters for the CommitmentPlansClient.NewListPlansBySubscriptionPager // method. func (client *CommitmentPlansClient) NewListPlansBySubscriptionPager(options *CommitmentPlansClientListPlansBySubscriptionOptions) *runtime.Pager[CommitmentPlansClientListPlansBySubscriptionResponse] { @@ -890,7 +925,7 @@ func (client *CommitmentPlansClient) listPlansBySubscriptionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -908,7 +943,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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. @@ -920,9 +955,10 @@ func (client *CommitmentPlansClient) BeginUpdatePlan(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommitmentPlansClientUpdatePlanResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CommitmentPlansClientUpdatePlanResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CommitmentPlansClientUpdatePlanResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -931,20 +967,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *CommitmentPlansClient) updatePlan(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlan PatchResourceTagsAndSKU, options *CommitmentPlansClientBeginUpdatePlanOptions) (*http.Response, error) { + var err error req, err := client.updatePlanCreateRequest(ctx, resourceGroupName, commitmentPlanName, commitmentPlan, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updatePlanCreateRequest creates the UpdatePlan request. @@ -967,8 +1005,11 @@ func (client *CommitmentPlansClient) updatePlanCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, commitmentPlan) + if err := runtime.MarshalAsJSON(req, commitmentPlan); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client_example_test.go deleted file mode 100644 index 9121bbb326a7..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client_example_test.go +++ /dev/null @@ -1,538 +0,0 @@ -//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/azcore/to" - "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/ListCommitmentPlans.json -func ExampleCommitmentPlansClient_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.NewCommitmentPlansClient().NewListPager("resourceGroupName", "accountName", 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.CommitmentPlanListResult = armcognitiveservices.CommitmentPlanListResult{ - // Value: []*armcognitiveservices.CommitmentPlan{ - // { - // Name: to.Ptr("commitmentPlanName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/commitmentPlans"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/commitmentPlans/commitmentPlanName"), - // Properties: &armcognitiveservices.CommitmentPlanProperties{ - // AutoRenew: to.Ptr(true), - // Current: &armcognitiveservices.CommitmentPeriod{ - // Tier: to.Ptr("T1"), - // }, - // HostingModel: to.Ptr(armcognitiveservices.HostingModelWeb), - // PlanType: to.Ptr("Speech2Text"), - // }, - // }}, - // } - } -} - -// 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 { - 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) - } - res, err := clientFactory.NewCommitmentPlansClient().Get(ctx, "resourceGroupName", "accountName", "commitmentPlanName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommitmentPlan = armcognitiveservices.CommitmentPlan{ - // Name: to.Ptr("commitmentPlanName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/commitmentPlans"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/commitmentPlans/commitmentPlanName"), - // Properties: &armcognitiveservices.CommitmentPlanProperties{ - // AutoRenew: to.Ptr(true), - // Current: &armcognitiveservices.CommitmentPeriod{ - // Tier: to.Ptr("T1"), - // }, - // HostingModel: to.Ptr(armcognitiveservices.HostingModelWeb), - // PlanType: to.Ptr("Speech2Text"), - // }, - // } -} - -// 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 { - 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) - } - res, err := clientFactory.NewCommitmentPlansClient().CreateOrUpdate(ctx, "resourceGroupName", "accountName", "commitmentPlanName", armcognitiveservices.CommitmentPlan{ - Properties: &armcognitiveservices.CommitmentPlanProperties{ - AutoRenew: to.Ptr(true), - Current: &armcognitiveservices.CommitmentPeriod{ - Tier: to.Ptr("T1"), - }, - HostingModel: to.Ptr(armcognitiveservices.HostingModelWeb), - PlanType: to.Ptr("Speech2Text"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommitmentPlan = armcognitiveservices.CommitmentPlan{ - // Name: to.Ptr("commitmentPlanName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/commitmentPlans"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/commitmentPlans/commitmentPlanName"), - // Properties: &armcognitiveservices.CommitmentPlanProperties{ - // AutoRenew: to.Ptr(true), - // Current: &armcognitiveservices.CommitmentPeriod{ - // Tier: to.Ptr("T1"), - // }, - // HostingModel: to.Ptr(armcognitiveservices.HostingModelWeb), - // PlanType: to.Ptr("Speech2Text"), - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewCommitmentPlansClient().BeginDelete(ctx, "resourceGroupName", "accountName", "commitmentPlanName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewCommitmentPlansClient().BeginCreateOrUpdatePlan(ctx, "resourceGroupName", "commitmentPlanName", armcognitiveservices.CommitmentPlan{ - Kind: to.Ptr("SpeechServices"), - Location: to.Ptr("West US"), - Properties: &armcognitiveservices.CommitmentPlanProperties{ - AutoRenew: to.Ptr(true), - Current: &armcognitiveservices.CommitmentPeriod{ - Tier: to.Ptr("T1"), - }, - HostingModel: to.Ptr(armcognitiveservices.HostingModelWeb), - PlanType: to.Ptr("STT"), - }, - SKU: &armcognitiveservices.SKU{ - Name: to.Ptr("S0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommitmentPlan = armcognitiveservices.CommitmentPlan{ - // Name: to.Ptr("commitmentPlanName"), - // Type: to.Ptr("Microsoft.CognitiveServices/commitmentPlans"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/commitmentPlans/commitmentPlanName"), - // Kind: to.Ptr("SpeechServices"), - // Location: to.Ptr("West US"), - // Properties: &armcognitiveservices.CommitmentPlanProperties{ - // AutoRenew: to.Ptr(true), - // Current: &armcognitiveservices.CommitmentPeriod{ - // Tier: to.Ptr("T1"), - // }, - // HostingModel: to.Ptr(armcognitiveservices.HostingModelWeb), - // PlanType: to.Ptr("STT"), - // ProvisioningState: to.Ptr(armcognitiveservices.CommitmentPlanProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewCommitmentPlansClient().BeginUpdatePlan(ctx, "resourceGroupName", "commitmentPlanName", armcognitiveservices.PatchResourceTagsAndSKU{ - Tags: map[string]*string{ - "name": to.Ptr("value"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommitmentPlan = armcognitiveservices.CommitmentPlan{ - // Name: to.Ptr("commitmentPlanName"), - // Type: to.Ptr("Microsoft.CognitiveServices/commitmentPlans"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/commitmentPlans/commitmentPlanName"), - // Kind: to.Ptr("SpeechServices"), - // Location: to.Ptr("West US"), - // Properties: &armcognitiveservices.CommitmentPlanProperties{ - // AutoRenew: to.Ptr(true), - // Current: &armcognitiveservices.CommitmentPeriod{ - // Tier: to.Ptr("T1"), - // }, - // HostingModel: to.Ptr(armcognitiveservices.HostingModelWeb), - // PlanType: to.Ptr("STT"), - // ProvisioningState: to.Ptr(armcognitiveservices.CommitmentPlanProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // Tags: map[string]*string{ - // "name": to.Ptr("value"), - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewCommitmentPlansClient().BeginDeletePlan(ctx, "resourceGroupName", "commitmentPlanName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// 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 { - 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) - } - res, err := clientFactory.NewCommitmentPlansClient().GetPlan(ctx, "resourceGroupName", "commitmentPlanName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommitmentPlan = armcognitiveservices.CommitmentPlan{ - // Name: to.Ptr("commitmentPlanName"), - // Type: to.Ptr("Microsoft.CognitiveServices/commitmentPlans"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/commitmentPlans/commitmentPlanName"), - // Kind: to.Ptr("SpeechServices"), - // Location: to.Ptr("West US"), - // Properties: &armcognitiveservices.CommitmentPlanProperties{ - // AutoRenew: to.Ptr(true), - // Current: &armcognitiveservices.CommitmentPeriod{ - // Tier: to.Ptr("T1"), - // }, - // HostingModel: to.Ptr(armcognitiveservices.HostingModelWeb), - // PlanType: to.Ptr("STT"), - // ProvisioningState: to.Ptr(armcognitiveservices.CommitmentPlanProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // } -} - -// 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 { - 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.NewCommitmentPlansClient().NewListPlansByResourceGroupPager("resourceGroupName", 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.CommitmentPlanListResult = armcognitiveservices.CommitmentPlanListResult{ - // Value: []*armcognitiveservices.CommitmentPlan{ - // { - // Name: to.Ptr("commitmentPlanName"), - // Type: to.Ptr("Microsoft.CognitiveServices/commitmentPlans"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/commitmentPlans/commitmentPlanName"), - // Kind: to.Ptr("SpeechServices"), - // Location: to.Ptr("West US"), - // Properties: &armcognitiveservices.CommitmentPlanProperties{ - // AutoRenew: to.Ptr(true), - // Current: &armcognitiveservices.CommitmentPeriod{ - // Tier: to.Ptr("T1"), - // }, - // HostingModel: to.Ptr(armcognitiveservices.HostingModelWeb), - // PlanType: to.Ptr("STT"), - // ProvisioningState: to.Ptr(armcognitiveservices.CommitmentPlanProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // }}, - // } - } -} - -// 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 { - 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.NewCommitmentPlansClient().NewListPlansBySubscriptionPager(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.CommitmentPlanListResult = armcognitiveservices.CommitmentPlanListResult{ - // Value: []*armcognitiveservices.CommitmentPlan{ - // { - // Name: to.Ptr("commitmentPlanName"), - // Type: to.Ptr("Microsoft.CognitiveServices/commitmentPlans"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/commitmentPlans/commitmentPlanName"), - // Kind: to.Ptr("SpeechServices"), - // Location: to.Ptr("West US"), - // Properties: &armcognitiveservices.CommitmentPlanProperties{ - // AutoRenew: to.Ptr(true), - // Current: &armcognitiveservices.CommitmentPeriod{ - // Tier: to.Ptr("T1"), - // }, - // HostingModel: to.Ptr(armcognitiveservices.HostingModelWeb), - // PlanType: to.Ptr("STT"), - // ProvisioningState: to.Ptr(armcognitiveservices.CommitmentPlanProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // }}, - // } - } -} - -// 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 { - 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.NewCommitmentPlansClient().NewListAssociationsPager("resourceGroupName", "commitmentPlanName", 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.CommitmentPlanAccountAssociationListResult = armcognitiveservices.CommitmentPlanAccountAssociationListResult{ - // Value: []*armcognitiveservices.CommitmentPlanAccountAssociation{ - // { - // Name: to.Ptr("accountAssociationName"), - // Type: to.Ptr("Microsoft.CognitiveServices/commitmentPlans/accountAssociations"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/commitmentPlans/commitmentPlanName/accountAssociations/accountAssociationName"), - // Properties: &armcognitiveservices.CommitmentPlanAccountAssociationProperties{ - // AccountID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName"), - // }, - // }}, - // } - } -} - -// 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 { - 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) - } - res, err := clientFactory.NewCommitmentPlansClient().GetAssociation(ctx, "resourceGroupName", "commitmentPlanName", "commitmentPlanAssociationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommitmentPlanAccountAssociation = armcognitiveservices.CommitmentPlanAccountAssociation{ - // Name: to.Ptr("commitmentPlanAssociationName"), - // Type: to.Ptr("Microsoft.CognitiveServices/commitmentPlans/accountAssociations"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/commitmentPlans/commitmentPlanName/accountAssociations/commitmentPlanAssociationName"), - // Properties: &armcognitiveservices.CommitmentPlanAccountAssociationProperties{ - // AccountID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName"), - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewCommitmentPlansClient().BeginCreateOrUpdateAssociation(ctx, "resourceGroupName", "commitmentPlanName", "commitmentPlanAssociationName", armcognitiveservices.CommitmentPlanAccountAssociation{ - Properties: &armcognitiveservices.CommitmentPlanAccountAssociationProperties{ - AccountID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CommitmentPlanAccountAssociation = armcognitiveservices.CommitmentPlanAccountAssociation{ - // Name: to.Ptr("commitmentPlanAssociationName"), - // Type: to.Ptr("Microsoft.CognitiveServices/commitmentPlans/accountAssociations"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/commitmentPlans/commitmentPlanName/accountAssociations/commitmentPlanAssociationName"), - // Properties: &armcognitiveservices.CommitmentPlanAccountAssociationProperties{ - // AccountID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName"), - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewCommitmentPlansClient().BeginDeleteAssociation(ctx, "resourceGroupName", "commitmentPlanName", "commitmentPlanAssociationName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go index dd311f3f08aa..aad1e1832f83 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -46,7 +45,7 @@ func NewCommitmentTiersClient(subscriptionID string, credential azcore.TokenCred // NewListPager - List Commitment Tiers. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - location - Resource location. // - options - CommitmentTiersClientListOptions contains the optional parameters for the CommitmentTiersClient.NewListPager // method. @@ -94,7 +93,7 @@ func (client *CommitmentTiersClient) listCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") 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 deleted file mode 100644 index 7b2cb39cca98..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client_example_test.go +++ /dev/null @@ -1,59 +0,0 @@ -//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/ListCommitmentTiers.json -func ExampleCommitmentTiersClient_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.NewCommitmentTiersClient().NewListPager("location", 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.CommitmentTierListResult = armcognitiveservices.CommitmentTierListResult{ - // Value: []*armcognitiveservices.CommitmentTier{ - // { - // Cost: &armcognitiveservices.CommitmentCost{ - // }, - // HostingModel: to.Ptr(armcognitiveservices.HostingModelWeb), - // Kind: to.Ptr("TextAnalytics"), - // PlanType: to.Ptr("TA"), - // Quota: &armcognitiveservices.CommitmentQuota{ - // Quantity: to.Ptr[int64](1000000), - // Unit: to.Ptr("Transaction"), - // }, - // SKUName: to.Ptr("S"), - // Tier: to.Ptr("T1"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go index 197f6cf1e3c2..e3655651ad12 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go @@ -3,15 +3,14 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices const ( moduleName = "armcognitiveservices" - moduleVersion = "v1.5.0" + moduleVersion = "v1.6.0-beta.1" ) // AbusePenaltyAction - The action of AbusePenalty. @@ -44,6 +43,40 @@ func PossibleActionTypeValues() []ActionType { } } +// AllowedContentLevel - Level at which content is filtered. +type AllowedContentLevel string + +const ( + AllowedContentLevelHigh AllowedContentLevel = "High" + AllowedContentLevelLow AllowedContentLevel = "Low" + AllowedContentLevelMedium AllowedContentLevel = "Medium" +) + +// PossibleAllowedContentLevelValues returns the possible values for the AllowedContentLevel const type. +func PossibleAllowedContentLevelValues() []AllowedContentLevel { + return []AllowedContentLevel{ + AllowedContentLevelHigh, + AllowedContentLevelLow, + AllowedContentLevelMedium, + } +} + +// ByPassSelection - Setting for trusted services. +type ByPassSelection string + +const ( + ByPassSelectionAzureServices ByPassSelection = "AzureServices" + ByPassSelectionNone ByPassSelection = "None" +) + +// PossibleByPassSelectionValues returns the possible values for the ByPassSelection const type. +func PossibleByPassSelectionValues() []ByPassSelection { + return []ByPassSelection{ + ByPassSelectionAzureServices, + ByPassSelectionNone, + } +} + // CommitmentPlanProvisioningState - Gets the status of the resource at the time the operation was called. type CommitmentPlanProvisioningState string @@ -152,6 +185,48 @@ func PossibleDeploymentScaleTypeValues() []DeploymentScaleType { } } +// EncryptionScopeProvisioningState - Gets the status of the resource at the time the operation was called. +type EncryptionScopeProvisioningState string + +const ( + EncryptionScopeProvisioningStateAccepted EncryptionScopeProvisioningState = "Accepted" + EncryptionScopeProvisioningStateCanceled EncryptionScopeProvisioningState = "Canceled" + EncryptionScopeProvisioningStateCreating EncryptionScopeProvisioningState = "Creating" + EncryptionScopeProvisioningStateDeleting EncryptionScopeProvisioningState = "Deleting" + EncryptionScopeProvisioningStateFailed EncryptionScopeProvisioningState = "Failed" + EncryptionScopeProvisioningStateMoving EncryptionScopeProvisioningState = "Moving" + EncryptionScopeProvisioningStateSucceeded EncryptionScopeProvisioningState = "Succeeded" +) + +// PossibleEncryptionScopeProvisioningStateValues returns the possible values for the EncryptionScopeProvisioningState const type. +func PossibleEncryptionScopeProvisioningStateValues() []EncryptionScopeProvisioningState { + return []EncryptionScopeProvisioningState{ + EncryptionScopeProvisioningStateAccepted, + EncryptionScopeProvisioningStateCanceled, + EncryptionScopeProvisioningStateCreating, + EncryptionScopeProvisioningStateDeleting, + EncryptionScopeProvisioningStateFailed, + EncryptionScopeProvisioningStateMoving, + EncryptionScopeProvisioningStateSucceeded, + } +} + +// EncryptionScopeState - The encryptionScope state. +type EncryptionScopeState string + +const ( + EncryptionScopeStateDisabled EncryptionScopeState = "Disabled" + EncryptionScopeStateEnabled EncryptionScopeState = "Enabled" +) + +// PossibleEncryptionScopeStateValues returns the possible values for the EncryptionScopeState const type. +func PossibleEncryptionScopeStateValues() []EncryptionScopeState { + return []EncryptionScopeState{ + EncryptionScopeStateDisabled, + EncryptionScopeStateEnabled, + } +} + // HostingModel - Account hosting model. type HostingModel string @@ -356,14 +431,80 @@ func PossibleQuotaUsageStatusValues() []QuotaUsageStatus { } } +// RaiContentFilterType - Content Filter type. +type RaiContentFilterType string + +const ( + RaiContentFilterTypeMultiLevel RaiContentFilterType = "MultiLevel" + RaiContentFilterTypeSwitch RaiContentFilterType = "Switch" +) + +// PossibleRaiContentFilterTypeValues returns the possible values for the RaiContentFilterType const type. +func PossibleRaiContentFilterTypeValues() []RaiContentFilterType { + return []RaiContentFilterType{ + RaiContentFilterTypeMultiLevel, + RaiContentFilterTypeSwitch, + } +} + +// RaiPolicyContentSource - Content source to apply the Content Filters. +type RaiPolicyContentSource string + +const ( + RaiPolicyContentSourceCompletion RaiPolicyContentSource = "Completion" + RaiPolicyContentSourcePrompt RaiPolicyContentSource = "Prompt" +) + +// PossibleRaiPolicyContentSourceValues returns the possible values for the RaiPolicyContentSource const type. +func PossibleRaiPolicyContentSourceValues() []RaiPolicyContentSource { + return []RaiPolicyContentSource{ + RaiPolicyContentSourceCompletion, + RaiPolicyContentSourcePrompt, + } +} + +// RaiPolicyMode - Content Filters mode. +type RaiPolicyMode string + +const ( + RaiPolicyModeBlocking RaiPolicyMode = "Blocking" + RaiPolicyModeDefault RaiPolicyMode = "Default" + RaiPolicyModeDeferred RaiPolicyMode = "Deferred" +) + +// PossibleRaiPolicyModeValues returns the possible values for the RaiPolicyMode const type. +func PossibleRaiPolicyModeValues() []RaiPolicyMode { + return []RaiPolicyMode{ + RaiPolicyModeBlocking, + RaiPolicyModeDefault, + RaiPolicyModeDeferred, + } +} + +// RaiPolicyType - Content Filters policy type. +type RaiPolicyType string + +const ( + RaiPolicyTypeSystemManaged RaiPolicyType = "SystemManaged" + RaiPolicyTypeUserManaged RaiPolicyType = "UserManaged" +) + +// PossibleRaiPolicyTypeValues returns the possible values for the RaiPolicyType const type. +func PossibleRaiPolicyTypeValues() []RaiPolicyType { + return []RaiPolicyType{ + RaiPolicyTypeSystemManaged, + RaiPolicyTypeUserManaged, + } +} + // ResourceIdentityType - The identity type. type ResourceIdentityType string const ( ResourceIdentityTypeNone ResourceIdentityType = "None" ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" ) // PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. @@ -371,8 +512,8 @@ func PossibleResourceIdentityTypeValues() []ResourceIdentityType { return []ResourceIdentityType{ ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, - ResourceIdentityTypeUserAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, + ResourceIdentityTypeUserAssigned, } } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go index 0b48f0be0130..3e31b66837ee 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -47,24 +46,27 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - location - Resource location. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - DeletedAccountsClientGetOptions contains the optional parameters for the DeletedAccountsClient.Get method. func (client *DeletedAccountsClient) Get(ctx context.Context, location string, resourceGroupName string, accountName string, options *DeletedAccountsClientGetOptions) (DeletedAccountsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, location, resourceGroupName, accountName, options) if err != nil { return DeletedAccountsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeletedAccountsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeletedAccountsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeletedAccountsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -91,7 +93,7 @@ func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,7 +110,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - options - DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.NewListPager // method. func (client *DeletedAccountsClient) NewListPager(options *DeletedAccountsClientListOptions) *runtime.Pager[DeletedAccountsClientListResponse] { @@ -151,7 +153,7 @@ func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -169,7 +171,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - location - Resource location. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. @@ -181,7 +183,8 @@ func (client *DeletedAccountsClient) BeginPurge(ctx context.Context, location st if err != nil { return nil, err } - return runtime.NewPoller[DeletedAccountsClientPurgeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DeletedAccountsClientPurgeResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DeletedAccountsClientPurgeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -190,20 +193,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *DeletedAccountsClient) purge(ctx context.Context, location string, resourceGroupName string, accountName string, options *DeletedAccountsClientBeginPurgeOptions) (*http.Response, error) { + var err error req, err := client.purgeCreateRequest(ctx, location, resourceGroupName, accountName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // purgeCreateRequest creates the Purge request. @@ -230,7 +235,7 @@ func (client *DeletedAccountsClient) purgeCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") 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 deleted file mode 100644 index 35c9a5c0fc40..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client_example_test.go +++ /dev/null @@ -1,169 +0,0 @@ -//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/GetDeletedAccount.json -func ExampleDeletedAccountsClient_Get() { - 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) - } - res, err := clientFactory.NewDeletedAccountsClient().Get(ctx, "westus", "myResourceGroup", "myAccount", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Account = armcognitiveservices.Account{ - // Name: to.Ptr("myAccount"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.CognitiveServices/locations/westus/resourceGroups/myResourceGroup/deletedAccounts/myAccount"), - // Etag: to.Ptr("W/\"datetime'2017-04-10T04%3A42%3A19.7067387Z'\""), - // Kind: to.Ptr("Emotion"), - // Location: to.Ptr("westus"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/emotion/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("F0"), - // }, - // Tags: map[string]*string{ - // "ExpiredDate": to.Ptr("2017/09/01"), - // "Owner": to.Ptr("felixwa"), - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewDeletedAccountsClient().BeginPurge(ctx, "westus", "myResourceGroup", "PropTest01", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// 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 { - 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.NewDeletedAccountsClient().NewListPager(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.AccountListResult = armcognitiveservices.AccountListResult{ - // Value: []*armcognitiveservices.Account{ - // { - // Name: to.Ptr("bingSearch"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/bingSearch"), - // Etag: to.Ptr("W/\"datetime'2017-03-27T11%3A19%3A08.762494Z'\""), - // Kind: to.Ptr("Bing.Search"), - // Location: to.Ptr("global"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://api.cognitive.microsoft.com/bing/v5.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S1"), - // }, - // }, - // { - // Name: to.Ptr("CrisProd"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/CrisProd"), - // Etag: to.Ptr("W/\"datetime'2017-03-31T08%3A57%3A07.4499566Z'\""), - // Kind: to.Ptr("CRIS"), - // Location: to.Ptr("westus"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/sts/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // Tags: map[string]*string{ - // "can't delete it successfully": to.Ptr("v-yunjin"), - // }, - // }, - // { - // Name: to.Ptr("rayrptest0308"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/rayrptest0308"), - // Etag: to.Ptr("W/\"datetime'2017-03-27T11%3A15%3A23.5232645Z'\""), - // Kind: to.Ptr("Face"), - // Location: to.Ptr("westus"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/face/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // }, - // { - // Name: to.Ptr("raytest02"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/bvttest/providers/Microsoft.CognitiveServices/accounts/raytest02"), - // Etag: to.Ptr("W/\"datetime'2017-04-04T02%3A07%3A07.3957572Z'\""), - // Kind: to.Ptr("Emotion"), - // Location: to.Ptr("westus"), - // Properties: &armcognitiveservices.AccountProperties{ - // Endpoint: to.Ptr("https://westus.api.cognitive.microsoft.com/emotion/v1.0"), - // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), - // }, - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("S0"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go index ea6df40a7bc0..fbc35bb83fab 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -47,7 +46,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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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,9 +59,10 @@ func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DeploymentsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, deploymentName, deployment, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -111,16 +113,19 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, deployment) + if err := runtime.MarshalAsJSON(req, deployment); err != nil { + return nil, err + } + return req, nil } // 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 @@ -131,7 +136,8 @@ func (client *DeploymentsClient) BeginDelete(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller[DeploymentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DeploymentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DeploymentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -140,20 +146,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *DeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, deploymentName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -180,7 +188,7 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,24 +197,27 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 // - options - DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. func (client *DeploymentsClient) Get(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *DeploymentsClientGetOptions) (DeploymentsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, deploymentName, options) if err != nil { return DeploymentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeploymentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeploymentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -233,7 +244,7 @@ func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,7 +261,7 @@ func (client *DeploymentsClient) getHandleResponse(resp *http.Response) (Deploym // NewListPager - Gets the deployments associated with the Cognitive Services account. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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. @@ -302,7 +313,7 @@ func (client *DeploymentsClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -316,3 +327,156 @@ func (client *DeploymentsClient) listHandleResponse(resp *http.Response) (Deploy } return result, nil } + +// NewListSKUsPager - Lists the specified deployments skus associated with the Cognitive Services account. +// +// Generated from API version 2023-10-01-preview +// - 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 +// - options - DeploymentsClientListSKUsOptions contains the optional parameters for the DeploymentsClient.NewListSKUsPager +// method. +func (client *DeploymentsClient) NewListSKUsPager(resourceGroupName string, accountName string, deploymentName string, options *DeploymentsClientListSKUsOptions) *runtime.Pager[DeploymentsClientListSKUsResponse] { + return runtime.NewPager(runtime.PagingHandler[DeploymentsClientListSKUsResponse]{ + More: func(page DeploymentsClientListSKUsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeploymentsClientListSKUsResponse) (DeploymentsClientListSKUsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listSKUsCreateRequest(ctx, resourceGroupName, accountName, deploymentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DeploymentsClientListSKUsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentsClientListSKUsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeploymentsClientListSKUsResponse{}, runtime.NewResponseError(resp) + } + return client.listSKUsHandleResponse(resp) + }, + }) +} + +// listSKUsCreateRequest creates the ListSKUs request. +func (client *DeploymentsClient) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *DeploymentsClientListSKUsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}/skus" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSKUsHandleResponse handles the ListSKUs response. +func (client *DeploymentsClient) listSKUsHandleResponse(resp *http.Response) (DeploymentsClientListSKUsResponse, error) { + result := DeploymentsClientListSKUsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentSKUListResult); err != nil { + return DeploymentsClientListSKUsResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update specified deployments associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - 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 +// - deployment - The deployment properties. +// - options - DeploymentsClientBeginUpdateOptions contains the optional parameters for the DeploymentsClient.BeginUpdate method. +func (client *DeploymentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment PatchResourceTagsAndSKU, options *DeploymentsClientBeginUpdateOptions) (*runtime.Poller[DeploymentsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, deploymentName, deployment, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DeploymentsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DeploymentsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - Update specified deployments associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *DeploymentsClient) update(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment PatchResourceTagsAndSKU, options *DeploymentsClientBeginUpdateOptions) (*http.Response, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, deploymentName, deployment, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *DeploymentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment PatchResourceTagsAndSKU, options *DeploymentsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, deployment); err != nil { + return nil, err + } + 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 deleted file mode 100644 index a21b28844be9..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client_example_test.go +++ /dev/null @@ -1,175 +0,0 @@ -//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/azcore/to" - "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/ListDeployments.json -func ExampleDeploymentsClient_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.NewDeploymentsClient().NewListPager("resourceGroupName", "accountName", 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.DeploymentListResult = armcognitiveservices.DeploymentListResult{ - // Value: []*armcognitiveservices.Deployment{ - // { - // Name: to.Ptr("deploymentName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/deployments"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments/deploymentName"), - // Properties: &armcognitiveservices.DeploymentProperties{ - // Model: &armcognitiveservices.DeploymentModel{ - // Name: to.Ptr("ada"), - // Format: to.Ptr("OpenAI"), - // Version: to.Ptr("1"), - // }, - // ProvisioningState: to.Ptr(armcognitiveservices.DeploymentProvisioningStateSucceeded), - // ScaleSettings: &armcognitiveservices.DeploymentScaleSettings{ - // Capacity: to.Ptr[int32](1), - // ScaleType: to.Ptr(armcognitiveservices.DeploymentScaleTypeManual), - // }, - // }, - // }}, - // } - } -} - -// 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 { - 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) - } - res, err := clientFactory.NewDeploymentsClient().Get(ctx, "resourceGroupName", "accountName", "deploymentName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Deployment = armcognitiveservices.Deployment{ - // Name: to.Ptr("deploymentName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/deployments"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments/deploymentName"), - // Properties: &armcognitiveservices.DeploymentProperties{ - // Model: &armcognitiveservices.DeploymentModel{ - // Name: to.Ptr("ada"), - // Format: to.Ptr("OpenAI"), - // Version: to.Ptr("1"), - // }, - // ProvisioningState: to.Ptr(armcognitiveservices.DeploymentProvisioningStateSucceeded), - // ScaleSettings: &armcognitiveservices.DeploymentScaleSettings{ - // Capacity: to.Ptr[int32](1), - // ScaleType: to.Ptr(armcognitiveservices.DeploymentScaleTypeManual), - // }, - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewDeploymentsClient().BeginCreateOrUpdate(ctx, "resourceGroupName", "accountName", "deploymentName", armcognitiveservices.Deployment{ - Properties: &armcognitiveservices.DeploymentProperties{ - Model: &armcognitiveservices.DeploymentModel{ - Name: to.Ptr("ada"), - Format: to.Ptr("OpenAI"), - Version: to.Ptr("1"), - }, - }, - SKU: &armcognitiveservices.SKU{ - Name: to.Ptr("Standard"), - Capacity: to.Ptr[int32](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Deployment = armcognitiveservices.Deployment{ - // Name: to.Ptr("deploymentName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/deployments"), - // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments/deploymentName"), - // Properties: &armcognitiveservices.DeploymentProperties{ - // Model: &armcognitiveservices.DeploymentModel{ - // Name: to.Ptr("ada"), - // Format: to.Ptr("OpenAI"), - // Version: to.Ptr("1"), - // }, - // ProvisioningState: to.Ptr(armcognitiveservices.DeploymentProvisioningStateSucceeded), - // }, - // 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/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 { - 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) - } - poller, err := clientFactory.NewDeploymentsClient().BeginDelete(ctx, "resourceGroupName", "accountName", "deploymentName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client.go new file mode 100644 index 000000000000..1810757bd7f9 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client.go @@ -0,0 +1,322 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// EncryptionScopesClient contains the methods for the EncryptionScopes group. +// Don't use this type directly, use NewEncryptionScopesClient() instead. +type EncryptionScopesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEncryptionScopesClient creates a new instance of EncryptionScopesClient 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 NewEncryptionScopesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EncryptionScopesClient, error) { + cl, err := arm.NewClient(moduleName+".EncryptionScopesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EncryptionScopesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Update the state of specified encryptionScope associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - encryptionScopeName - The name of the encryptionScope associated with the Cognitive Services Account +// - encryptionScope - The encryptionScope properties. +// - options - EncryptionScopesClientCreateOrUpdateOptions contains the optional parameters for the EncryptionScopesClient.CreateOrUpdate +// method. +func (client *EncryptionScopesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientCreateOrUpdateOptions) (EncryptionScopesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, encryptionScope, options) + if err != nil { + return EncryptionScopesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EncryptionScopesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return EncryptionScopesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *EncryptionScopesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if encryptionScopeName == "" { + return nil, errors.New("parameter encryptionScopeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionScopeName}", url.PathEscape(encryptionScopeName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, encryptionScope); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *EncryptionScopesClient) createOrUpdateHandleResponse(resp *http.Response) (EncryptionScopesClientCreateOrUpdateResponse, error) { + result := EncryptionScopesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScope); err != nil { + return EncryptionScopesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes the specified encryptionScope associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - encryptionScopeName - The name of the encryptionScope associated with the Cognitive Services Account +// - options - EncryptionScopesClientBeginDeleteOptions contains the optional parameters for the EncryptionScopesClient.BeginDelete +// method. +func (client *EncryptionScopesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientBeginDeleteOptions) (*runtime.Poller[EncryptionScopesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, encryptionScopeName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller[EncryptionScopesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[EncryptionScopesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified encryptionScope associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *EncryptionScopesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EncryptionScopesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if encryptionScopeName == "" { + return nil, errors.New("parameter encryptionScopeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionScopeName}", url.PathEscape(encryptionScopeName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified EncryptionScope associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - encryptionScopeName - The name of the encryptionScope associated with the Cognitive Services Account +// - options - EncryptionScopesClientGetOptions contains the optional parameters for the EncryptionScopesClient.Get method. +func (client *EncryptionScopesClient) Get(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientGetOptions) (EncryptionScopesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, options) + if err != nil { + return EncryptionScopesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EncryptionScopesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EncryptionScopesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EncryptionScopesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if encryptionScopeName == "" { + return nil, errors.New("parameter encryptionScopeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{encryptionScopeName}", url.PathEscape(encryptionScopeName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *EncryptionScopesClient) getHandleResponse(resp *http.Response) (EncryptionScopesClientGetResponse, error) { + result := EncryptionScopesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScope); err != nil { + return EncryptionScopesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the content filters associated with the Azure OpenAI account. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - options - EncryptionScopesClientListOptions contains the optional parameters for the EncryptionScopesClient.NewListPager +// method. +func (client *EncryptionScopesClient) NewListPager(resourceGroupName string, accountName string, options *EncryptionScopesClientListOptions) *runtime.Pager[EncryptionScopesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[EncryptionScopesClientListResponse]{ + More: func(page EncryptionScopesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EncryptionScopesClientListResponse) (EncryptionScopesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return EncryptionScopesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EncryptionScopesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EncryptionScopesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *EncryptionScopesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *EncryptionScopesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *EncryptionScopesClient) listHandleResponse(resp *http.Response) (EncryptionScopesClientListResponse, error) { + result := EncryptionScopesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScopeListResult); err != nil { + return EncryptionScopesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod index 2dca3544cf48..84593c1f3196 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod @@ -2,20 +2,12 @@ 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.6.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( 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.7.0 // indirect + github.com/davecgh/go-spew v1.1.1 // 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 + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum index 21718b486698..727ce838bdc8 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum @@ -1,31 +1,15 @@ -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/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= 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.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= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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.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.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/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go index ad71b8889c3f..1fd3140ad4db 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -47,23 +46,26 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - parameters - Check Domain Availability parameter. // - options - ManagementClientCheckDomainAvailabilityOptions contains the optional parameters for the ManagementClient.CheckDomainAvailability // method. func (client *ManagementClient) CheckDomainAvailability(ctx context.Context, parameters CheckDomainAvailabilityParameter, options *ManagementClientCheckDomainAvailabilityOptions) (ManagementClientCheckDomainAvailabilityResponse, error) { + var err error req, err := client.checkDomainAvailabilityCreateRequest(ctx, parameters, options) if err != nil { return ManagementClientCheckDomainAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagementClientCheckDomainAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientCheckDomainAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementClientCheckDomainAvailabilityResponse{}, err } - return client.checkDomainAvailabilityHandleResponse(resp) + resp, err := client.checkDomainAvailabilityHandleResponse(httpResp) + return resp, err } // checkDomainAvailabilityCreateRequest creates the CheckDomainAvailability request. @@ -78,10 +80,13 @@ func (client *ManagementClient) checkDomainAvailabilityCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // checkDomainAvailabilityHandleResponse handles the CheckDomainAvailability response. @@ -96,24 +101,27 @@ func (client *ManagementClient) checkDomainAvailabilityHandleResponse(resp *http // CheckSKUAvailability - Check available SKUs. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - location - Resource location. // - parameters - Check SKU Availability POST body. // - options - ManagementClientCheckSKUAvailabilityOptions contains the optional parameters for the ManagementClient.CheckSKUAvailability // method. func (client *ManagementClient) CheckSKUAvailability(ctx context.Context, location string, parameters CheckSKUAvailabilityParameter, options *ManagementClientCheckSKUAvailabilityOptions) (ManagementClientCheckSKUAvailabilityResponse, error) { + var err error req, err := client.checkSKUAvailabilityCreateRequest(ctx, location, parameters, options) if err != nil { return ManagementClientCheckSKUAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagementClientCheckSKUAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientCheckSKUAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementClientCheckSKUAvailabilityResponse{}, err } - return client.checkSKUAvailabilityHandleResponse(resp) + resp, err := client.checkSKUAvailabilityHandleResponse(httpResp) + return resp, err } // checkSKUAvailabilityCreateRequest creates the CheckSKUAvailability request. @@ -132,10 +140,13 @@ func (client *ManagementClient) checkSKUAvailabilityCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // checkSKUAvailabilityHandleResponse handles the CheckSKUAvailability response. diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client_example_test.go deleted file mode 100644 index 31a6490a5fd7..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client_example_test.go +++ /dev/null @@ -1,82 +0,0 @@ -//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/azcore/to" - "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/CheckSkuAvailability.json -func ExampleManagementClient_CheckSKUAvailability() { - 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) - } - res, err := clientFactory.NewManagementClient().CheckSKUAvailability(ctx, "westus", armcognitiveservices.CheckSKUAvailabilityParameter{ - Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - Kind: to.Ptr("Face"), - SKUs: []*string{ - to.Ptr("S0")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SKUAvailabilityListResult = armcognitiveservices.SKUAvailabilityListResult{ - // Value: []*armcognitiveservices.SKUAvailability{ - // { - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // Kind: to.Ptr("Face"), - // SKUAvailable: to.Ptr(true), - // SKUName: to.Ptr("S0"), - // }}, - // } -} - -// 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 { - 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) - } - res, err := clientFactory.NewManagementClient().CheckDomainAvailability(ctx, armcognitiveservices.CheckDomainAvailabilityParameter{ - Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - SubdomainName: to.Ptr("contosodemoapp1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DomainAvailability = armcognitiveservices.DomainAvailability{ - // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), - // IsSubdomainAvailable: to.Ptr(false), - // Reason: to.Ptr("Sub domain name 'contosodemoapp1' is not valid"), - // SubdomainName: to.Ptr("contosodemoapp1"), - // } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go index 339e26625bf4..4a38fac6981b 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -176,6 +175,9 @@ type AccountProperties struct { APIProperties *APIProperties AllowedFqdnList []*string + // The user owned AML workspace properties. + AmlWorkspace *UserOwnedAmlWorkspace + // Optional subdomain name used for token-based authentication. CustomSubDomainName *string DisableLocalAuth *bool @@ -265,67 +267,6 @@ type AccountSKUListResult struct { Value []*AccountSKU } -// AccountsClientBeginCreateOptions contains the optional parameters for the AccountsClient.BeginCreate method. -type AccountsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. -type AccountsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AccountsClientBeginUpdateOptions contains the optional parameters for the AccountsClient.BeginUpdate method. -type AccountsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. -type AccountsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager -// method. -type AccountsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// AccountsClientListKeysOptions contains the optional parameters for the AccountsClient.ListKeys method. -type AccountsClientListKeysOptions struct { - // placeholder for future optional parameters -} - -// AccountsClientListModelsOptions contains the optional parameters for the AccountsClient.NewListModelsPager method. -type AccountsClientListModelsOptions struct { - // placeholder for future optional parameters -} - -// AccountsClientListOptions contains the optional parameters for the AccountsClient.NewListPager method. -type AccountsClientListOptions struct { - // placeholder for future optional parameters -} - -// AccountsClientListSKUsOptions contains the optional parameters for the AccountsClient.ListSKUs method. -type AccountsClientListSKUsOptions struct { - // placeholder for future optional parameters -} - -// AccountsClientListUsagesOptions contains the optional parameters for the AccountsClient.ListUsages method. -type AccountsClientListUsagesOptions 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 -} - -// AccountsClientRegenerateKeyOptions contains the optional parameters for the AccountsClient.RegenerateKey method. -type AccountsClientRegenerateKeyOptions struct { - // placeholder for future optional parameters -} - // AzureEntityResource - The resource model definition for an Azure Resource Manager resource with an etag. type AzureEntityResource struct { // READ-ONLY; Resource Etag. @@ -353,6 +294,9 @@ type CallRateLimit struct { // CapacityConfig - The capacity configuration. type CapacityConfig struct { + // The array of allowed values for capacity. + AllowedValues []*int32 + // The default capacity. Default *int32 @@ -455,6 +399,9 @@ type CommitmentPlanAccountAssociation struct { // Properties of Cognitive Services account commitment plan association. Properties *CommitmentPlanAccountAssociationProperties + // Resource tags. + Tags map[string]*string + // READ-ONLY; Resource Etag. Etag *string @@ -535,92 +482,6 @@ type CommitmentPlanProperties struct { ProvisioningState *CommitmentPlanProvisioningState } -// CommitmentPlansClientBeginCreateOrUpdateAssociationOptions contains the optional parameters for the CommitmentPlansClient.BeginCreateOrUpdateAssociation -// method. -type CommitmentPlansClientBeginCreateOrUpdateAssociationOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CommitmentPlansClientBeginCreateOrUpdatePlanOptions contains the optional parameters for the CommitmentPlansClient.BeginCreateOrUpdatePlan -// method. -type CommitmentPlansClientBeginCreateOrUpdatePlanOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CommitmentPlansClientBeginDeleteAssociationOptions contains the optional parameters for the CommitmentPlansClient.BeginDeleteAssociation -// method. -type CommitmentPlansClientBeginDeleteAssociationOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CommitmentPlansClientBeginDeleteOptions contains the optional parameters for the CommitmentPlansClient.BeginDelete method. -type CommitmentPlansClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CommitmentPlansClientBeginDeletePlanOptions contains the optional parameters for the CommitmentPlansClient.BeginDeletePlan -// method. -type CommitmentPlansClientBeginDeletePlanOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CommitmentPlansClientBeginUpdatePlanOptions contains the optional parameters for the CommitmentPlansClient.BeginUpdatePlan -// method. -type CommitmentPlansClientBeginUpdatePlanOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CommitmentPlansClientCreateOrUpdateOptions contains the optional parameters for the CommitmentPlansClient.CreateOrUpdate -// method. -type CommitmentPlansClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// CommitmentPlansClientGetAssociationOptions contains the optional parameters for the CommitmentPlansClient.GetAssociation -// method. -type CommitmentPlansClientGetAssociationOptions struct { - // placeholder for future optional parameters -} - -// CommitmentPlansClientGetOptions contains the optional parameters for the CommitmentPlansClient.Get method. -type CommitmentPlansClientGetOptions struct { - // placeholder for future optional parameters -} - -// CommitmentPlansClientGetPlanOptions contains the optional parameters for the CommitmentPlansClient.GetPlan method. -type CommitmentPlansClientGetPlanOptions struct { - // placeholder for future optional parameters -} - -// CommitmentPlansClientListAssociationsOptions contains the optional parameters for the CommitmentPlansClient.NewListAssociationsPager -// method. -type CommitmentPlansClientListAssociationsOptions struct { - // placeholder for future optional parameters -} - -// CommitmentPlansClientListOptions contains the optional parameters for the CommitmentPlansClient.NewListPager method. -type CommitmentPlansClientListOptions struct { - // placeholder for future optional parameters -} - -// CommitmentPlansClientListPlansByResourceGroupOptions contains the optional parameters for the CommitmentPlansClient.NewListPlansByResourceGroupPager -// method. -type CommitmentPlansClientListPlansByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// CommitmentPlansClientListPlansBySubscriptionOptions contains the optional parameters for the CommitmentPlansClient.NewListPlansBySubscriptionPager -// method. -type CommitmentPlansClientListPlansBySubscriptionOptions struct { - // placeholder for future optional parameters -} - // CommitmentQuota - Cognitive Services account commitment quota. type CommitmentQuota struct { // Commitment quota quantity. @@ -666,27 +527,6 @@ type CommitmentTierListResult struct { Value []*CommitmentTier } -// CommitmentTiersClientListOptions contains the optional parameters for the CommitmentTiersClient.NewListPager method. -type CommitmentTiersClientListOptions struct { - // placeholder for future optional parameters -} - -// DeletedAccountsClientBeginPurgeOptions contains the optional parameters for the DeletedAccountsClient.BeginPurge method. -type DeletedAccountsClientBeginPurgeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeletedAccountsClientGetOptions contains the optional parameters for the DeletedAccountsClient.Get method. -type DeletedAccountsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.NewListPager method. -type DeletedAccountsClientListOptions struct { - // placeholder for future optional parameters -} - // Deployment - Cognitive Services account deployment. type Deployment struct { // Properties of Cognitive Services account deployment. @@ -695,6 +535,9 @@ type Deployment struct { // The resource model definition representing SKU SKU *SKU + // Resource tags. + Tags map[string]*string + // READ-ONLY; Resource Etag. Etag *string @@ -711,6 +554,15 @@ type Deployment struct { Type *string } +// DeploymentCapacitySettings - Internal use only. +type DeploymentCapacitySettings struct { + // The designated capacity. + DesignatedCapacity *int32 + + // The priority of this capacity setting. + Priority *int32 +} + // DeploymentListResult - The list of cognitive services accounts operation response. type DeploymentListResult struct { // The link used to get the next page of Deployment. @@ -742,13 +594,19 @@ type DeploymentModel struct { // DeploymentProperties - Properties of Cognitive Services account deployment. type DeploymentProperties struct { + // Internal use only. + CapacitySettings *DeploymentCapacitySettings + + // The current capacity. + CurrentCapacity *int32 + // Properties of Cognitive Services account deployment model. Model *DeploymentModel // The name of RAI policy. RaiPolicyName *string - // Properties of Cognitive Services account deployment model. + // Properties of Cognitive Services account deployment model. (Deprecated, please use Deployment.sku instead.) ScaleSettings *DeploymentScaleSettings // Deployment model version upgrade option. @@ -760,6 +618,9 @@ type DeploymentProperties struct { // READ-ONLY; The capabilities. Capabilities map[string]*string + // READ-ONLY; If the dynamic throttling is enabled. + DynamicThrottlingEnabled *bool + // READ-ONLY; Gets the status of the resource at the time the operation was called. ProvisioningState *DeploymentProvisioningState @@ -767,7 +628,17 @@ type DeploymentProperties struct { RateLimits []*ThrottlingRule } -// DeploymentScaleSettings - Properties of Cognitive Services account deployment model. +// DeploymentSKUListResult - The list of cognitive services accounts operation response. +type DeploymentSKUListResult struct { + // The link used to get the next page of deployment skus. + NextLink *string + + // READ-ONLY; Gets the list of Cognitive Services accounts deployment skus. + Value []*SKUResource +} + +// DeploymentScaleSettings - Properties of Cognitive Services account deployment model. (Deprecated, please use Deployment.sku +// instead.) type DeploymentScaleSettings struct { // Deployment capacity. Capacity *int32 @@ -779,29 +650,6 @@ type DeploymentScaleSettings struct { ActiveCapacity *int32 } -// DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate -// method. -type DeploymentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. -type DeploymentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. -type DeploymentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DeploymentsClientListOptions contains the optional parameters for the DeploymentsClient.NewListPager method. -type DeploymentsClientListOptions struct { - // placeholder for future optional parameters -} - // DomainAvailability - Domain availability. type DomainAvailability struct { // Indicates the given SKU is available or not. @@ -829,6 +677,54 @@ type Encryption struct { KeyVaultProperties *KeyVaultProperties } +// EncryptionScope - Cognitive Services EncryptionScope +type EncryptionScope struct { + // Properties of Cognitive Services EncryptionScope. + Properties *EncryptionScopeProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource Etag. + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// EncryptionScopeListResult - The list of cognitive services EncryptionScopes. +type EncryptionScopeListResult struct { + // The link used to get the next page of EncryptionScope. + NextLink *string + + // The list of EncryptionScope. + Value []*EncryptionScope +} + +// EncryptionScopeProperties - Properties to EncryptionScope +type EncryptionScopeProperties struct { + // Enumerates the possible value of keySource for Encryption + KeySource *KeySource + + // Properties of KeyVault + KeyVaultProperties *KeyVaultProperties + + // The encryptionScope state. + State *EncryptionScopeState + + // READ-ONLY; Gets the status of the resource at the time the operation was called. + ProvisioningState *EncryptionScopeProvisioningState +} + // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -901,18 +797,6 @@ type KeyVaultProperties struct { KeyVersion *string } -// ManagementClientCheckDomainAvailabilityOptions contains the optional parameters for the ManagementClient.CheckDomainAvailability -// method. -type ManagementClientCheckDomainAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// ManagementClientCheckSKUAvailabilityOptions contains the optional parameters for the ManagementClient.CheckSKUAvailability -// method. -type ManagementClientCheckSKUAvailabilityOptions struct { - // placeholder for future optional parameters -} - // MetricName - A metric name. type MetricName struct { // The friendly name of the metric. @@ -970,11 +854,6 @@ type ModelSKU struct { 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 @@ -985,6 +864,9 @@ type MultiRegionSettings struct { // NetworkRuleSet - A set of rules governing the network accessibility. type NetworkRuleSet struct { + // Setting for trusted services. + Bypass *ByPassSelection + // The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property // has been evaluated. DefaultAction *NetworkRuleAction @@ -1045,11 +927,6 @@ type OperationListResult struct { Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // PatchResourceTags - The object being used to update tags of a resource, in general used for PATCH operations. type PatchResourceTags struct { // Resource tags. @@ -1116,32 +993,6 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *PrivateEndpointConnectionProvisioningState } -// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. -type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List -// method. -type PrivateEndpointConnectionsClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkResource - A private link resource type PrivateLinkResource struct { // Resource properties. @@ -1178,11 +1029,6 @@ type PrivateLinkResourceProperties struct { RequiredMembers []*string } -// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List method. -type PrivateLinkResourcesClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer // and provider. type PrivateLinkServiceConnectionState struct { @@ -1215,6 +1061,189 @@ type QuotaLimit struct { Rules []*ThrottlingRule } +// RaiBlockListItemsResult - The list of cognitive services RAI Blocklist Items. +type RaiBlockListItemsResult struct { + // The link used to get the next page of RaiBlocklistItems. + NextLink *string + + // The list of RaiBlocklistItems. + Value []*RaiBlocklistItem +} + +// RaiBlockListResult - The list of cognitive services RAI Blocklists. +type RaiBlockListResult struct { + // The link used to get the next page of RaiBlocklists. + NextLink *string + + // The list of RaiBlocklist. + Value []*RaiBlocklist +} + +// RaiBlocklist - Cognitive Services RaiBlocklist. +type RaiBlocklist struct { + // Properties of Cognitive Services RaiBlocklist. + Properties *RaiBlocklistProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource Etag. + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// RaiBlocklistConfig - Azure OpenAI blocklist config. +type RaiBlocklistConfig struct { + // If blocking would occur. + Blocking *bool + + // Name of ContentFilter. + BlocklistName *string +} + +// RaiBlocklistItem - Cognitive Services RaiBlocklist Item. +type RaiBlocklistItem struct { + // Properties of Cognitive Services RaiBlocklist Item. + Properties *RaiBlocklistItemProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource Etag. + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// RaiBlocklistItemProperties - RAI Custom Blocklist Item properties. +type RaiBlocklistItemProperties struct { + // If the pattern is a regex pattern. + IsRegex *bool + + // Pattern to match against. + Pattern *string +} + +// RaiBlocklistProperties - RAI Custom Blocklist properties. +type RaiBlocklistProperties struct { + // Description of the block list. + Description *string +} + +// RaiContentFilter - Azure OpenAI Content Filter. +type RaiContentFilter struct { + // Description of Content Filter. + Description *string + + // Content Filter type. + FilterType *RaiContentFilterType + + // Name of Content Filter. + PolicyName *string +} + +// RaiContentFilterListResult - The list of Content Filters. +type RaiContentFilterListResult struct { + // The link used to get the next page of Content Filters. + NextLink *string + + // The list of RaiContentFilter. + Value []*RaiContentFilter +} + +// RaiPolicy - Cognitive Services RaiPolicy. +type RaiPolicy struct { + // Properties of Cognitive Services RaiPolicy. + Properties *RaiPolicyProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Resource Etag. + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// RaiPolicyContentFilter - Azure OpenAI Content Filter. +type RaiPolicyContentFilter struct { + // Level at which content is filtered. + AllowedContentLevel *AllowedContentLevel + + // If blocking would occur. + Blocking *bool + + // If the ContentFilter is enabled. + Enabled *bool + + // Name of ContentFilter. + PolicyName *string + + // Content source to apply the Content Filters. + Source *RaiPolicyContentSource +} + +// RaiPolicyListResult - The list of cognitive services RaiPolicies. +type RaiPolicyListResult struct { + // The link used to get the next page of RaiPolicy. + NextLink *string + + // The list of RaiPolicy. + Value []*RaiPolicy +} + +// RaiPolicyProperties - Azure OpenAI Content Filters properties. +type RaiPolicyProperties struct { + // Name of the base Content Filters. + BasePolicyName *string + + // The list of blocklists for completion. + CompletionBlocklists []*RaiBlocklistConfig + + // The list of Content Filters. + ContentFilters []*RaiPolicyContentFilter + + // Content Filters mode. + Mode *RaiPolicyMode + + // The list of blocklists for prompt. + PromptBlocklists []*RaiBlocklistConfig + + // READ-ONLY; Content Filters policy type. + PolicyType *RaiPolicyType +} + // RegenerateKeyParameters - Regenerate key parameters. type RegenerateKeyParameters struct { // REQUIRED; key name to generate (Key1|Key2) @@ -1304,11 +1333,6 @@ type ResourceSKURestrictions struct { Values []*string } -// ResourceSKUsClientListOptions contains the optional parameters for the ResourceSKUsClient.NewListPager method. -type ResourceSKUsClientListOptions struct { - // placeholder for future optional parameters -} - // SKU - The resource model definition representing SKU type SKU struct { // REQUIRED; The name of the SKU. Ex - P3. It is typically a letter+number code @@ -1377,6 +1401,18 @@ type SKUChangeInfo struct { LastChangeDate *string } +// SKUResource - Properties of Cognitive Services account resource sku resource properties. +type SKUResource struct { + // The capacity configuration. + Capacity *CapacityConfig + + // The resource type name. + ResourceType *string + + // The resource model definition representing SKU + SKU *SKU +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -1440,13 +1476,6 @@ type UsageListResult struct { 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. @@ -1456,6 +1485,15 @@ type UserAssignedIdentity struct { PrincipalID *string } +// UserOwnedAmlWorkspace - The user owned AML workspace for Cognitive Services account. +type UserOwnedAmlWorkspace struct { + // Identity Client id of a AML workspace resource. + IdentityClientID *string + + // Full resource id of a AML workspace resource. + ResourceID *string +} + // UserOwnedStorage - The user owned storage for Cognitive Services account. type UserOwnedStorage struct { IdentityClientID *string diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go index 8c4744377039..d28863ff9c01 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -46,7 +45,7 @@ func NewModelsClient(subscriptionID string, credential azcore.TokenCredential, o // NewListPager - List Models. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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] { @@ -93,7 +92,7 @@ func (client *ModelsClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client_example_test.go deleted file mode 100644 index c055fce95e7a..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client_example_test.go +++ /dev/null @@ -1,94 +0,0 @@ -//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 81f1baeea28c..66b7499d5898 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -374,6 +373,7 @@ func (a AccountProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "apiProperties", a.APIProperties) populate(objectMap, "abusePenalty", a.AbusePenalty) populate(objectMap, "allowedFqdnList", a.AllowedFqdnList) + populate(objectMap, "amlWorkspace", a.AmlWorkspace) populate(objectMap, "callRateLimit", a.CallRateLimit) populate(objectMap, "capabilities", a.Capabilities) populate(objectMap, "commitmentPlanAssociations", a.CommitmentPlanAssociations) @@ -420,6 +420,9 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { case "allowedFqdnList": err = unpopulate(val, "AllowedFqdnList", &a.AllowedFqdnList) delete(rawMsg, key) + case "amlWorkspace": + err = unpopulate(val, "AmlWorkspace", &a.AmlWorkspace) + delete(rawMsg, key) case "callRateLimit": err = unpopulate(val, "CallRateLimit", &a.CallRateLimit) delete(rawMsg, key) @@ -638,6 +641,7 @@ func (c *CallRateLimit) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CapacityConfig. func (c CapacityConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "allowedValues", c.AllowedValues) populate(objectMap, "default", c.Default) populate(objectMap, "maximum", c.Maximum) populate(objectMap, "minimum", c.Minimum) @@ -654,6 +658,9 @@ func (c *CapacityConfig) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "allowedValues": + err = unpopulate(val, "AllowedValues", &c.AllowedValues) + delete(rawMsg, key) case "default": err = unpopulate(val, "Default", &c.Default) delete(rawMsg, key) @@ -889,6 +896,7 @@ func (c CommitmentPlanAccountAssociation) MarshalJSON() ([]byte, error) { populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } @@ -917,6 +925,9 @@ func (c *CommitmentPlanAccountAssociation) UnmarshalJSON(data []byte) error { case "systemData": err = unpopulate(val, "SystemData", &c.SystemData) delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) @@ -1233,6 +1244,7 @@ func (d Deployment) MarshalJSON() ([]byte, error) { populate(objectMap, "properties", d.Properties) populate(objectMap, "sku", d.SKU) populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } @@ -1264,6 +1276,9 @@ func (d *Deployment) UnmarshalJSON(data []byte) error { case "systemData": err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -1275,6 +1290,37 @@ func (d *Deployment) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DeploymentCapacitySettings. +func (d DeploymentCapacitySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "designatedCapacity", d.DesignatedCapacity) + populate(objectMap, "priority", d.Priority) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentCapacitySettings. +func (d *DeploymentCapacitySettings) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "designatedCapacity": + err = unpopulate(val, "DesignatedCapacity", &d.DesignatedCapacity) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &d.Priority) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DeploymentListResult. func (d DeploymentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1354,6 +1400,9 @@ func (d DeploymentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "callRateLimit", d.CallRateLimit) populate(objectMap, "capabilities", d.Capabilities) + populate(objectMap, "capacitySettings", d.CapacitySettings) + populate(objectMap, "currentCapacity", d.CurrentCapacity) + populate(objectMap, "dynamicThrottlingEnabled", d.DynamicThrottlingEnabled) populate(objectMap, "model", d.Model) populate(objectMap, "provisioningState", d.ProvisioningState) populate(objectMap, "raiPolicyName", d.RaiPolicyName) @@ -1378,6 +1427,15 @@ func (d *DeploymentProperties) UnmarshalJSON(data []byte) error { case "capabilities": err = unpopulate(val, "Capabilities", &d.Capabilities) delete(rawMsg, key) + case "capacitySettings": + err = unpopulate(val, "CapacitySettings", &d.CapacitySettings) + delete(rawMsg, key) + case "currentCapacity": + err = unpopulate(val, "CurrentCapacity", &d.CurrentCapacity) + delete(rawMsg, key) + case "dynamicThrottlingEnabled": + err = unpopulate(val, "DynamicThrottlingEnabled", &d.DynamicThrottlingEnabled) + delete(rawMsg, key) case "model": err = unpopulate(val, "Model", &d.Model) delete(rawMsg, key) @@ -1404,6 +1462,37 @@ func (d *DeploymentProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DeploymentSKUListResult. +func (d DeploymentSKUListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentSKUListResult. +func (d *DeploymentSKUListResult) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DeploymentScaleSettings. func (d DeploymentScaleSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1513,6 +1602,127 @@ func (e *Encryption) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EncryptionScope. +func (e EncryptionScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", e.Etag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionScope. +func (e *EncryptionScope) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionScopeListResult. +func (e EncryptionScopeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionScopeListResult. +func (e *EncryptionScopeListResult) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EncryptionScopeProperties. +func (e EncryptionScopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keySource", e.KeySource) + populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "state", e.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionScopeProperties. +func (e *EncryptionScopeProperties) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keySource": + err = unpopulate(val, "KeySource", &e.KeySource) + delete(rawMsg, key) + case "keyVaultProperties": + err = unpopulate(val, "KeyVaultProperties", &e.KeyVaultProperties) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &e.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1924,6 +2134,7 @@ func (m *MultiRegionSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "bypass", n.Bypass) populate(objectMap, "defaultAction", n.DefaultAction) populate(objectMap, "ipRules", n.IPRules) populate(objectMap, "virtualNetworkRules", n.VirtualNetworkRules) @@ -1939,6 +2150,9 @@ func (n *NetworkRuleSet) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "bypass": + err = unpopulate(val, "Bypass", &n.Bypass) + delete(rawMsg, key) case "defaultAction": err = unpopulate(val, "DefaultAction", &n.DefaultAction) delete(rawMsg, key) @@ -2481,15 +2695,16 @@ func (q *QuotaLimit) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RegenerateKeyParameters. -func (r RegenerateKeyParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RaiBlockListItemsResult. +func (r RaiBlockListItemsResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "keyName", r.KeyName) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RegenerateKeyParameters. -func (r *RegenerateKeyParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiBlockListItemsResult. +func (r *RaiBlockListItemsResult) 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", r, err) @@ -2497,8 +2712,11 @@ func (r *RegenerateKeyParameters) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "keyName": - err = unpopulate(val, "KeyName", &r.KeyName) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -2508,17 +2726,16 @@ func (r *RegenerateKeyParameters) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RegionSetting. -func (r RegionSetting) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RaiBlockListResult. +func (r RaiBlockListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "customsubdomain", r.Customsubdomain) - populate(objectMap, "name", r.Name) + populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RegionSetting. -func (r *RegionSetting) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiBlockListResult. +func (r *RaiBlockListResult) 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", r, err) @@ -2526,11 +2743,8 @@ func (r *RegionSetting) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "customsubdomain": - err = unpopulate(val, "Customsubdomain", &r.Customsubdomain) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &r.Value) @@ -2543,16 +2757,21 @@ func (r *RegionSetting) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RequestMatchPattern. -func (r RequestMatchPattern) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RaiBlocklist. +func (r RaiBlocklist) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "method", r.Method) - populate(objectMap, "path", r.Path) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RequestMatchPattern. -func (r *RequestMatchPattern) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiBlocklist. +func (r *RaiBlocklist) 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", r, err) @@ -2560,11 +2779,26 @@ func (r *RequestMatchPattern) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "method": - err = unpopulate(val, "Method", &r.Method) + case "etag": + err = unpopulate(val, "Etag", &r.Etag) delete(rawMsg, key) - case "path": - err = unpopulate(val, "Path", &r.Path) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { @@ -2574,17 +2808,16 @@ func (r *RequestMatchPattern) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RaiBlocklistConfig. +func (r RaiBlocklistConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) + populate(objectMap, "blocking", r.Blocking) + populate(objectMap, "blocklistName", r.BlocklistName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiBlocklistConfig. +func (r *RaiBlocklistConfig) 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", r, err) @@ -2592,14 +2825,11 @@ func (r *Resource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "blocking": + err = unpopulate(val, "Blocking", &r.Blocking) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "blocklistName": + err = unpopulate(val, "BlocklistName", &r.BlocklistName) delete(rawMsg, key) } if err != nil { @@ -2609,20 +2839,21 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceSKU. -func (r ResourceSKU) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RaiBlocklistItem. +func (r RaiBlocklistItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "kind", r.Kind) - populate(objectMap, "locations", r.Locations) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) - populate(objectMap, "resourceType", r.ResourceType) - populate(objectMap, "restrictions", r.Restrictions) - populate(objectMap, "tier", r.Tier) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKU. -func (r *ResourceSKU) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiBlocklistItem. +func (r *RaiBlocklistItem) 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", r, err) @@ -2630,23 +2861,26 @@ func (r *ResourceSKU) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "kind": - err = unpopulate(val, "Kind", &r.Kind) + case "etag": + err = unpopulate(val, "Etag", &r.Etag) delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &r.Locations) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "resourceType": - err = unpopulate(val, "ResourceType", &r.ResourceType) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) - case "restrictions": - err = unpopulate(val, "Restrictions", &r.Restrictions) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) delete(rawMsg, key) - case "tier": - err = unpopulate(val, "Tier", &r.Tier) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { @@ -2656,16 +2890,487 @@ func (r *ResourceSKU) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceSKUListResult. -func (r ResourceSKUListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RaiBlocklistItemProperties. +func (r RaiBlocklistItemProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "isRegex", r.IsRegex) + populate(objectMap, "pattern", r.Pattern) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKUListResult. -func (r *ResourceSKUListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiBlocklistItemProperties. +func (r *RaiBlocklistItemProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isRegex": + err = unpopulate(val, "IsRegex", &r.IsRegex) + delete(rawMsg, key) + case "pattern": + err = unpopulate(val, "Pattern", &r.Pattern) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RaiBlocklistProperties. +func (r RaiBlocklistProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", r.Description) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiBlocklistProperties. +func (r *RaiBlocklistProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RaiContentFilter. +func (r RaiContentFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", r.Description) + populate(objectMap, "filterType", r.FilterType) + populate(objectMap, "policyName", r.PolicyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiContentFilter. +func (r *RaiContentFilter) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "filterType": + err = unpopulate(val, "FilterType", &r.FilterType) + delete(rawMsg, key) + case "policyName": + err = unpopulate(val, "PolicyName", &r.PolicyName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RaiContentFilterListResult. +func (r RaiContentFilterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiContentFilterListResult. +func (r *RaiContentFilterListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RaiPolicy. +func (r RaiPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiPolicy. +func (r *RaiPolicy) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RaiPolicyContentFilter. +func (r RaiPolicyContentFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowedContentLevel", r.AllowedContentLevel) + populate(objectMap, "blocking", r.Blocking) + populate(objectMap, "enabled", r.Enabled) + populate(objectMap, "policyName", r.PolicyName) + populate(objectMap, "source", r.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiPolicyContentFilter. +func (r *RaiPolicyContentFilter) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedContentLevel": + err = unpopulate(val, "AllowedContentLevel", &r.AllowedContentLevel) + delete(rawMsg, key) + case "blocking": + err = unpopulate(val, "Blocking", &r.Blocking) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &r.Enabled) + delete(rawMsg, key) + case "policyName": + err = unpopulate(val, "PolicyName", &r.PolicyName) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &r.Source) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RaiPolicyListResult. +func (r RaiPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiPolicyListResult. +func (r *RaiPolicyListResult) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RaiPolicyProperties. +func (r RaiPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "basePolicyName", r.BasePolicyName) + populate(objectMap, "completionBlocklists", r.CompletionBlocklists) + populate(objectMap, "contentFilters", r.ContentFilters) + populate(objectMap, "mode", r.Mode) + populate(objectMap, "policyType", r.PolicyType) + populate(objectMap, "promptBlocklists", r.PromptBlocklists) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RaiPolicyProperties. +func (r *RaiPolicyProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "basePolicyName": + err = unpopulate(val, "BasePolicyName", &r.BasePolicyName) + delete(rawMsg, key) + case "completionBlocklists": + err = unpopulate(val, "CompletionBlocklists", &r.CompletionBlocklists) + delete(rawMsg, key) + case "contentFilters": + err = unpopulate(val, "ContentFilters", &r.ContentFilters) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &r.Mode) + delete(rawMsg, key) + case "policyType": + err = unpopulate(val, "PolicyType", &r.PolicyType) + delete(rawMsg, key) + case "promptBlocklists": + err = unpopulate(val, "PromptBlocklists", &r.PromptBlocklists) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegenerateKeyParameters. +func (r RegenerateKeyParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyName", r.KeyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegenerateKeyParameters. +func (r *RegenerateKeyParameters) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyName": + err = unpopulate(val, "KeyName", &r.KeyName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegionSetting. +func (r RegionSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customsubdomain", r.Customsubdomain) + populate(objectMap, "name", r.Name) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegionSetting. +func (r *RegionSetting) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customsubdomain": + err = unpopulate(val, "Customsubdomain", &r.Customsubdomain) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RequestMatchPattern. +func (r RequestMatchPattern) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "method", r.Method) + populate(objectMap, "path", r.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RequestMatchPattern. +func (r *RequestMatchPattern) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "method": + err = unpopulate(val, "Method", &r.Method) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &r.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKU. +func (r ResourceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kind", r.Kind) + populate(objectMap, "locations", r.Locations) + populate(objectMap, "name", r.Name) + populate(objectMap, "resourceType", r.ResourceType) + populate(objectMap, "restrictions", r.Restrictions) + populate(objectMap, "tier", r.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKU. +func (r *ResourceSKU) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &r.Locations) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &r.ResourceType) + delete(rawMsg, key) + case "restrictions": + err = unpopulate(val, "Restrictions", &r.Restrictions) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &r.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceSKUListResult. +func (r ResourceSKUListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSKUListResult. +func (r *ResourceSKUListResult) 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", r, err) @@ -2940,6 +3645,41 @@ func (s *SKUChangeInfo) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SKUResource. +func (s SKUResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "resourceType", s.ResourceType) + populate(objectMap, "sku", s.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUResource. +func (s *SKUResource) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &s.ResourceType) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3147,6 +3887,37 @@ func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type UserOwnedAmlWorkspace. +func (u UserOwnedAmlWorkspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identityClientId", u.IdentityClientID) + populate(objectMap, "resourceId", u.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserOwnedAmlWorkspace. +func (u *UserOwnedAmlWorkspace) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identityClientId": + err = unpopulate(val, "IdentityClientID", &u.IdentityClientID) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &u.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type UserOwnedStorage. func (u UserOwnedStorage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go index 45a7d42ba4ab..42661fa97ca9 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all the available Cognitive Services account operations. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") 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 deleted file mode 100644 index 635a8ecd5b91..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client_example_test.go +++ /dev/null @@ -1,76 +0,0 @@ -//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/GetOperations.json -func ExampleOperationsClient_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.NewOperationsClient().NewListPager(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.OperationListResult = armcognitiveservices.OperationListResult{ - // Value: []*armcognitiveservices.Operation{ - // { - // Name: to.Ptr("Microsoft.CognitiveServices/accounts/read"), - // Display: &armcognitiveservices.OperationDisplay{ - // Description: to.Ptr("Reads API accounts."), - // Operation: to.Ptr("Read API Account"), - // Provider: to.Ptr("Microsoft Cognitive Services"), - // Resource: to.Ptr("Cognitive Services API Account"), - // }, - // Origin: to.Ptr(armcognitiveservices.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.CognitiveServices/accounts/write"), - // Display: &armcognitiveservices.OperationDisplay{ - // Description: to.Ptr("Writes API Accounts."), - // Operation: to.Ptr("Write API Account"), - // Provider: to.Ptr("Microsoft Cognitive Services"), - // Resource: to.Ptr("Cognitive Services API Account"), - // }, - // Origin: to.Ptr(armcognitiveservices.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.CognitiveServices/accounts/delete"), - // Display: &armcognitiveservices.OperationDisplay{ - // Description: to.Ptr("Deletes API accounts"), - // Operation: to.Ptr("Delete API Account"), - // Provider: to.Ptr("Microsoft Cognitive Services"), - // Resource: to.Ptr("Cognitive Services API Account"), - // }, - // Origin: to.Ptr(armcognitiveservices.OriginUserSystem), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/options.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/options.go new file mode 100644 index 000000000000..845614c9c191 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/options.go @@ -0,0 +1,368 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcognitiveservices + +// AccountsClientBeginCreateOptions contains the optional parameters for the AccountsClient.BeginCreate method. +type AccountsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. +type AccountsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientBeginUpdateOptions contains the optional parameters for the AccountsClient.BeginUpdate method. +type AccountsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. +type AccountsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager +// method. +type AccountsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientListKeysOptions contains the optional parameters for the AccountsClient.ListKeys method. +type AccountsClientListKeysOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientListModelsOptions contains the optional parameters for the AccountsClient.NewListModelsPager method. +type AccountsClientListModelsOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientListOptions contains the optional parameters for the AccountsClient.NewListPager method. +type AccountsClientListOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientListSKUsOptions contains the optional parameters for the AccountsClient.ListSKUs method. +type AccountsClientListSKUsOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientListUsagesOptions contains the optional parameters for the AccountsClient.ListUsages method. +type AccountsClientListUsagesOptions 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 +} + +// AccountsClientRegenerateKeyOptions contains the optional parameters for the AccountsClient.RegenerateKey method. +type AccountsClientRegenerateKeyOptions struct { + // placeholder for future optional parameters +} + +// CommitmentPlansClientBeginCreateOrUpdateAssociationOptions contains the optional parameters for the CommitmentPlansClient.BeginCreateOrUpdateAssociation +// method. +type CommitmentPlansClientBeginCreateOrUpdateAssociationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CommitmentPlansClientBeginCreateOrUpdatePlanOptions contains the optional parameters for the CommitmentPlansClient.BeginCreateOrUpdatePlan +// method. +type CommitmentPlansClientBeginCreateOrUpdatePlanOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CommitmentPlansClientBeginDeleteAssociationOptions contains the optional parameters for the CommitmentPlansClient.BeginDeleteAssociation +// method. +type CommitmentPlansClientBeginDeleteAssociationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CommitmentPlansClientBeginDeleteOptions contains the optional parameters for the CommitmentPlansClient.BeginDelete method. +type CommitmentPlansClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CommitmentPlansClientBeginDeletePlanOptions contains the optional parameters for the CommitmentPlansClient.BeginDeletePlan +// method. +type CommitmentPlansClientBeginDeletePlanOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CommitmentPlansClientBeginUpdatePlanOptions contains the optional parameters for the CommitmentPlansClient.BeginUpdatePlan +// method. +type CommitmentPlansClientBeginUpdatePlanOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CommitmentPlansClientCreateOrUpdateOptions contains the optional parameters for the CommitmentPlansClient.CreateOrUpdate +// method. +type CommitmentPlansClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// CommitmentPlansClientGetAssociationOptions contains the optional parameters for the CommitmentPlansClient.GetAssociation +// method. +type CommitmentPlansClientGetAssociationOptions struct { + // placeholder for future optional parameters +} + +// CommitmentPlansClientGetOptions contains the optional parameters for the CommitmentPlansClient.Get method. +type CommitmentPlansClientGetOptions struct { + // placeholder for future optional parameters +} + +// CommitmentPlansClientGetPlanOptions contains the optional parameters for the CommitmentPlansClient.GetPlan method. +type CommitmentPlansClientGetPlanOptions struct { + // placeholder for future optional parameters +} + +// CommitmentPlansClientListAssociationsOptions contains the optional parameters for the CommitmentPlansClient.NewListAssociationsPager +// method. +type CommitmentPlansClientListAssociationsOptions struct { + // placeholder for future optional parameters +} + +// CommitmentPlansClientListOptions contains the optional parameters for the CommitmentPlansClient.NewListPager method. +type CommitmentPlansClientListOptions struct { + // placeholder for future optional parameters +} + +// CommitmentPlansClientListPlansByResourceGroupOptions contains the optional parameters for the CommitmentPlansClient.NewListPlansByResourceGroupPager +// method. +type CommitmentPlansClientListPlansByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// CommitmentPlansClientListPlansBySubscriptionOptions contains the optional parameters for the CommitmentPlansClient.NewListPlansBySubscriptionPager +// method. +type CommitmentPlansClientListPlansBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// CommitmentTiersClientListOptions contains the optional parameters for the CommitmentTiersClient.NewListPager method. +type CommitmentTiersClientListOptions struct { + // placeholder for future optional parameters +} + +// DeletedAccountsClientBeginPurgeOptions contains the optional parameters for the DeletedAccountsClient.BeginPurge method. +type DeletedAccountsClientBeginPurgeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeletedAccountsClientGetOptions contains the optional parameters for the DeletedAccountsClient.Get method. +type DeletedAccountsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.NewListPager method. +type DeletedAccountsClientListOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate +// method. +type DeploymentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. +type DeploymentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientBeginUpdateOptions contains the optional parameters for the DeploymentsClient.BeginUpdate method. +type DeploymentsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeploymentsClientGetOptions contains the optional parameters for the DeploymentsClient.Get method. +type DeploymentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientListOptions contains the optional parameters for the DeploymentsClient.NewListPager method. +type DeploymentsClientListOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsClientListSKUsOptions contains the optional parameters for the DeploymentsClient.NewListSKUsPager method. +type DeploymentsClientListSKUsOptions struct { + // placeholder for future optional parameters +} + +// EncryptionScopesClientBeginDeleteOptions contains the optional parameters for the EncryptionScopesClient.BeginDelete method. +type EncryptionScopesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// EncryptionScopesClientCreateOrUpdateOptions contains the optional parameters for the EncryptionScopesClient.CreateOrUpdate +// method. +type EncryptionScopesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// EncryptionScopesClientGetOptions contains the optional parameters for the EncryptionScopesClient.Get method. +type EncryptionScopesClientGetOptions struct { + // placeholder for future optional parameters +} + +// EncryptionScopesClientListOptions contains the optional parameters for the EncryptionScopesClient.NewListPager method. +type EncryptionScopesClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagementClientCheckDomainAvailabilityOptions contains the optional parameters for the ManagementClient.CheckDomainAvailability +// method. +type ManagementClientCheckDomainAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ManagementClientCheckSKUAvailabilityOptions contains the optional parameters for the ManagementClient.CheckSKUAvailability +// method. +type ManagementClientCheckSKUAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ModelsClientListOptions contains the optional parameters for the ModelsClient.NewListPager method. +type ModelsClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List method. +type PrivateLinkResourcesClientListOptions struct { + // placeholder for future optional parameters +} + +// RaiBlocklistItemsClientBeginDeleteOptions contains the optional parameters for the RaiBlocklistItemsClient.BeginDelete +// method. +type RaiBlocklistItemsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RaiBlocklistItemsClientCreateOrUpdateOptions contains the optional parameters for the RaiBlocklistItemsClient.CreateOrUpdate +// method. +type RaiBlocklistItemsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// RaiBlocklistItemsClientGetOptions contains the optional parameters for the RaiBlocklistItemsClient.Get method. +type RaiBlocklistItemsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RaiBlocklistItemsClientListOptions contains the optional parameters for the RaiBlocklistItemsClient.NewListPager method. +type RaiBlocklistItemsClientListOptions struct { + // placeholder for future optional parameters +} + +// RaiBlocklistsClientBeginDeleteOptions contains the optional parameters for the RaiBlocklistsClient.BeginDelete method. +type RaiBlocklistsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RaiBlocklistsClientCreateOrUpdateOptions contains the optional parameters for the RaiBlocklistsClient.CreateOrUpdate method. +type RaiBlocklistsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// RaiBlocklistsClientGetOptions contains the optional parameters for the RaiBlocklistsClient.Get method. +type RaiBlocklistsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RaiBlocklistsClientListOptions contains the optional parameters for the RaiBlocklistsClient.NewListPager method. +type RaiBlocklistsClientListOptions struct { + // placeholder for future optional parameters +} + +// RaiContentFiltersClientListOptions contains the optional parameters for the RaiContentFiltersClient.List method. +type RaiContentFiltersClientListOptions struct { + // placeholder for future optional parameters +} + +// RaiPoliciesClientBeginDeleteOptions contains the optional parameters for the RaiPoliciesClient.BeginDelete method. +type RaiPoliciesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RaiPoliciesClientCreateOrUpdateOptions contains the optional parameters for the RaiPoliciesClient.CreateOrUpdate method. +type RaiPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// RaiPoliciesClientGetOptions contains the optional parameters for the RaiPoliciesClient.Get method. +type RaiPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RaiPoliciesClientListOptions contains the optional parameters for the RaiPoliciesClient.NewListPager method. +type RaiPoliciesClientListOptions struct { + // placeholder for future optional parameters +} + +// ResourceSKUsClientListOptions contains the optional parameters for the ResourceSKUsClient.NewListPager method. +type ResourceSKUsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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 +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go index 02a98e136aca..8cf0af0d59ed 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -48,7 +47,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 @@ -61,7 +60,8 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, properties, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,16 +112,19 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } // 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 @@ -131,7 +136,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -140,20 +146,22 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -180,7 +188,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,25 +197,28 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -234,7 +245,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,24 +263,27 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 // method. func (client *PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, accountName string, options *PrivateEndpointConnectionsClientListOptions) (PrivateEndpointConnectionsClientListResponse, error) { + var err error req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return PrivateEndpointConnectionsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -292,7 +306,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") 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 deleted file mode 100644 index 889e91fa38a0..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,159 +0,0 @@ -//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/azcore/to" - "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/ListPrivateEndpointConnections.json -func ExamplePrivateEndpointConnectionsClient_List() { - 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) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().List(ctx, "res6977", "sto2527", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnectionListResult = armcognitiveservices.PrivateEndpointConnectionListResult{ - // Value: []*armcognitiveservices.PrivateEndpointConnection{ - // { - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.CognitiveServices/accounts/sto288/privateEndpointConnections/{privateEndpointConnectionName}"), - // Properties: &armcognitiveservices.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcognitiveservices.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"), - // }, - // PrivateLinkServiceConnectionState: &armcognitiveservices.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcognitiveservices.PrivateEndpointServiceConnectionStatusApproved), - // }, - // }, - // }}, - // } -} - -// 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 { - 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) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "res6977", "sto2527", "{privateEndpointConnectionName}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armcognitiveservices.PrivateEndpointConnection{ - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.CognitiveServices/accounts/sto288/privateEndpointConnections/{privateEndpointConnectionName}"), - // Properties: &armcognitiveservices.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcognitiveservices.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"), - // }, - // PrivateLinkServiceConnectionState: &armcognitiveservices.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcognitiveservices.PrivateEndpointServiceConnectionStatusApproved), - // }, - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "res7687", "sto9699", "{privateEndpointConnectionName}", armcognitiveservices.PrivateEndpointConnection{ - Properties: &armcognitiveservices.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armcognitiveservices.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Auto-Approved"), - Status: to.Ptr(armcognitiveservices.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armcognitiveservices.PrivateEndpointConnection{ - // Name: to.Ptr("{privateEndpointConnectionName}"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.CognitiveServices/accounts/sto288/privateEndpointConnections/{privateEndpointConnectionName}"), - // Properties: &armcognitiveservices.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcognitiveservices.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01"), - // }, - // PrivateLinkServiceConnectionState: &armcognitiveservices.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armcognitiveservices.PrivateEndpointServiceConnectionStatusApproved), - // }, - // }, - // } -} - -// 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 { - 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) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "res6977", "sto2527", "{privateEndpointConnectionName}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go index 47cb85e4f9f5..aeb6f22d53eb 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -47,24 +46,27 @@ 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 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 // method. func (client *PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *PrivateLinkResourcesClientListOptions) (PrivateLinkResourcesClientListResponse, error) { + var err error req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return PrivateLinkResourcesClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. @@ -87,7 +89,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") 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 deleted file mode 100644 index 3e5948db7604..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,53 +0,0 @@ -//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/ListPrivateLinkResources.json -func ExamplePrivateLinkResourcesClient_List() { - 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) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().List(ctx, "res6977", "sto2527", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResourceListResult = armcognitiveservices.PrivateLinkResourceListResult{ - // Value: []*armcognitiveservices.PrivateLinkResource{ - // { - // Name: to.Ptr("blob"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/privateLinkResources"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.CognitiveServices/accounts/sto2527/privateLinkResources/account"), - // Properties: &armcognitiveservices.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("account"), - // RequiredMembers: []*string{ - // to.Ptr("default")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.cognitiveservices.azure.com")}, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client.go new file mode 100644 index 000000000000..bcca0947928a --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client.go @@ -0,0 +1,344 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// RaiBlocklistItemsClient contains the methods for the RaiBlocklistItems group. +// Don't use this type directly, use NewRaiBlocklistItemsClient() instead. +type RaiBlocklistItemsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewRaiBlocklistItemsClient creates a new instance of RaiBlocklistItemsClient 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 NewRaiBlocklistItemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RaiBlocklistItemsClient, error) { + cl, err := arm.NewClient(moduleName+".RaiBlocklistItemsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RaiBlocklistItemsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Update the state of specified blocklist item associated with the Azure OpenAI account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account +// - raiBlocklistItemName - The name of the RaiBlocklist Item associated with the custom blocklist +// - raiBlocklistItem - Properties describing the custom blocklist. +// - options - RaiBlocklistItemsClientCreateOrUpdateOptions contains the optional parameters for the RaiBlocklistItemsClient.CreateOrUpdate +// method. +func (client *RaiBlocklistItemsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, raiBlocklistItem RaiBlocklistItem, options *RaiBlocklistItemsClientCreateOrUpdateOptions) (RaiBlocklistItemsClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName, raiBlocklistItem, options) + if err != nil { + return RaiBlocklistItemsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RaiBlocklistItemsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return RaiBlocklistItemsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RaiBlocklistItemsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, raiBlocklistItem RaiBlocklistItem, options *RaiBlocklistItemsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if raiBlocklistName == "" { + return nil, errors.New("parameter raiBlocklistName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiBlocklistName}", url.PathEscape(raiBlocklistName)) + if raiBlocklistItemName == "" { + return nil, errors.New("parameter raiBlocklistItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiBlocklistItemName}", url.PathEscape(raiBlocklistItemName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, raiBlocklistItem); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *RaiBlocklistItemsClient) createOrUpdateHandleResponse(resp *http.Response) (RaiBlocklistItemsClientCreateOrUpdateResponse, error) { + result := RaiBlocklistItemsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RaiBlocklistItem); err != nil { + return RaiBlocklistItemsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes the specified blocklist Item associated with the custom blocklist. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account +// - raiBlocklistItemName - The name of the RaiBlocklist Item associated with the custom blocklist +// - options - RaiBlocklistItemsClientBeginDeleteOptions contains the optional parameters for the RaiBlocklistItemsClient.BeginDelete +// method. +func (client *RaiBlocklistItemsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, options *RaiBlocklistItemsClientBeginDeleteOptions) (*runtime.Poller[RaiBlocklistItemsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RaiBlocklistItemsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RaiBlocklistItemsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified blocklist Item associated with the custom blocklist. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *RaiBlocklistItemsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, options *RaiBlocklistItemsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RaiBlocklistItemsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, options *RaiBlocklistItemsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if raiBlocklistName == "" { + return nil, errors.New("parameter raiBlocklistName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiBlocklistName}", url.PathEscape(raiBlocklistName)) + if raiBlocklistItemName == "" { + return nil, errors.New("parameter raiBlocklistItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiBlocklistItemName}", url.PathEscape(raiBlocklistItemName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified custom blocklist Item associated with the custom blocklist. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account +// - raiBlocklistItemName - The name of the RaiBlocklist Item associated with the custom blocklist +// - options - RaiBlocklistItemsClientGetOptions contains the optional parameters for the RaiBlocklistItemsClient.Get method. +func (client *RaiBlocklistItemsClient) Get(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, options *RaiBlocklistItemsClientGetOptions) (RaiBlocklistItemsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName, options) + if err != nil { + return RaiBlocklistItemsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RaiBlocklistItemsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RaiBlocklistItemsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RaiBlocklistItemsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, options *RaiBlocklistItemsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if raiBlocklistName == "" { + return nil, errors.New("parameter raiBlocklistName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiBlocklistName}", url.PathEscape(raiBlocklistName)) + if raiBlocklistItemName == "" { + return nil, errors.New("parameter raiBlocklistItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiBlocklistItemName}", url.PathEscape(raiBlocklistItemName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RaiBlocklistItemsClient) getHandleResponse(resp *http.Response) (RaiBlocklistItemsClientGetResponse, error) { + result := RaiBlocklistItemsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RaiBlocklistItem); err != nil { + return RaiBlocklistItemsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the blocklist items associated with the custom blocklist. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account +// - options - RaiBlocklistItemsClientListOptions contains the optional parameters for the RaiBlocklistItemsClient.NewListPager +// method. +func (client *RaiBlocklistItemsClient) NewListPager(resourceGroupName string, accountName string, raiBlocklistName string, options *RaiBlocklistItemsClientListOptions) *runtime.Pager[RaiBlocklistItemsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RaiBlocklistItemsClientListResponse]{ + More: func(page RaiBlocklistItemsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RaiBlocklistItemsClientListResponse) (RaiBlocklistItemsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, raiBlocklistName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RaiBlocklistItemsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RaiBlocklistItemsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RaiBlocklistItemsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *RaiBlocklistItemsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, options *RaiBlocklistItemsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if raiBlocklistName == "" { + return nil, errors.New("parameter raiBlocklistName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiBlocklistName}", url.PathEscape(raiBlocklistName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RaiBlocklistItemsClient) listHandleResponse(resp *http.Response) (RaiBlocklistItemsClientListResponse, error) { + result := RaiBlocklistItemsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RaiBlockListItemsResult); err != nil { + return RaiBlocklistItemsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client.go new file mode 100644 index 000000000000..9bed49d990f1 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client.go @@ -0,0 +1,323 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// RaiBlocklistsClient contains the methods for the RaiBlocklists group. +// Don't use this type directly, use NewRaiBlocklistsClient() instead. +type RaiBlocklistsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewRaiBlocklistsClient creates a new instance of RaiBlocklistsClient 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 NewRaiBlocklistsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RaiBlocklistsClient, error) { + cl, err := arm.NewClient(moduleName+".RaiBlocklistsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RaiBlocklistsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Update the state of specified blocklist associated with the Azure OpenAI account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account +// - raiBlocklist - Properties describing the custom blocklist. +// - options - RaiBlocklistsClientCreateOrUpdateOptions contains the optional parameters for the RaiBlocklistsClient.CreateOrUpdate +// method. +func (client *RaiBlocklistsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklist RaiBlocklist, options *RaiBlocklistsClientCreateOrUpdateOptions) (RaiBlocklistsClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, raiBlocklistName, raiBlocklist, options) + if err != nil { + return RaiBlocklistsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RaiBlocklistsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return RaiBlocklistsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RaiBlocklistsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklist RaiBlocklist, options *RaiBlocklistsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if raiBlocklistName == "" { + return nil, errors.New("parameter raiBlocklistName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiBlocklistName}", url.PathEscape(raiBlocklistName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, raiBlocklist); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *RaiBlocklistsClient) createOrUpdateHandleResponse(resp *http.Response) (RaiBlocklistsClientCreateOrUpdateResponse, error) { + result := RaiBlocklistsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RaiBlocklist); err != nil { + return RaiBlocklistsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes the specified custom blocklist associated with the Azure OpenAI account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account +// - options - RaiBlocklistsClientBeginDeleteOptions contains the optional parameters for the RaiBlocklistsClient.BeginDelete +// method. +func (client *RaiBlocklistsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, options *RaiBlocklistsClientBeginDeleteOptions) (*runtime.Poller[RaiBlocklistsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, raiBlocklistName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RaiBlocklistsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RaiBlocklistsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified custom blocklist associated with the Azure OpenAI account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *RaiBlocklistsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, options *RaiBlocklistsClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, raiBlocklistName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RaiBlocklistsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, options *RaiBlocklistsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if raiBlocklistName == "" { + return nil, errors.New("parameter raiBlocklistName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiBlocklistName}", url.PathEscape(raiBlocklistName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified custom blocklist associated with the Azure OpenAI account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account +// - options - RaiBlocklistsClientGetOptions contains the optional parameters for the RaiBlocklistsClient.Get method. +func (client *RaiBlocklistsClient) Get(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, options *RaiBlocklistsClientGetOptions) (RaiBlocklistsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, raiBlocklistName, options) + if err != nil { + return RaiBlocklistsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RaiBlocklistsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RaiBlocklistsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RaiBlocklistsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, options *RaiBlocklistsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if raiBlocklistName == "" { + return nil, errors.New("parameter raiBlocklistName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiBlocklistName}", url.PathEscape(raiBlocklistName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RaiBlocklistsClient) getHandleResponse(resp *http.Response) (RaiBlocklistsClientGetResponse, error) { + result := RaiBlocklistsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RaiBlocklist); err != nil { + return RaiBlocklistsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the custom blocklists associated with the Azure OpenAI account. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - options - RaiBlocklistsClientListOptions contains the optional parameters for the RaiBlocklistsClient.NewListPager method. +func (client *RaiBlocklistsClient) NewListPager(resourceGroupName string, accountName string, options *RaiBlocklistsClientListOptions) *runtime.Pager[RaiBlocklistsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RaiBlocklistsClientListResponse]{ + More: func(page RaiBlocklistsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RaiBlocklistsClientListResponse) (RaiBlocklistsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RaiBlocklistsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RaiBlocklistsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RaiBlocklistsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *RaiBlocklistsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *RaiBlocklistsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RaiBlocklistsClient) listHandleResponse(resp *http.Response) (RaiBlocklistsClientListResponse, error) { + result := RaiBlocklistsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RaiBlockListResult); err != nil { + return RaiBlocklistsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client.go new file mode 100644 index 000000000000..dce5e885e642 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client.go @@ -0,0 +1,99 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// RaiContentFiltersClient contains the methods for the RaiContentFilters group. +// Don't use this type directly, use NewRaiContentFiltersClient() instead. +type RaiContentFiltersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewRaiContentFiltersClient creates a new instance of RaiContentFiltersClient 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 NewRaiContentFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RaiContentFiltersClient, error) { + cl, err := arm.NewClient(moduleName+".RaiContentFiltersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RaiContentFiltersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// List - List Content Filters types. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - location - Resource location. +// - options - RaiContentFiltersClientListOptions contains the optional parameters for the RaiContentFiltersClient.List method. +func (client *RaiContentFiltersClient) List(ctx context.Context, location string, options *RaiContentFiltersClientListOptions) (RaiContentFiltersClientListResponse, error) { + var err error + req, err := client.listCreateRequest(ctx, location, options) + if err != nil { + return RaiContentFiltersClientListResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RaiContentFiltersClientListResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RaiContentFiltersClientListResponse{}, err + } + resp, err := client.listHandleResponse(httpResp) + return resp, err +} + +// listCreateRequest creates the List request. +func (client *RaiContentFiltersClient) listCreateRequest(ctx context.Context, location string, options *RaiContentFiltersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RaiContentFiltersClient) listHandleResponse(resp *http.Response) (RaiContentFiltersClientListResponse, error) { + result := RaiContentFiltersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RaiContentFilterListResult); err != nil { + return RaiContentFiltersClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client.go new file mode 100644 index 000000000000..c8f0c296015d --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client.go @@ -0,0 +1,322 @@ +//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. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +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" +) + +// RaiPoliciesClient contains the methods for the RaiPolicies group. +// Don't use this type directly, use NewRaiPoliciesClient() instead. +type RaiPoliciesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewRaiPoliciesClient creates a new instance of RaiPoliciesClient 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 NewRaiPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RaiPoliciesClient, error) { + cl, err := arm.NewClient(moduleName+".RaiPoliciesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &RaiPoliciesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Update the state of specified Content Filters associated with the Azure OpenAI account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - raiPolicyName - The name of the RaiPolicy associated with the Cognitive Services Account +// - raiPolicy - Properties describing the Content Filters. +// - options - RaiPoliciesClientCreateOrUpdateOptions contains the optional parameters for the RaiPoliciesClient.CreateOrUpdate +// method. +func (client *RaiPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, raiPolicy RaiPolicy, options *RaiPoliciesClientCreateOrUpdateOptions) (RaiPoliciesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, raiPolicyName, raiPolicy, options) + if err != nil { + return RaiPoliciesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RaiPoliciesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return RaiPoliciesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RaiPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, raiPolicy RaiPolicy, options *RaiPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if raiPolicyName == "" { + return nil, errors.New("parameter raiPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiPolicyName}", url.PathEscape(raiPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, raiPolicy); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *RaiPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (RaiPoliciesClientCreateOrUpdateResponse, error) { + result := RaiPoliciesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RaiPolicy); err != nil { + return RaiPoliciesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes the specified Content Filters associated with the Azure OpenAI account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - raiPolicyName - The name of the RaiPolicy associated with the Cognitive Services Account +// - options - RaiPoliciesClientBeginDeleteOptions contains the optional parameters for the RaiPoliciesClient.BeginDelete method. +func (client *RaiPoliciesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, options *RaiPoliciesClientBeginDeleteOptions) (*runtime.Poller[RaiPoliciesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, raiPolicyName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RaiPoliciesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[RaiPoliciesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified Content Filters associated with the Azure OpenAI account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *RaiPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, options *RaiPoliciesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, raiPolicyName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RaiPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, options *RaiPoliciesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if raiPolicyName == "" { + return nil, errors.New("parameter raiPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiPolicyName}", url.PathEscape(raiPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified Content Filters associated with the Azure OpenAI account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - raiPolicyName - The name of the RaiPolicy associated with the Cognitive Services Account +// - options - RaiPoliciesClientGetOptions contains the optional parameters for the RaiPoliciesClient.Get method. +func (client *RaiPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, options *RaiPoliciesClientGetOptions) (RaiPoliciesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, raiPolicyName, options) + if err != nil { + return RaiPoliciesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RaiPoliciesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RaiPoliciesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *RaiPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, options *RaiPoliciesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if raiPolicyName == "" { + return nil, errors.New("parameter raiPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{raiPolicyName}", url.PathEscape(raiPolicyName)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RaiPoliciesClient) getHandleResponse(resp *http.Response) (RaiPoliciesClientGetResponse, error) { + result := RaiPoliciesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RaiPolicy); err != nil { + return RaiPoliciesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the content filters associated with the Azure OpenAI account. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - options - RaiPoliciesClientListOptions contains the optional parameters for the RaiPoliciesClient.NewListPager method. +func (client *RaiPoliciesClient) NewListPager(resourceGroupName string, accountName string, options *RaiPoliciesClientListOptions) *runtime.Pager[RaiPoliciesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RaiPoliciesClientListResponse]{ + More: func(page RaiPoliciesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *RaiPoliciesClientListResponse) (RaiPoliciesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, accountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return RaiPoliciesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return RaiPoliciesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RaiPoliciesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *RaiPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *RaiPoliciesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RaiPoliciesClient) listHandleResponse(resp *http.Response) (RaiPoliciesClientListResponse, error) { + result := RaiPoliciesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RaiPolicyListResult); err != nil { + return RaiPoliciesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go index 1f1b04d90c94..9cd4426ab7c6 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -46,7 +45,7 @@ func NewResourceSKUsClient(subscriptionID string, credential azcore.TokenCredent // NewListPager - Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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 +87,7 @@ func (client *ResourceSKUsClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") 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 deleted file mode 100644 index a0e3bb471a19..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client_example_test.go +++ /dev/null @@ -1,2196 +0,0 @@ -//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/GetSkus.json -func ExampleResourceSKUsClient_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.NewResourceSKUsClient().NewListPager(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.ResourceSKUListResult = armcognitiveservices.ResourceSKUListResult{ - // Value: []*armcognitiveservices.ResourceSKU{ - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Bing.Speech"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Bing.Speech"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("SpeechTranslation"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("SpeechTranslation"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("SpeechTranslation"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("SpeechTranslation"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("SpeechTranslation"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextTranslation"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextTranslation"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextTranslation"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextTranslation"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextTranslation"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("Bing.Search.v7"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("Bing.Search.v7"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("Bing.Search.v7"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("Bing.Search.v7"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S5"), - // Kind: to.Ptr("Bing.Search.v7"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S6"), - // Kind: to.Ptr("Bing.Search.v7"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S7"), - // Kind: to.Ptr("Bing.Search.v7"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S8"), - // Kind: to.Ptr("Bing.Search.v7"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("Bing.Autosuggest.v7"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("Bing.CustomSearch"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("Bing.SpellCheck.v7"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Bing.EntitySearch"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("Bing.EntitySearch"), - // Locations: []*string{ - // to.Ptr("GLOBAL")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("AUSTRALIAEAST")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("BRAZILSOUTH")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("CENTRALUSEUAP")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("SpeakerRecognition"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("SpeakerRecognition"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("CustomSpeech"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("CustomSpeech"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("WESTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("WESTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("NORTHEUROPE")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHEASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("EASTASIA")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("WESTCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("CustomVision.Training"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("CustomVision.Training"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("CustomVision.Prediction"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("CustomVision.Prediction"), - // Locations: []*string{ - // to.Ptr("SOUTHCENTRALUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("EASTUS")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("ContentModerator"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("Face"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("LUIS"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("ComputerVision"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("F0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Free"), - // }, - // { - // Name: to.Ptr("S0"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S1"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S2"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S3"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("S4"), - // Kind: to.Ptr("TextAnalytics"), - // Locations: []*string{ - // to.Ptr("EASTUS2")}, - // ResourceType: to.Ptr("accounts"), - // Restrictions: []*armcognitiveservices.ResourceSKURestrictions{ - // }, - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/response_types.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/response_types.go index e74eb06f93f5..e54ccfa9c1f1 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/response_types.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/response_types.go @@ -3,14 +3,14 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices // AccountsClientCreateResponse contains the response from method AccountsClient.BeginCreate. type AccountsClientCreateResponse struct { + // Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU. Account } @@ -21,61 +21,73 @@ type AccountsClientDeleteResponse struct { // AccountsClientGetResponse contains the response from method AccountsClient.Get. type AccountsClientGetResponse struct { + // Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU. Account } // AccountsClientListByResourceGroupResponse contains the response from method AccountsClient.NewListByResourceGroupPager. type AccountsClientListByResourceGroupResponse struct { + // The list of cognitive services accounts operation response. AccountListResult } // AccountsClientListKeysResponse contains the response from method AccountsClient.ListKeys. type AccountsClientListKeysResponse struct { + // The access keys for the cognitive services account. APIKeys } // AccountsClientListModelsResponse contains the response from method AccountsClient.NewListModelsPager. type AccountsClientListModelsResponse struct { + // The list of cognitive services accounts operation response. AccountModelListResult } // AccountsClientListResponse contains the response from method AccountsClient.NewListPager. type AccountsClientListResponse struct { + // The list of cognitive services accounts operation response. AccountListResult } // AccountsClientListSKUsResponse contains the response from method AccountsClient.ListSKUs. type AccountsClientListSKUsResponse struct { + // The list of cognitive services accounts operation response. AccountSKUListResult } // AccountsClientListUsagesResponse contains the response from method AccountsClient.ListUsages. type AccountsClientListUsagesResponse struct { + // The response to a list usage request. UsageListResult } // AccountsClientRegenerateKeyResponse contains the response from method AccountsClient.RegenerateKey. type AccountsClientRegenerateKeyResponse struct { + // The access keys for the cognitive services account. APIKeys } // AccountsClientUpdateResponse contains the response from method AccountsClient.BeginUpdate. type AccountsClientUpdateResponse struct { + // Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU. Account } // CommitmentPlansClientCreateOrUpdateAssociationResponse contains the response from method CommitmentPlansClient.BeginCreateOrUpdateAssociation. type CommitmentPlansClientCreateOrUpdateAssociationResponse struct { + // The commitment plan association. CommitmentPlanAccountAssociation } // CommitmentPlansClientCreateOrUpdatePlanResponse contains the response from method CommitmentPlansClient.BeginCreateOrUpdatePlan. type CommitmentPlansClientCreateOrUpdatePlanResponse struct { + // Cognitive Services account commitment plan. CommitmentPlan } // CommitmentPlansClientCreateOrUpdateResponse contains the response from method CommitmentPlansClient.CreateOrUpdate. type CommitmentPlansClientCreateOrUpdateResponse struct { + // Cognitive Services account commitment plan. CommitmentPlan } @@ -96,56 +108,67 @@ type CommitmentPlansClientDeleteResponse struct { // CommitmentPlansClientGetAssociationResponse contains the response from method CommitmentPlansClient.GetAssociation. type CommitmentPlansClientGetAssociationResponse struct { + // The commitment plan association. CommitmentPlanAccountAssociation } // CommitmentPlansClientGetPlanResponse contains the response from method CommitmentPlansClient.GetPlan. type CommitmentPlansClientGetPlanResponse struct { + // Cognitive Services account commitment plan. CommitmentPlan } // CommitmentPlansClientGetResponse contains the response from method CommitmentPlansClient.Get. type CommitmentPlansClientGetResponse struct { + // Cognitive Services account commitment plan. CommitmentPlan } // CommitmentPlansClientListAssociationsResponse contains the response from method CommitmentPlansClient.NewListAssociationsPager. type CommitmentPlansClientListAssociationsResponse struct { + // The list of cognitive services Commitment Plan Account Association operation response. CommitmentPlanAccountAssociationListResult } // CommitmentPlansClientListPlansByResourceGroupResponse contains the response from method CommitmentPlansClient.NewListPlansByResourceGroupPager. type CommitmentPlansClientListPlansByResourceGroupResponse struct { + // The list of cognitive services accounts operation response. CommitmentPlanListResult } // CommitmentPlansClientListPlansBySubscriptionResponse contains the response from method CommitmentPlansClient.NewListPlansBySubscriptionPager. type CommitmentPlansClientListPlansBySubscriptionResponse struct { + // The list of cognitive services accounts operation response. CommitmentPlanListResult } // CommitmentPlansClientListResponse contains the response from method CommitmentPlansClient.NewListPager. type CommitmentPlansClientListResponse struct { + // The list of cognitive services accounts operation response. CommitmentPlanListResult } // CommitmentPlansClientUpdatePlanResponse contains the response from method CommitmentPlansClient.BeginUpdatePlan. type CommitmentPlansClientUpdatePlanResponse struct { + // Cognitive Services account commitment plan. CommitmentPlan } // CommitmentTiersClientListResponse contains the response from method CommitmentTiersClient.NewListPager. type CommitmentTiersClientListResponse struct { + // The list of cognitive services accounts operation response. CommitmentTierListResult } // DeletedAccountsClientGetResponse contains the response from method DeletedAccountsClient.Get. type DeletedAccountsClientGetResponse struct { + // Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU. Account } // DeletedAccountsClientListResponse contains the response from method DeletedAccountsClient.NewListPager. type DeletedAccountsClientListResponse struct { + // The list of cognitive services accounts operation response. AccountListResult } @@ -156,6 +179,7 @@ type DeletedAccountsClientPurgeResponse struct { // DeploymentsClientCreateOrUpdateResponse contains the response from method DeploymentsClient.BeginCreateOrUpdate. type DeploymentsClientCreateOrUpdateResponse struct { + // Cognitive Services account deployment. Deployment } @@ -166,36 +190,78 @@ type DeploymentsClientDeleteResponse struct { // DeploymentsClientGetResponse contains the response from method DeploymentsClient.Get. type DeploymentsClientGetResponse struct { + // Cognitive Services account deployment. Deployment } // DeploymentsClientListResponse contains the response from method DeploymentsClient.NewListPager. type DeploymentsClientListResponse struct { + // The list of cognitive services accounts operation response. DeploymentListResult } +// DeploymentsClientListSKUsResponse contains the response from method DeploymentsClient.NewListSKUsPager. +type DeploymentsClientListSKUsResponse struct { + // The list of cognitive services accounts operation response. + DeploymentSKUListResult +} + +// DeploymentsClientUpdateResponse contains the response from method DeploymentsClient.BeginUpdate. +type DeploymentsClientUpdateResponse struct { + // Cognitive Services account deployment. + Deployment +} + +// EncryptionScopesClientCreateOrUpdateResponse contains the response from method EncryptionScopesClient.CreateOrUpdate. +type EncryptionScopesClientCreateOrUpdateResponse struct { + // Cognitive Services EncryptionScope + EncryptionScope +} + +// EncryptionScopesClientDeleteResponse contains the response from method EncryptionScopesClient.BeginDelete. +type EncryptionScopesClientDeleteResponse struct { + // placeholder for future response values +} + +// EncryptionScopesClientGetResponse contains the response from method EncryptionScopesClient.Get. +type EncryptionScopesClientGetResponse struct { + // Cognitive Services EncryptionScope + EncryptionScope +} + +// EncryptionScopesClientListResponse contains the response from method EncryptionScopesClient.NewListPager. +type EncryptionScopesClientListResponse struct { + // The list of cognitive services EncryptionScopes. + EncryptionScopeListResult +} + // ManagementClientCheckDomainAvailabilityResponse contains the response from method ManagementClient.CheckDomainAvailability. type ManagementClientCheckDomainAvailabilityResponse struct { + // Domain availability. DomainAvailability } // ManagementClientCheckSKUAvailabilityResponse contains the response from method ManagementClient.CheckSKUAvailability. type ManagementClientCheckSKUAvailabilityResponse struct { + // Check SKU availability result list. SKUAvailabilityListResult } // ModelsClientListResponse contains the response from method ModelsClient.NewListPager. type ModelsClientListResponse struct { + // The list of cognitive services models. ModelListResult } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { + // The Private Endpoint Connection resource. PrivateEndpointConnection } @@ -206,25 +272,105 @@ type PrivateEndpointConnectionsClientDeleteResponse struct { // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // The Private Endpoint Connection resource. PrivateEndpointConnection } // PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.List. type PrivateEndpointConnectionsClientListResponse struct { + // A list of private endpoint connections PrivateEndpointConnectionListResult } // PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.List. type PrivateLinkResourcesClientListResponse struct { + // A list of private link resources PrivateLinkResourceListResult } +// RaiBlocklistItemsClientCreateOrUpdateResponse contains the response from method RaiBlocklistItemsClient.CreateOrUpdate. +type RaiBlocklistItemsClientCreateOrUpdateResponse struct { + // Cognitive Services RaiBlocklist Item. + RaiBlocklistItem +} + +// RaiBlocklistItemsClientDeleteResponse contains the response from method RaiBlocklistItemsClient.BeginDelete. +type RaiBlocklistItemsClientDeleteResponse struct { + // placeholder for future response values +} + +// RaiBlocklistItemsClientGetResponse contains the response from method RaiBlocklistItemsClient.Get. +type RaiBlocklistItemsClientGetResponse struct { + // Cognitive Services RaiBlocklist Item. + RaiBlocklistItem +} + +// RaiBlocklistItemsClientListResponse contains the response from method RaiBlocklistItemsClient.NewListPager. +type RaiBlocklistItemsClientListResponse struct { + // The list of cognitive services RAI Blocklist Items. + RaiBlockListItemsResult +} + +// RaiBlocklistsClientCreateOrUpdateResponse contains the response from method RaiBlocklistsClient.CreateOrUpdate. +type RaiBlocklistsClientCreateOrUpdateResponse struct { + // Cognitive Services RaiBlocklist. + RaiBlocklist +} + +// RaiBlocklistsClientDeleteResponse contains the response from method RaiBlocklistsClient.BeginDelete. +type RaiBlocklistsClientDeleteResponse struct { + // placeholder for future response values +} + +// RaiBlocklistsClientGetResponse contains the response from method RaiBlocklistsClient.Get. +type RaiBlocklistsClientGetResponse struct { + // Cognitive Services RaiBlocklist. + RaiBlocklist +} + +// RaiBlocklistsClientListResponse contains the response from method RaiBlocklistsClient.NewListPager. +type RaiBlocklistsClientListResponse struct { + // The list of cognitive services RAI Blocklists. + RaiBlockListResult +} + +// RaiContentFiltersClientListResponse contains the response from method RaiContentFiltersClient.List. +type RaiContentFiltersClientListResponse struct { + // The list of Content Filters. + RaiContentFilterListResult +} + +// RaiPoliciesClientCreateOrUpdateResponse contains the response from method RaiPoliciesClient.CreateOrUpdate. +type RaiPoliciesClientCreateOrUpdateResponse struct { + // Cognitive Services RaiPolicy. + RaiPolicy +} + +// RaiPoliciesClientDeleteResponse contains the response from method RaiPoliciesClient.BeginDelete. +type RaiPoliciesClientDeleteResponse struct { + // placeholder for future response values +} + +// RaiPoliciesClientGetResponse contains the response from method RaiPoliciesClient.Get. +type RaiPoliciesClientGetResponse struct { + // Cognitive Services RaiPolicy. + RaiPolicy +} + +// RaiPoliciesClientListResponse contains the response from method RaiPoliciesClient.NewListPager. +type RaiPoliciesClientListResponse struct { + // The list of cognitive services RaiPolicies. + RaiPolicyListResult +} + // ResourceSKUsClientListResponse contains the response from method ResourceSKUsClient.NewListPager. type ResourceSKUsClientListResponse struct { + // The Get Skus operation response. ResourceSKUListResult } // UsagesClientListResponse contains the response from method UsagesClient.NewListPager. type UsagesClientListResponse struct { + // The response to a list usage request. UsageListResult } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/time_rfc3339.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/time_rfc3339.go index f952597d4ac3..2ccc5dfe5354 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/time_rfc3339.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/time_rfc3339.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go index dbf6c88cd251..5ffd81776cd6 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armcognitiveservices @@ -46,7 +45,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListPager - Get usages for the requested subscription // -// Generated from API version 2023-05-01 +// Generated from API version 2023-10-01-preview // - 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] { @@ -93,7 +92,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-10-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client_example_test.go deleted file mode 100644 index 8c52dec67481..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client_example_test.go +++ /dev/null @@ -1,55 +0,0 @@ -//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), - // }}, - // } - } -}