diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md index 16efa8052f94..689211c51a89 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md @@ -1,5 +1,97 @@ # Release History +## 1.8.0 (2025-05-07) +### Features Added + +- New value `ProvisioningStateCanceled` added to enum type `ProvisioningState` +- New enum type `CapabilityHostKind` with values `CapabilityHostKindAgents` +- New enum type `CapabilityHostProvisioningState` with values `CapabilityHostProvisioningStateCanceled`, `CapabilityHostProvisioningStateCreating`, `CapabilityHostProvisioningStateDeleting`, `CapabilityHostProvisioningStateFailed`, `CapabilityHostProvisioningStateSucceeded`, `CapabilityHostProvisioningStateUpdating` +- New enum type `ConnectionAuthType` with values `ConnectionAuthTypeAAD`, `ConnectionAuthTypeAPIKey`, `ConnectionAuthTypeAccessKey`, `ConnectionAuthTypeAccountKey`, `ConnectionAuthTypeCustomKeys`, `ConnectionAuthTypeManagedIdentity`, `ConnectionAuthTypeNone`, `ConnectionAuthTypeOAuth2`, `ConnectionAuthTypePAT`, `ConnectionAuthTypeSAS`, `ConnectionAuthTypeServicePrincipal`, `ConnectionAuthTypeUsernamePassword` +- New enum type `ConnectionCategory` with values `ConnectionCategoryADLSGen2`, `ConnectionCategoryAIServices`, `ConnectionCategoryAPIKey`, `ConnectionCategoryAmazonMws`, `ConnectionCategoryAmazonRdsForOracle`, `ConnectionCategoryAmazonRdsForSQLServer`, `ConnectionCategoryAmazonRedshift`, `ConnectionCategoryAmazonS3Compatible`, `ConnectionCategoryAzureBlob`, `ConnectionCategoryAzureDataExplorer`, `ConnectionCategoryAzureDatabricksDeltaLake`, `ConnectionCategoryAzureMariaDb`, `ConnectionCategoryAzureMySQLDb`, `ConnectionCategoryAzureOneLake`, `ConnectionCategoryAzureOpenAI`, `ConnectionCategoryAzurePostgresDb`, `ConnectionCategoryAzureSQLDb`, `ConnectionCategoryAzureSQLMi`, `ConnectionCategoryAzureSynapseAnalytics`, `ConnectionCategoryAzureTableStorage`, `ConnectionCategoryBingLLMSearch`, `ConnectionCategoryCassandra`, `ConnectionCategoryCognitiveSearch`, `ConnectionCategoryCognitiveService`, `ConnectionCategoryConcur`, `ConnectionCategoryContainerRegistry`, `ConnectionCategoryCosmosDb`, `ConnectionCategoryCosmosDbMongoDbAPI`, `ConnectionCategoryCouchbase`, `ConnectionCategoryCustomKeys`, `ConnectionCategoryDb2`, `ConnectionCategoryDrill`, `ConnectionCategoryDynamics`, `ConnectionCategoryDynamicsAx`, `ConnectionCategoryDynamicsCrm`, `ConnectionCategoryElasticsearch`, `ConnectionCategoryEloqua`, `ConnectionCategoryFileServer`, `ConnectionCategoryFtpServer`, `ConnectionCategoryGenericContainerRegistry`, `ConnectionCategoryGenericHTTP`, `ConnectionCategoryGenericRest`, `ConnectionCategoryGit`, `ConnectionCategoryGoogleAdWords`, `ConnectionCategoryGoogleBigQuery`, `ConnectionCategoryGoogleCloudStorage`, `ConnectionCategoryGreenplum`, `ConnectionCategoryHbase`, `ConnectionCategoryHdfs`, `ConnectionCategoryHive`, `ConnectionCategoryHubspot`, `ConnectionCategoryImpala`, `ConnectionCategoryInformix`, `ConnectionCategoryJira`, `ConnectionCategoryMagento`, `ConnectionCategoryManagedOnlineEndpoint`, `ConnectionCategoryMariaDb`, `ConnectionCategoryMarketo`, `ConnectionCategoryMicrosoftAccess`, `ConnectionCategoryMongoDbAtlas`, `ConnectionCategoryMongoDbV2`, `ConnectionCategoryMySQL`, `ConnectionCategoryNetezza`, `ConnectionCategoryODataRest`, `ConnectionCategoryOdbc`, `ConnectionCategoryOffice365`, `ConnectionCategoryOpenAI`, `ConnectionCategoryOracle`, `ConnectionCategoryOracleCloudStorage`, `ConnectionCategoryOracleServiceCloud`, `ConnectionCategoryPayPal`, `ConnectionCategoryPhoenix`, `ConnectionCategoryPinecone`, `ConnectionCategoryPostgreSQL`, `ConnectionCategoryPresto`, `ConnectionCategoryPythonFeed`, `ConnectionCategoryQuickBooks`, `ConnectionCategoryRedis`, `ConnectionCategoryResponsys`, `ConnectionCategoryS3`, `ConnectionCategorySQLServer`, `ConnectionCategorySalesforce`, `ConnectionCategorySalesforceMarketingCloud`, `ConnectionCategorySalesforceServiceCloud`, `ConnectionCategorySapBw`, `ConnectionCategorySapCloudForCustomer`, `ConnectionCategorySapEcc`, `ConnectionCategorySapHana`, `ConnectionCategorySapOpenHub`, `ConnectionCategorySapTable`, `ConnectionCategorySerp`, `ConnectionCategoryServerless`, `ConnectionCategoryServiceNow`, `ConnectionCategorySftp`, `ConnectionCategorySharePointOnlineList`, `ConnectionCategoryShopify`, `ConnectionCategorySnowflake`, `ConnectionCategorySpark`, `ConnectionCategorySquare`, `ConnectionCategorySybase`, `ConnectionCategoryTeradata`, `ConnectionCategoryVertica`, `ConnectionCategoryWebTable`, `ConnectionCategoryXero`, `ConnectionCategoryZoho` +- New enum type `ConnectionGroup` with values `ConnectionGroupAzure`, `ConnectionGroupAzureAI`, `ConnectionGroupDatabase`, `ConnectionGroupFile`, `ConnectionGroupGenericProtocol`, `ConnectionGroupNoSQL`, `ConnectionGroupServicesAndApps` +- New enum type `ManagedPERequirement` with values `ManagedPERequirementNotApplicable`, `ManagedPERequirementNotRequired`, `ManagedPERequirementRequired` +- New enum type `ManagedPEStatus` with values `ManagedPEStatusActive`, `ManagedPEStatusInactive`, `ManagedPEStatusNotApplicable` +- New enum type `ScenarioType` with values `ScenarioTypeAgent`, `ScenarioTypeNone` +- New function `*AADAuthTypeConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `*APIKeyAuthConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `*AccessKeyAuthTypeConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `NewAccountCapabilityHostsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccountCapabilityHostsClient, error)` +- New function `*AccountCapabilityHostsClient.BeginCreateOrUpdate(context.Context, string, string, string, CapabilityHost, *AccountCapabilityHostsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AccountCapabilityHostsClientCreateOrUpdateResponse], error)` +- New function `*AccountCapabilityHostsClient.BeginDelete(context.Context, string, string, string, *AccountCapabilityHostsClientBeginDeleteOptions) (*runtime.Poller[AccountCapabilityHostsClientDeleteResponse], error)` +- New function `*AccountCapabilityHostsClient.Get(context.Context, string, string, string, *AccountCapabilityHostsClientGetOptions) (AccountCapabilityHostsClientGetResponse, error)` +- New function `NewAccountConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccountConnectionsClient, error)` +- New function `*AccountConnectionsClient.Create(context.Context, string, string, string, *AccountConnectionsClientCreateOptions) (AccountConnectionsClientCreateResponse, error)` +- New function `*AccountConnectionsClient.Delete(context.Context, string, string, string, *AccountConnectionsClientDeleteOptions) (AccountConnectionsClientDeleteResponse, error)` +- New function `*AccountConnectionsClient.Get(context.Context, string, string, string, *AccountConnectionsClientGetOptions) (AccountConnectionsClientGetResponse, error)` +- New function `*AccountConnectionsClient.NewListPager(string, string, *AccountConnectionsClientListOptions) *runtime.Pager[AccountConnectionsClientListResponse]` +- New function `*AccountConnectionsClient.Update(context.Context, string, string, string, *AccountConnectionsClientUpdateOptions) (AccountConnectionsClientUpdateResponse, error)` +- New function `*AccountKeyAuthTypeConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `*ClientFactory.NewAccountCapabilityHostsClient() *AccountCapabilityHostsClient` +- New function `*ClientFactory.NewAccountConnectionsClient() *AccountConnectionsClient` +- New function `*ClientFactory.NewProjectCapabilityHostsClient() *ProjectCapabilityHostsClient` +- New function `*ClientFactory.NewProjectConnectionsClient() *ProjectConnectionsClient` +- New function `*ClientFactory.NewProjectsClient() *ProjectsClient` +- New function `*ConnectionPropertiesV2.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `*CustomKeysConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `*ManagedIdentityAuthTypeConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `*OAuth2AuthTypeConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `*PATAuthTypeConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `NewProjectCapabilityHostsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProjectCapabilityHostsClient, error)` +- New function `*ProjectCapabilityHostsClient.BeginCreateOrUpdate(context.Context, string, string, string, string, CapabilityHost, *ProjectCapabilityHostsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ProjectCapabilityHostsClientCreateOrUpdateResponse], error)` +- New function `*ProjectCapabilityHostsClient.BeginDelete(context.Context, string, string, string, string, *ProjectCapabilityHostsClientBeginDeleteOptions) (*runtime.Poller[ProjectCapabilityHostsClientDeleteResponse], error)` +- New function `*ProjectCapabilityHostsClient.Get(context.Context, string, string, string, string, *ProjectCapabilityHostsClientGetOptions) (ProjectCapabilityHostsClientGetResponse, error)` +- New function `NewProjectConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProjectConnectionsClient, error)` +- New function `*ProjectConnectionsClient.Create(context.Context, string, string, string, string, *ProjectConnectionsClientCreateOptions) (ProjectConnectionsClientCreateResponse, error)` +- New function `*ProjectConnectionsClient.Delete(context.Context, string, string, string, string, *ProjectConnectionsClientDeleteOptions) (ProjectConnectionsClientDeleteResponse, error)` +- New function `*ProjectConnectionsClient.Get(context.Context, string, string, string, string, *ProjectConnectionsClientGetOptions) (ProjectConnectionsClientGetResponse, error)` +- New function `*ProjectConnectionsClient.NewListPager(string, string, string, *ProjectConnectionsClientListOptions) *runtime.Pager[ProjectConnectionsClientListResponse]` +- New function `*ProjectConnectionsClient.Update(context.Context, string, string, string, string, *ProjectConnectionsClientUpdateOptions) (ProjectConnectionsClientUpdateResponse, error)` +- New function `NewProjectsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProjectsClient, error)` +- New function `*ProjectsClient.BeginCreate(context.Context, string, string, string, Project, *ProjectsClientBeginCreateOptions) (*runtime.Poller[ProjectsClientCreateResponse], error)` +- New function `*ProjectsClient.BeginDelete(context.Context, string, string, string, *ProjectsClientBeginDeleteOptions) (*runtime.Poller[ProjectsClientDeleteResponse], error)` +- New function `*ProjectsClient.Get(context.Context, string, string, string, *ProjectsClientGetOptions) (ProjectsClientGetResponse, error)` +- New function `*ProjectsClient.NewListPager(string, string, *ProjectsClientListOptions) *runtime.Pager[ProjectsClientListResponse]` +- New function `*ProjectsClient.BeginUpdate(context.Context, string, string, string, Project, *ProjectsClientBeginUpdateOptions) (*runtime.Poller[ProjectsClientUpdateResponse], error)` +- New function `*SASAuthTypeConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `*ServicePrincipalAuthTypeConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `*UsernamePasswordAuthTypeConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New function `*NoneAuthTypeConnectionProperties.GetConnectionPropertiesV2() *ConnectionPropertiesV2` +- New struct `AADAuthTypeConnectionProperties` +- New struct `APIKeyAuthConnectionProperties` +- New struct `AccessKeyAuthTypeConnectionProperties` +- New struct `AccountKeyAuthTypeConnectionProperties` +- New struct `CapabilityHost` +- New struct `CapabilityHostProperties` +- New struct `ConnectionAPIKey` +- New struct `ConnectionAccessKey` +- New struct `ConnectionAccountKey` +- New struct `ConnectionManagedIdentity` +- New struct `ConnectionOAuth2` +- New struct `ConnectionPersonalAccessToken` +- New struct `ConnectionPropertiesV2BasicResource` +- New struct `ConnectionPropertiesV2BasicResourceArmPaginatedResult` +- New struct `ConnectionServicePrincipal` +- New struct `ConnectionSharedAccessSignature` +- New struct `ConnectionUpdateContent` +- New struct `ConnectionUsernamePassword` +- New struct `CustomKeys` +- New struct `CustomKeysConnectionProperties` +- New struct `ManagedIdentityAuthTypeConnectionProperties` +- New struct `NetworkInjections` +- New struct `NoneAuthTypeConnectionProperties` +- New struct `OAuth2AuthTypeConnectionProperties` +- New struct `PATAuthTypeConnectionProperties` +- New struct `Project` +- New struct `ProjectListResult` +- New struct `ProjectProperties` +- New struct `ResourceBase` +- New struct `SASAuthTypeConnectionProperties` +- New struct `ServicePrincipalAuthTypeConnectionProperties` +- New struct `UsernamePasswordAuthTypeConnectionProperties` +- New field `AllowProjectManagement`, `AssociatedProjects`, `DefaultProject`, `NetworkInjections` in struct `AccountProperties` +- New field `SpilloverDeploymentName` in struct `DeploymentProperties` + + ## 1.7.0 (2024-12-27) ### Features Added diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/README.md b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/README.md index 9f64832c15b4..b3eab02e5247 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/README.md +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/README.md @@ -55,7 +55,7 @@ clientFactory, err := armcognitiveservices.NewClientFactory(, c A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewAccountsClient() +client := clientFactory.NewAccountCapabilityHostsClient() ``` ## Fakes diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountcapabilityhosts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountcapabilityhosts_client.go new file mode 100644 index 000000000000..0f28fbce1725 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountcapabilityhosts_client.go @@ -0,0 +1,279 @@ +// 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" +) + +// AccountCapabilityHostsClient contains the methods for the AccountCapabilityHosts group. +// Don't use this type directly, use NewAccountCapabilityHostsClient() instead. +type AccountCapabilityHostsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccountCapabilityHostsClient creates a new instance of AccountCapabilityHostsClient 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 NewAccountCapabilityHostsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountCapabilityHostsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccountCapabilityHostsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update account capabilityHost. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - capabilityHostName - The name of the capability host associated with the Cognitive Services Resource +// - capabilityHost - CapabilityHost definition. +// - options - AccountCapabilityHostsClientBeginCreateOrUpdateOptions contains the optional parameters for the AccountCapabilityHostsClient.BeginCreateOrUpdate +// method. +func (client *AccountCapabilityHostsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, capabilityHostName string, capabilityHost CapabilityHost, options *AccountCapabilityHostsClientBeginCreateOrUpdateOptions) (*runtime.Poller[AccountCapabilityHostsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, capabilityHostName, capabilityHost, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountCapabilityHostsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaOriginalURI, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AccountCapabilityHostsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update account capabilityHost. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +func (client *AccountCapabilityHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, capabilityHostName string, capabilityHost CapabilityHost, options *AccountCapabilityHostsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AccountCapabilityHostsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, capabilityHostName, capabilityHost, 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.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AccountCapabilityHostsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, capabilityHostName string, capabilityHost CapabilityHost, _ *AccountCapabilityHostsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 capabilityHostName == "" { + return nil, errors.New("parameter capabilityHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capabilityHostName}", url.PathEscape(capabilityHostName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, capabilityHost); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete account capabilityHost. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - capabilityHostName - The name of the capability host associated with the Cognitive Services Resource +// - options - AccountCapabilityHostsClientBeginDeleteOptions contains the optional parameters for the AccountCapabilityHostsClient.BeginDelete +// method. +func (client *AccountCapabilityHostsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, capabilityHostName string, options *AccountCapabilityHostsClientBeginDeleteOptions) (*runtime.Poller[AccountCapabilityHostsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, capabilityHostName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountCapabilityHostsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AccountCapabilityHostsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete account capabilityHost. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +func (client *AccountCapabilityHostsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, capabilityHostName string, options *AccountCapabilityHostsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AccountCapabilityHostsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, capabilityHostName, 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 *AccountCapabilityHostsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, capabilityHostName string, _ *AccountCapabilityHostsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 capabilityHostName == "" { + return nil, errors.New("parameter capabilityHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capabilityHostName}", url.PathEscape(capabilityHostName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get account capabilityHost. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - capabilityHostName - The name of the capability host associated with the Cognitive Services Resource +// - options - AccountCapabilityHostsClientGetOptions contains the optional parameters for the AccountCapabilityHostsClient.Get +// method. +func (client *AccountCapabilityHostsClient) Get(ctx context.Context, resourceGroupName string, accountName string, capabilityHostName string, options *AccountCapabilityHostsClientGetOptions) (AccountCapabilityHostsClientGetResponse, error) { + var err error + const operationName = "AccountCapabilityHostsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, capabilityHostName, options) + if err != nil { + return AccountCapabilityHostsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountCapabilityHostsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountCapabilityHostsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AccountCapabilityHostsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, capabilityHostName string, _ *AccountCapabilityHostsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 capabilityHostName == "" { + return nil, errors.New("parameter capabilityHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capabilityHostName}", url.PathEscape(capabilityHostName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AccountCapabilityHostsClient) getHandleResponse(resp *http.Response) (AccountCapabilityHostsClientGetResponse, error) { + result := AccountCapabilityHostsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapabilityHost); err != nil { + return AccountCapabilityHostsClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountconnections_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountconnections_client.go new file mode 100644 index 000000000000..08eaf3e2b87f --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountconnections_client.go @@ -0,0 +1,397 @@ +// 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" + "strconv" + "strings" +) + +// AccountConnectionsClient contains the methods for the AccountConnections group. +// Don't use this type directly, use NewAccountConnectionsClient() instead. +type AccountConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccountConnectionsClient creates a new instance of AccountConnectionsClient 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 NewAccountConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccountConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create or update Cognitive Services account connection under the specified account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - connectionName - Friendly name of the connection +// - options - AccountConnectionsClientCreateOptions contains the optional parameters for the AccountConnectionsClient.Create +// method. +func (client *AccountConnectionsClient) Create(ctx context.Context, resourceGroupName string, accountName string, connectionName string, options *AccountConnectionsClientCreateOptions) (AccountConnectionsClientCreateResponse, error) { + var err error + const operationName = "AccountConnectionsClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, connectionName, options) + if err != nil { + return AccountConnectionsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountConnectionsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountConnectionsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *AccountConnectionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, connectionName string, options *AccountConnectionsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Connection != nil { + if err := runtime.MarshalAsJSON(req, *options.Connection); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *AccountConnectionsClient) createHandleResponse(resp *http.Response) (AccountConnectionsClientCreateResponse, error) { + result := AccountConnectionsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionPropertiesV2BasicResource); err != nil { + return AccountConnectionsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete Cognitive Services account connection by name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - connectionName - Friendly name of the connection +// - options - AccountConnectionsClientDeleteOptions contains the optional parameters for the AccountConnectionsClient.Delete +// method. +func (client *AccountConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, connectionName string, options *AccountConnectionsClientDeleteOptions) (AccountConnectionsClientDeleteResponse, error) { + var err error + const operationName = "AccountConnectionsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, connectionName, options) + if err != nil { + return AccountConnectionsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountConnectionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return AccountConnectionsClientDeleteResponse{}, err + } + return AccountConnectionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AccountConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, connectionName string, _ *AccountConnectionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Lists Cognitive Services account connection by name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - connectionName - Friendly name of the connection +// - options - AccountConnectionsClientGetOptions contains the optional parameters for the AccountConnectionsClient.Get method. +func (client *AccountConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, connectionName string, options *AccountConnectionsClientGetOptions) (AccountConnectionsClientGetResponse, error) { + var err error + const operationName = "AccountConnectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, connectionName, options) + if err != nil { + return AccountConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AccountConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, connectionName string, _ *AccountConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AccountConnectionsClient) getHandleResponse(resp *http.Response) (AccountConnectionsClientGetResponse, error) { + result := AccountConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionPropertiesV2BasicResource); err != nil { + return AccountConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the available Cognitive Services account connections under the specified account. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - options - AccountConnectionsClientListOptions contains the optional parameters for the AccountConnectionsClient.NewListPager +// method. +func (client *AccountConnectionsClient) NewListPager(resourceGroupName string, accountName string, options *AccountConnectionsClientListOptions) *runtime.Pager[AccountConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccountConnectionsClientListResponse]{ + More: func(page AccountConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccountConnectionsClientListResponse) (AccountConnectionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AccountConnectionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return AccountConnectionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *AccountConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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)) + 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", "2025-06-01") + if options != nil && options.Category != nil { + reqQP.Set("category", *options.Category) + } + if options != nil && options.IncludeAll != nil { + reqQP.Set("includeAll", strconv.FormatBool(*options.IncludeAll)) + } + if options != nil && options.Target != nil { + reqQP.Set("target", *options.Target) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccountConnectionsClient) listHandleResponse(resp *http.Response) (AccountConnectionsClientListResponse, error) { + result := AccountConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionPropertiesV2BasicResourceArmPaginatedResult); err != nil { + return AccountConnectionsClientListResponse{}, err + } + return result, nil +} + +// Update - Update Cognitive Services account connection under the specified account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - connectionName - Friendly name of the connection +// - options - AccountConnectionsClientUpdateOptions contains the optional parameters for the AccountConnectionsClient.Update +// method. +func (client *AccountConnectionsClient) Update(ctx context.Context, resourceGroupName string, accountName string, connectionName string, options *AccountConnectionsClientUpdateOptions) (AccountConnectionsClientUpdateResponse, error) { + var err error + const operationName = "AccountConnectionsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, connectionName, options) + if err != nil { + return AccountConnectionsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountConnectionsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountConnectionsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *AccountConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, connectionName string, options *AccountConnectionsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Connection != nil { + if err := runtime.MarshalAsJSON(req, *options.Connection); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *AccountConnectionsClient) updateHandleResponse(resp *http.Response) (AccountConnectionsClientUpdateResponse, error) { + result := AccountConnectionsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionPropertiesV2BasicResource); err != nil { + return AccountConnectionsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go index 173f3f8fb4d8..3435f7e401ed 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go @@ -1,6 +1,3 @@ -//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. @@ -47,7 +44,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 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - account - The parameters to provide for the created account. @@ -73,7 +70,7 @@ func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName // to access intelligent APIs. It's also the resource type for billing. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *AccountsClient) create(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginCreate" @@ -96,7 +93,7 @@ func (client *AccountsClient) create(ctx context.Context, resourceGroupName stri } // createCreateRequest creates the Create request. -func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginCreateOptions) (*policy.Request, error) { +func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, account Account, _ *AccountsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -115,7 +112,7 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, account); err != nil { @@ -127,7 +124,7 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Deletes a Cognitive Services account from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. @@ -151,7 +148,7 @@ func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a Cognitive Services account from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginDelete" @@ -174,7 +171,7 @@ func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroup } // deleteCreateRequest creates the Delete request. -func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *AccountsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -193,7 +190,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +199,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Returns a Cognitive Services account specified by the parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. @@ -229,7 +226,7 @@ func (client *AccountsClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientGetOptions) (*policy.Request, error) { +func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *AccountsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -248,7 +245,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +262,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 2024-10-01 +// Generated from API version 2025-06-01 // - options - AccountsClientListOptions contains the optional parameters for the AccountsClient.NewListPager method. func (client *AccountsClient) NewListPager(options *AccountsClientListOptions) *runtime.Pager[AccountsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[AccountsClientListResponse]{ @@ -291,7 +288,7 @@ func (client *AccountsClient) NewListPager(options *AccountsClientListOptions) * } // listCreateRequest creates the List request. -func (client *AccountsClient) listCreateRequest(ctx context.Context, options *AccountsClientListOptions) (*policy.Request, error) { +func (client *AccountsClient) listCreateRequest(ctx context.Context, _ *AccountsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -302,7 +299,7 @@ func (client *AccountsClient) listCreateRequest(ctx context.Context, options *Ac return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -319,7 +316,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 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager // method. @@ -347,7 +344,7 @@ func (client *AccountsClient) NewListByResourceGroupPager(resourceGroupName stri } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AccountsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AccountsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -362,7 +359,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -380,7 +377,7 @@ func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Respo // ListKeys - Lists the account keys for the specified Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListKeysOptions contains the optional parameters for the AccountsClient.ListKeys method. @@ -407,7 +404,7 @@ func (client *AccountsClient) ListKeys(ctx context.Context, resourceGroupName st } // listKeysCreateRequest creates the ListKeys request. -func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientListKeysOptions) (*policy.Request, error) { +func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *AccountsClientListKeysOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/listKeys" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -426,7 +423,7 @@ func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -443,7 +440,7 @@ func (client *AccountsClient) listKeysHandleResponse(resp *http.Response) (Accou // NewListModelsPager - List available Models for the requested Cognitive Services account // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListModelsOptions contains the optional parameters for the AccountsClient.NewListModelsPager method. @@ -471,7 +468,7 @@ func (client *AccountsClient) NewListModelsPager(resourceGroupName string, accou } // listModelsCreateRequest creates the ListModels request. -func (client *AccountsClient) listModelsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientListModelsOptions) (*policy.Request, error) { +func (client *AccountsClient) listModelsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *AccountsClientListModelsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/models" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -490,7 +487,7 @@ func (client *AccountsClient) listModelsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -508,7 +505,7 @@ func (client *AccountsClient) listModelsHandleResponse(resp *http.Response) (Acc // ListSKUs - List available SKUs for the requested Cognitive Services account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListSKUsOptions contains the optional parameters for the AccountsClient.ListSKUs method. @@ -535,7 +532,7 @@ func (client *AccountsClient) ListSKUs(ctx context.Context, resourceGroupName st } // listSKUsCreateRequest creates the ListSKUs request. -func (client *AccountsClient) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientListSKUsOptions) (*policy.Request, error) { +func (client *AccountsClient) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *AccountsClientListSKUsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -554,7 +551,7 @@ func (client *AccountsClient) listSKUsCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -572,7 +569,7 @@ func (client *AccountsClient) listSKUsHandleResponse(resp *http.Response) (Accou // ListUsages - Get usages for the requested Cognitive Services account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListUsagesOptions contains the optional parameters for the AccountsClient.ListUsages method. @@ -621,7 +618,7 @@ func (client *AccountsClient) listUsagesCreateRequest(ctx context.Context, resou if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -639,7 +636,7 @@ func (client *AccountsClient) listUsagesHandleResponse(resp *http.Response) (Acc // RegenerateKey - Regenerates the specified account key for the specified Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - parameters - regenerate key parameters. @@ -667,7 +664,7 @@ func (client *AccountsClient) RegenerateKey(ctx context.Context, resourceGroupNa } // regenerateKeyCreateRequest creates the RegenerateKey request. -func (client *AccountsClient) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters RegenerateKeyParameters, options *AccountsClientRegenerateKeyOptions) (*policy.Request, error) { +func (client *AccountsClient) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters RegenerateKeyParameters, _ *AccountsClientRegenerateKeyOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -686,7 +683,7 @@ func (client *AccountsClient) regenerateKeyCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -707,7 +704,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 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - account - The parameters to provide for the created account. @@ -732,7 +729,7 @@ func (client *AccountsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates a Cognitive Services account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *AccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginUpdate" @@ -755,7 +752,7 @@ func (client *AccountsClient) update(ctx context.Context, resourceGroupName stri } // updateCreateRequest creates the Update request. -func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, account Account, options *AccountsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, account Account, _ *AccountsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -774,7 +771,7 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, account); err != 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 8d06db6f7ed3..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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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 a08ac854ee45..1f495a621f73 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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/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.7.0 -tag: package-2024-10 +module-version: 1.8.0 ``` \ 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 c3644d9152ed..af175ce70164 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go @@ -1,6 +1,3 @@ -//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. @@ -36,6 +33,22 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } +// NewAccountCapabilityHostsClient creates a new instance of AccountCapabilityHostsClient. +func (c *ClientFactory) NewAccountCapabilityHostsClient() *AccountCapabilityHostsClient { + return &AccountCapabilityHostsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewAccountConnectionsClient creates a new instance of AccountConnectionsClient. +func (c *ClientFactory) NewAccountConnectionsClient() *AccountConnectionsClient { + return &AccountConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewAccountsClient creates a new instance of AccountsClient. func (c *ClientFactory) NewAccountsClient() *AccountsClient { return &AccountsClient{ @@ -155,6 +168,30 @@ func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesCli } } +// NewProjectCapabilityHostsClient creates a new instance of ProjectCapabilityHostsClient. +func (c *ClientFactory) NewProjectCapabilityHostsClient() *ProjectCapabilityHostsClient { + return &ProjectCapabilityHostsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewProjectConnectionsClient creates a new instance of ProjectConnectionsClient. +func (c *ClientFactory) NewProjectConnectionsClient() *ProjectConnectionsClient { + return &ProjectConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewProjectsClient creates a new instance of ProjectsClient. +func (c *ClientFactory) NewProjectsClient() *ProjectsClient { + return &ProjectsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewRaiBlocklistItemsClient creates a new instance of RaiBlocklistItemsClient. func (c *ClientFactory) NewRaiBlocklistItemsClient() *RaiBlocklistItemsClient { return &RaiBlocklistItemsClient{ diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go index e3c1f3b2e0b5..cb5cb85f02f5 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,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 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account @@ -76,7 +73,7 @@ func (client *CommitmentPlansClient) CreateOrUpdate(ctx context.Context, resourc } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CommitmentPlansClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, commitmentPlan CommitmentPlan, options *CommitmentPlansClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, commitmentPlan CommitmentPlan, _ *CommitmentPlansClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -99,7 +96,7 @@ func (client *CommitmentPlansClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, commitmentPlan); err != nil { @@ -120,7 +117,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 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlanAssociationName - The name of the commitment plan association with the Cognitive Services Account @@ -148,7 +145,7 @@ func (client *CommitmentPlansClient) BeginCreateOrUpdateAssociation(ctx context. // CreateOrUpdateAssociation - Create or update the association of the Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *CommitmentPlansClient) createOrUpdateAssociation(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, association CommitmentPlanAccountAssociation, options *CommitmentPlansClientBeginCreateOrUpdateAssociationOptions) (*http.Response, error) { var err error const operationName = "CommitmentPlansClient.BeginCreateOrUpdateAssociation" @@ -171,7 +168,7 @@ func (client *CommitmentPlansClient) createOrUpdateAssociation(ctx context.Conte } // createOrUpdateAssociationCreateRequest creates the CreateOrUpdateAssociation request. -func (client *CommitmentPlansClient) createOrUpdateAssociationCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, association CommitmentPlanAccountAssociation, options *CommitmentPlansClientBeginCreateOrUpdateAssociationOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) createOrUpdateAssociationCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, association CommitmentPlanAccountAssociation, _ *CommitmentPlansClientBeginCreateOrUpdateAssociationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -194,7 +191,7 @@ func (client *CommitmentPlansClient) createOrUpdateAssociationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, association); err != nil { @@ -206,7 +203,7 @@ func (client *CommitmentPlansClient) createOrUpdateAssociationCreateRequest(ctx // BeginCreateOrUpdatePlan - Create Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlan - The parameters to provide for the created commitment plan. @@ -233,7 +230,7 @@ func (client *CommitmentPlansClient) BeginCreateOrUpdatePlan(ctx context.Context // CreateOrUpdatePlan - Create Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *CommitmentPlansClient) createOrUpdatePlan(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlan CommitmentPlan, options *CommitmentPlansClientBeginCreateOrUpdatePlanOptions) (*http.Response, error) { var err error const operationName = "CommitmentPlansClient.BeginCreateOrUpdatePlan" @@ -256,7 +253,7 @@ func (client *CommitmentPlansClient) createOrUpdatePlan(ctx context.Context, res } // createOrUpdatePlanCreateRequest creates the CreateOrUpdatePlan request. -func (client *CommitmentPlansClient) createOrUpdatePlanCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlan CommitmentPlan, options *CommitmentPlansClientBeginCreateOrUpdatePlanOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) createOrUpdatePlanCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlan CommitmentPlan, _ *CommitmentPlansClientBeginCreateOrUpdatePlanOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -275,7 +272,7 @@ func (client *CommitmentPlansClient) createOrUpdatePlanCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, commitmentPlan); err != nil { @@ -287,7 +284,7 @@ func (client *CommitmentPlansClient) createOrUpdatePlanCreateRequest(ctx context // BeginDelete - Deletes the specified commitmentPlan associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account @@ -313,7 +310,7 @@ func (client *CommitmentPlansClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deletes the specified commitmentPlan associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *CommitmentPlansClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, options *CommitmentPlansClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CommitmentPlansClient.BeginDelete" @@ -336,7 +333,7 @@ func (client *CommitmentPlansClient) deleteOperation(ctx context.Context, resour } // deleteCreateRequest creates the Delete request. -func (client *CommitmentPlansClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, options *CommitmentPlansClientBeginDeleteOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, _ *CommitmentPlansClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -359,7 +356,7 @@ func (client *CommitmentPlansClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -368,7 +365,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 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlanAssociationName - The name of the commitment plan association with the Cognitive Services Account @@ -395,7 +392,7 @@ func (client *CommitmentPlansClient) BeginDeleteAssociation(ctx context.Context, // DeleteAssociation - Deletes the association of the Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *CommitmentPlansClient) deleteAssociation(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, options *CommitmentPlansClientBeginDeleteAssociationOptions) (*http.Response, error) { var err error const operationName = "CommitmentPlansClient.BeginDeleteAssociation" @@ -418,7 +415,7 @@ func (client *CommitmentPlansClient) deleteAssociation(ctx context.Context, reso } // deleteAssociationCreateRequest creates the DeleteAssociation request. -func (client *CommitmentPlansClient) deleteAssociationCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, options *CommitmentPlansClientBeginDeleteAssociationOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) deleteAssociationCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, _ *CommitmentPlansClientBeginDeleteAssociationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -441,7 +438,7 @@ func (client *CommitmentPlansClient) deleteAssociationCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -450,7 +447,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 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - options - CommitmentPlansClientBeginDeletePlanOptions contains the optional parameters for the CommitmentPlansClient.BeginDeletePlan @@ -476,7 +473,7 @@ func (client *CommitmentPlansClient) BeginDeletePlan(ctx context.Context, resour // DeletePlan - Deletes a Cognitive Services commitment plan from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *CommitmentPlansClient) deletePlan(ctx context.Context, resourceGroupName string, commitmentPlanName string, options *CommitmentPlansClientBeginDeletePlanOptions) (*http.Response, error) { var err error const operationName = "CommitmentPlansClient.BeginDeletePlan" @@ -499,7 +496,7 @@ func (client *CommitmentPlansClient) deletePlan(ctx context.Context, resourceGro } // deletePlanCreateRequest creates the DeletePlan request. -func (client *CommitmentPlansClient) deletePlanCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, options *CommitmentPlansClientBeginDeletePlanOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) deletePlanCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, _ *CommitmentPlansClientBeginDeletePlanOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -518,7 +515,7 @@ func (client *CommitmentPlansClient) deletePlanCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -527,7 +524,7 @@ func (client *CommitmentPlansClient) deletePlanCreateRequest(ctx context.Context // Get - Gets the specified commitmentPlans associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account @@ -555,7 +552,7 @@ func (client *CommitmentPlansClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *CommitmentPlansClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, options *CommitmentPlansClientGetOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, _ *CommitmentPlansClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -578,7 +575,7 @@ func (client *CommitmentPlansClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -596,7 +593,7 @@ func (client *CommitmentPlansClient) getHandleResponse(resp *http.Response) (Com // GetAssociation - Gets the association of the Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlanAssociationName - The name of the commitment plan association with the Cognitive Services Account @@ -625,7 +622,7 @@ func (client *CommitmentPlansClient) GetAssociation(ctx context.Context, resourc } // getAssociationCreateRequest creates the GetAssociation request. -func (client *CommitmentPlansClient) getAssociationCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, options *CommitmentPlansClientGetAssociationOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) getAssociationCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlanAssociationName string, _ *CommitmentPlansClientGetAssociationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -648,7 +645,7 @@ func (client *CommitmentPlansClient) getAssociationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -666,7 +663,7 @@ func (client *CommitmentPlansClient) getAssociationHandleResponse(resp *http.Res // GetPlan - Returns a Cognitive Services commitment plan specified by the parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - options - CommitmentPlansClientGetPlanOptions contains the optional parameters for the CommitmentPlansClient.GetPlan method. @@ -693,7 +690,7 @@ func (client *CommitmentPlansClient) GetPlan(ctx context.Context, resourceGroupN } // getPlanCreateRequest creates the GetPlan request. -func (client *CommitmentPlansClient) getPlanCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, options *CommitmentPlansClientGetPlanOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) getPlanCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, _ *CommitmentPlansClientGetPlanOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -712,7 +709,7 @@ func (client *CommitmentPlansClient) getPlanCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -729,7 +726,7 @@ func (client *CommitmentPlansClient) getPlanHandleResponse(resp *http.Response) // NewListPager - Gets the commitmentPlans associated with the Cognitive Services account. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - CommitmentPlansClientListOptions contains the optional parameters for the CommitmentPlansClient.NewListPager @@ -758,7 +755,7 @@ func (client *CommitmentPlansClient) NewListPager(resourceGroupName string, acco } // listCreateRequest creates the List request. -func (client *CommitmentPlansClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *CommitmentPlansClientListOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *CommitmentPlansClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -777,7 +774,7 @@ func (client *CommitmentPlansClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -794,7 +791,7 @@ func (client *CommitmentPlansClient) listHandleResponse(resp *http.Response) (Co // NewListAssociationsPager - Gets the associations of the Cognitive Services commitment plan. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - options - CommitmentPlansClientListAssociationsOptions contains the optional parameters for the CommitmentPlansClient.NewListAssociationsPager @@ -823,7 +820,7 @@ func (client *CommitmentPlansClient) NewListAssociationsPager(resourceGroupName } // listAssociationsCreateRequest creates the ListAssociations request. -func (client *CommitmentPlansClient) listAssociationsCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, options *CommitmentPlansClientListAssociationsOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) listAssociationsCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, _ *CommitmentPlansClientListAssociationsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -842,7 +839,7 @@ func (client *CommitmentPlansClient) listAssociationsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -859,7 +856,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 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CommitmentPlansClientListPlansByResourceGroupOptions contains the optional parameters for the CommitmentPlansClient.NewListPlansByResourceGroupPager // method. @@ -887,7 +884,7 @@ func (client *CommitmentPlansClient) NewListPlansByResourceGroupPager(resourceGr } // listPlansByResourceGroupCreateRequest creates the ListPlansByResourceGroup request. -func (client *CommitmentPlansClient) listPlansByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CommitmentPlansClientListPlansByResourceGroupOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) listPlansByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *CommitmentPlansClientListPlansByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -902,7 +899,7 @@ func (client *CommitmentPlansClient) listPlansByResourceGroupCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -919,7 +916,7 @@ func (client *CommitmentPlansClient) listPlansByResourceGroupHandleResponse(resp // NewListPlansBySubscriptionPager - Returns all the resources of a particular type belonging to a subscription. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - options - CommitmentPlansClientListPlansBySubscriptionOptions contains the optional parameters for the CommitmentPlansClient.NewListPlansBySubscriptionPager // method. func (client *CommitmentPlansClient) NewListPlansBySubscriptionPager(options *CommitmentPlansClientListPlansBySubscriptionOptions) *runtime.Pager[CommitmentPlansClientListPlansBySubscriptionResponse] { @@ -946,7 +943,7 @@ func (client *CommitmentPlansClient) NewListPlansBySubscriptionPager(options *Co } // listPlansBySubscriptionCreateRequest creates the ListPlansBySubscription request. -func (client *CommitmentPlansClient) listPlansBySubscriptionCreateRequest(ctx context.Context, options *CommitmentPlansClientListPlansBySubscriptionOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) listPlansBySubscriptionCreateRequest(ctx context.Context, _ *CommitmentPlansClientListPlansBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/commitmentPlans" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -957,7 +954,7 @@ func (client *CommitmentPlansClient) listPlansBySubscriptionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -975,7 +972,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 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlan - The parameters to provide for the created commitment plan. @@ -1002,7 +999,7 @@ func (client *CommitmentPlansClient) BeginUpdatePlan(ctx context.Context, resour // UpdatePlan - Create Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *CommitmentPlansClient) updatePlan(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlan PatchResourceTagsAndSKU, options *CommitmentPlansClientBeginUpdatePlanOptions) (*http.Response, error) { var err error const operationName = "CommitmentPlansClient.BeginUpdatePlan" @@ -1025,7 +1022,7 @@ func (client *CommitmentPlansClient) updatePlan(ctx context.Context, resourceGro } // updatePlanCreateRequest creates the UpdatePlan request. -func (client *CommitmentPlansClient) updatePlanCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlan PatchResourceTagsAndSKU, options *CommitmentPlansClientBeginUpdatePlanOptions) (*policy.Request, error) { +func (client *CommitmentPlansClient) updatePlanCreateRequest(ctx context.Context, resourceGroupName string, commitmentPlanName string, commitmentPlan PatchResourceTagsAndSKU, _ *CommitmentPlansClientBeginUpdatePlanOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1044,7 +1041,7 @@ func (client *CommitmentPlansClient) updatePlanCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, commitmentPlan); err != 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 4964d82ca8de..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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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 8d1078d9b168..d2d5ec51f3ec 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go @@ -1,6 +1,3 @@ -//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. @@ -45,7 +42,7 @@ func NewCommitmentTiersClient(subscriptionID string, credential azcore.TokenCred // NewListPager - List Commitment Tiers. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - location - Resource location. // - options - CommitmentTiersClientListOptions contains the optional parameters for the CommitmentTiersClient.NewListPager // method. @@ -73,7 +70,7 @@ func (client *CommitmentTiersClient) NewListPager(location string, options *Comm } // listCreateRequest creates the List request. -func (client *CommitmentTiersClient) listCreateRequest(ctx context.Context, location string, options *CommitmentTiersClientListOptions) (*policy.Request, error) { +func (client *CommitmentTiersClient) listCreateRequest(ctx context.Context, location string, _ *CommitmentTiersClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/commitmentTiers" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -88,7 +85,7 @@ func (client *CommitmentTiersClient) listCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client_example_test.go deleted file mode 100644 index b6be3ebb3f94..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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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 9cf5b2560a02..de6642fe5dc6 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go @@ -1,6 +1,3 @@ -//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. @@ -10,7 +7,7 @@ package armcognitiveservices const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" - moduleVersion = "v1.7.0" + moduleVersion = "v1.8.0" ) // AbusePenaltyAction - The action of AbusePenalty. @@ -59,6 +56,43 @@ func PossibleByPassSelectionValues() []ByPassSelection { } } +type CapabilityHostKind string + +const ( + CapabilityHostKindAgents CapabilityHostKind = "Agents" +) + +// PossibleCapabilityHostKindValues returns the possible values for the CapabilityHostKind const type. +func PossibleCapabilityHostKindValues() []CapabilityHostKind { + return []CapabilityHostKind{ + CapabilityHostKindAgents, + } +} + +// CapabilityHostProvisioningState - Provisioning state of capability host. +type CapabilityHostProvisioningState string + +const ( + CapabilityHostProvisioningStateCanceled CapabilityHostProvisioningState = "Canceled" + CapabilityHostProvisioningStateCreating CapabilityHostProvisioningState = "Creating" + CapabilityHostProvisioningStateDeleting CapabilityHostProvisioningState = "Deleting" + CapabilityHostProvisioningStateFailed CapabilityHostProvisioningState = "Failed" + CapabilityHostProvisioningStateSucceeded CapabilityHostProvisioningState = "Succeeded" + CapabilityHostProvisioningStateUpdating CapabilityHostProvisioningState = "Updating" +) + +// PossibleCapabilityHostProvisioningStateValues returns the possible values for the CapabilityHostProvisioningState const type. +func PossibleCapabilityHostProvisioningStateValues() []CapabilityHostProvisioningState { + return []CapabilityHostProvisioningState{ + CapabilityHostProvisioningStateCanceled, + CapabilityHostProvisioningStateCreating, + CapabilityHostProvisioningStateDeleting, + CapabilityHostProvisioningStateFailed, + CapabilityHostProvisioningStateSucceeded, + CapabilityHostProvisioningStateUpdating, + } +} + // CommitmentPlanProvisioningState - Gets the status of the resource at the time the operation was called. type CommitmentPlanProvisioningState string @@ -85,6 +119,290 @@ func PossibleCommitmentPlanProvisioningStateValues() []CommitmentPlanProvisionin } } +// ConnectionAuthType - Authentication type of the connection target +type ConnectionAuthType string + +const ( + ConnectionAuthTypeAAD ConnectionAuthType = "AAD" + ConnectionAuthTypeAPIKey ConnectionAuthType = "ApiKey" + ConnectionAuthTypeAccessKey ConnectionAuthType = "AccessKey" + ConnectionAuthTypeAccountKey ConnectionAuthType = "AccountKey" + ConnectionAuthTypeCustomKeys ConnectionAuthType = "CustomKeys" + ConnectionAuthTypeManagedIdentity ConnectionAuthType = "ManagedIdentity" + ConnectionAuthTypeNone ConnectionAuthType = "None" + ConnectionAuthTypeOAuth2 ConnectionAuthType = "OAuth2" + ConnectionAuthTypePAT ConnectionAuthType = "PAT" + ConnectionAuthTypeSAS ConnectionAuthType = "SAS" + ConnectionAuthTypeServicePrincipal ConnectionAuthType = "ServicePrincipal" + ConnectionAuthTypeUsernamePassword ConnectionAuthType = "UsernamePassword" +) + +// PossibleConnectionAuthTypeValues returns the possible values for the ConnectionAuthType const type. +func PossibleConnectionAuthTypeValues() []ConnectionAuthType { + return []ConnectionAuthType{ + ConnectionAuthTypeAAD, + ConnectionAuthTypeAPIKey, + ConnectionAuthTypeAccessKey, + ConnectionAuthTypeAccountKey, + ConnectionAuthTypeCustomKeys, + ConnectionAuthTypeManagedIdentity, + ConnectionAuthTypeNone, + ConnectionAuthTypeOAuth2, + ConnectionAuthTypePAT, + ConnectionAuthTypeSAS, + ConnectionAuthTypeServicePrincipal, + ConnectionAuthTypeUsernamePassword, + } +} + +// ConnectionCategory - Category of the connection +type ConnectionCategory string + +const ( + ConnectionCategoryADLSGen2 ConnectionCategory = "ADLSGen2" + ConnectionCategoryAIServices ConnectionCategory = "AIServices" + ConnectionCategoryAPIKey ConnectionCategory = "ApiKey" + ConnectionCategoryAmazonMws ConnectionCategory = "AmazonMws" + ConnectionCategoryAmazonRdsForOracle ConnectionCategory = "AmazonRdsForOracle" + ConnectionCategoryAmazonRdsForSQLServer ConnectionCategory = "AmazonRdsForSqlServer" + ConnectionCategoryAmazonRedshift ConnectionCategory = "AmazonRedshift" + ConnectionCategoryAmazonS3Compatible ConnectionCategory = "AmazonS3Compatible" + ConnectionCategoryAzureBlob ConnectionCategory = "AzureBlob" + ConnectionCategoryAzureDataExplorer ConnectionCategory = "AzureDataExplorer" + ConnectionCategoryAzureDatabricksDeltaLake ConnectionCategory = "AzureDatabricksDeltaLake" + ConnectionCategoryAzureMariaDb ConnectionCategory = "AzureMariaDb" + ConnectionCategoryAzureMySQLDb ConnectionCategory = "AzureMySqlDb" + ConnectionCategoryAzureOneLake ConnectionCategory = "AzureOneLake" + ConnectionCategoryAzureOpenAI ConnectionCategory = "AzureOpenAI" + ConnectionCategoryAzurePostgresDb ConnectionCategory = "AzurePostgresDb" + ConnectionCategoryAzureSQLDb ConnectionCategory = "AzureSqlDb" + ConnectionCategoryAzureSQLMi ConnectionCategory = "AzureSqlMi" + ConnectionCategoryAzureSynapseAnalytics ConnectionCategory = "AzureSynapseAnalytics" + ConnectionCategoryAzureTableStorage ConnectionCategory = "AzureTableStorage" + ConnectionCategoryBingLLMSearch ConnectionCategory = "BingLLMSearch" + ConnectionCategoryCassandra ConnectionCategory = "Cassandra" + ConnectionCategoryCognitiveSearch ConnectionCategory = "CognitiveSearch" + ConnectionCategoryCognitiveService ConnectionCategory = "CognitiveService" + ConnectionCategoryConcur ConnectionCategory = "Concur" + ConnectionCategoryContainerRegistry ConnectionCategory = "ContainerRegistry" + ConnectionCategoryCosmosDb ConnectionCategory = "CosmosDb" + ConnectionCategoryCosmosDbMongoDbAPI ConnectionCategory = "CosmosDbMongoDbApi" + ConnectionCategoryCouchbase ConnectionCategory = "Couchbase" + ConnectionCategoryCustomKeys ConnectionCategory = "CustomKeys" + ConnectionCategoryDb2 ConnectionCategory = "Db2" + ConnectionCategoryDrill ConnectionCategory = "Drill" + ConnectionCategoryDynamics ConnectionCategory = "Dynamics" + ConnectionCategoryDynamicsAx ConnectionCategory = "DynamicsAx" + ConnectionCategoryDynamicsCrm ConnectionCategory = "DynamicsCrm" + ConnectionCategoryElasticsearch ConnectionCategory = "Elasticsearch" + ConnectionCategoryEloqua ConnectionCategory = "Eloqua" + ConnectionCategoryFileServer ConnectionCategory = "FileServer" + ConnectionCategoryFtpServer ConnectionCategory = "FtpServer" + ConnectionCategoryGenericContainerRegistry ConnectionCategory = "GenericContainerRegistry" + ConnectionCategoryGenericHTTP ConnectionCategory = "GenericHttp" + ConnectionCategoryGenericRest ConnectionCategory = "GenericRest" + ConnectionCategoryGit ConnectionCategory = "Git" + ConnectionCategoryGoogleAdWords ConnectionCategory = "GoogleAdWords" + ConnectionCategoryGoogleBigQuery ConnectionCategory = "GoogleBigQuery" + ConnectionCategoryGoogleCloudStorage ConnectionCategory = "GoogleCloudStorage" + ConnectionCategoryGreenplum ConnectionCategory = "Greenplum" + ConnectionCategoryHbase ConnectionCategory = "Hbase" + ConnectionCategoryHdfs ConnectionCategory = "Hdfs" + ConnectionCategoryHive ConnectionCategory = "Hive" + ConnectionCategoryHubspot ConnectionCategory = "Hubspot" + ConnectionCategoryImpala ConnectionCategory = "Impala" + ConnectionCategoryInformix ConnectionCategory = "Informix" + ConnectionCategoryJira ConnectionCategory = "Jira" + ConnectionCategoryMagento ConnectionCategory = "Magento" + ConnectionCategoryManagedOnlineEndpoint ConnectionCategory = "ManagedOnlineEndpoint" + ConnectionCategoryMariaDb ConnectionCategory = "MariaDb" + ConnectionCategoryMarketo ConnectionCategory = "Marketo" + ConnectionCategoryMicrosoftAccess ConnectionCategory = "MicrosoftAccess" + ConnectionCategoryMongoDbAtlas ConnectionCategory = "MongoDbAtlas" + ConnectionCategoryMongoDbV2 ConnectionCategory = "MongoDbV2" + ConnectionCategoryMySQL ConnectionCategory = "MySql" + ConnectionCategoryNetezza ConnectionCategory = "Netezza" + ConnectionCategoryODataRest ConnectionCategory = "ODataRest" + ConnectionCategoryOdbc ConnectionCategory = "Odbc" + ConnectionCategoryOffice365 ConnectionCategory = "Office365" + ConnectionCategoryOpenAI ConnectionCategory = "OpenAI" + ConnectionCategoryOracle ConnectionCategory = "Oracle" + ConnectionCategoryOracleCloudStorage ConnectionCategory = "OracleCloudStorage" + ConnectionCategoryOracleServiceCloud ConnectionCategory = "OracleServiceCloud" + ConnectionCategoryPayPal ConnectionCategory = "PayPal" + ConnectionCategoryPhoenix ConnectionCategory = "Phoenix" + ConnectionCategoryPinecone ConnectionCategory = "Pinecone" + ConnectionCategoryPostgreSQL ConnectionCategory = "PostgreSql" + ConnectionCategoryPresto ConnectionCategory = "Presto" + ConnectionCategoryPythonFeed ConnectionCategory = "PythonFeed" + ConnectionCategoryQuickBooks ConnectionCategory = "QuickBooks" + ConnectionCategoryRedis ConnectionCategory = "Redis" + ConnectionCategoryResponsys ConnectionCategory = "Responsys" + ConnectionCategoryS3 ConnectionCategory = "S3" + ConnectionCategorySQLServer ConnectionCategory = "SqlServer" + ConnectionCategorySalesforce ConnectionCategory = "Salesforce" + ConnectionCategorySalesforceMarketingCloud ConnectionCategory = "SalesforceMarketingCloud" + ConnectionCategorySalesforceServiceCloud ConnectionCategory = "SalesforceServiceCloud" + ConnectionCategorySapBw ConnectionCategory = "SapBw" + ConnectionCategorySapCloudForCustomer ConnectionCategory = "SapCloudForCustomer" + ConnectionCategorySapEcc ConnectionCategory = "SapEcc" + ConnectionCategorySapHana ConnectionCategory = "SapHana" + ConnectionCategorySapOpenHub ConnectionCategory = "SapOpenHub" + ConnectionCategorySapTable ConnectionCategory = "SapTable" + ConnectionCategorySerp ConnectionCategory = "Serp" + ConnectionCategoryServerless ConnectionCategory = "Serverless" + ConnectionCategoryServiceNow ConnectionCategory = "ServiceNow" + ConnectionCategorySftp ConnectionCategory = "Sftp" + ConnectionCategorySharePointOnlineList ConnectionCategory = "SharePointOnlineList" + ConnectionCategoryShopify ConnectionCategory = "Shopify" + ConnectionCategorySnowflake ConnectionCategory = "Snowflake" + ConnectionCategorySpark ConnectionCategory = "Spark" + ConnectionCategorySquare ConnectionCategory = "Square" + ConnectionCategorySybase ConnectionCategory = "Sybase" + ConnectionCategoryTeradata ConnectionCategory = "Teradata" + ConnectionCategoryVertica ConnectionCategory = "Vertica" + ConnectionCategoryWebTable ConnectionCategory = "WebTable" + ConnectionCategoryXero ConnectionCategory = "Xero" + ConnectionCategoryZoho ConnectionCategory = "Zoho" +) + +// PossibleConnectionCategoryValues returns the possible values for the ConnectionCategory const type. +func PossibleConnectionCategoryValues() []ConnectionCategory { + return []ConnectionCategory{ + ConnectionCategoryADLSGen2, + ConnectionCategoryAIServices, + ConnectionCategoryAPIKey, + ConnectionCategoryAmazonMws, + ConnectionCategoryAmazonRdsForOracle, + ConnectionCategoryAmazonRdsForSQLServer, + ConnectionCategoryAmazonRedshift, + ConnectionCategoryAmazonS3Compatible, + ConnectionCategoryAzureBlob, + ConnectionCategoryAzureDataExplorer, + ConnectionCategoryAzureDatabricksDeltaLake, + ConnectionCategoryAzureMariaDb, + ConnectionCategoryAzureMySQLDb, + ConnectionCategoryAzureOneLake, + ConnectionCategoryAzureOpenAI, + ConnectionCategoryAzurePostgresDb, + ConnectionCategoryAzureSQLDb, + ConnectionCategoryAzureSQLMi, + ConnectionCategoryAzureSynapseAnalytics, + ConnectionCategoryAzureTableStorage, + ConnectionCategoryBingLLMSearch, + ConnectionCategoryCassandra, + ConnectionCategoryCognitiveSearch, + ConnectionCategoryCognitiveService, + ConnectionCategoryConcur, + ConnectionCategoryContainerRegistry, + ConnectionCategoryCosmosDb, + ConnectionCategoryCosmosDbMongoDbAPI, + ConnectionCategoryCouchbase, + ConnectionCategoryCustomKeys, + ConnectionCategoryDb2, + ConnectionCategoryDrill, + ConnectionCategoryDynamics, + ConnectionCategoryDynamicsAx, + ConnectionCategoryDynamicsCrm, + ConnectionCategoryElasticsearch, + ConnectionCategoryEloqua, + ConnectionCategoryFileServer, + ConnectionCategoryFtpServer, + ConnectionCategoryGenericContainerRegistry, + ConnectionCategoryGenericHTTP, + ConnectionCategoryGenericRest, + ConnectionCategoryGit, + ConnectionCategoryGoogleAdWords, + ConnectionCategoryGoogleBigQuery, + ConnectionCategoryGoogleCloudStorage, + ConnectionCategoryGreenplum, + ConnectionCategoryHbase, + ConnectionCategoryHdfs, + ConnectionCategoryHive, + ConnectionCategoryHubspot, + ConnectionCategoryImpala, + ConnectionCategoryInformix, + ConnectionCategoryJira, + ConnectionCategoryMagento, + ConnectionCategoryManagedOnlineEndpoint, + ConnectionCategoryMariaDb, + ConnectionCategoryMarketo, + ConnectionCategoryMicrosoftAccess, + ConnectionCategoryMongoDbAtlas, + ConnectionCategoryMongoDbV2, + ConnectionCategoryMySQL, + ConnectionCategoryNetezza, + ConnectionCategoryODataRest, + ConnectionCategoryOdbc, + ConnectionCategoryOffice365, + ConnectionCategoryOpenAI, + ConnectionCategoryOracle, + ConnectionCategoryOracleCloudStorage, + ConnectionCategoryOracleServiceCloud, + ConnectionCategoryPayPal, + ConnectionCategoryPhoenix, + ConnectionCategoryPinecone, + ConnectionCategoryPostgreSQL, + ConnectionCategoryPresto, + ConnectionCategoryPythonFeed, + ConnectionCategoryQuickBooks, + ConnectionCategoryRedis, + ConnectionCategoryResponsys, + ConnectionCategoryS3, + ConnectionCategorySQLServer, + ConnectionCategorySalesforce, + ConnectionCategorySalesforceMarketingCloud, + ConnectionCategorySalesforceServiceCloud, + ConnectionCategorySapBw, + ConnectionCategorySapCloudForCustomer, + ConnectionCategorySapEcc, + ConnectionCategorySapHana, + ConnectionCategorySapOpenHub, + ConnectionCategorySapTable, + ConnectionCategorySerp, + ConnectionCategoryServerless, + ConnectionCategoryServiceNow, + ConnectionCategorySftp, + ConnectionCategorySharePointOnlineList, + ConnectionCategoryShopify, + ConnectionCategorySnowflake, + ConnectionCategorySpark, + ConnectionCategorySquare, + ConnectionCategorySybase, + ConnectionCategoryTeradata, + ConnectionCategoryVertica, + ConnectionCategoryWebTable, + ConnectionCategoryXero, + ConnectionCategoryZoho, + } +} + +// ConnectionGroup - Group based on connection category +type ConnectionGroup string + +const ( + ConnectionGroupAzure ConnectionGroup = "Azure" + ConnectionGroupAzureAI ConnectionGroup = "AzureAI" + ConnectionGroupDatabase ConnectionGroup = "Database" + ConnectionGroupFile ConnectionGroup = "File" + ConnectionGroupGenericProtocol ConnectionGroup = "GenericProtocol" + ConnectionGroupNoSQL ConnectionGroup = "NoSQL" + ConnectionGroupServicesAndApps ConnectionGroup = "ServicesAndApps" +) + +// PossibleConnectionGroupValues returns the possible values for the ConnectionGroup const type. +func PossibleConnectionGroupValues() []ConnectionGroup { + return []ConnectionGroup{ + ConnectionGroupAzure, + ConnectionGroupAzureAI, + ConnectionGroupDatabase, + ConnectionGroupFile, + ConnectionGroupGenericProtocol, + ConnectionGroupNoSQL, + ConnectionGroupServicesAndApps, + } +} + // ContentLevel - Level at which content is filtered. type ContentLevel string @@ -295,6 +613,40 @@ func PossibleKeySourceValues() []KeySource { } } +type ManagedPERequirement string + +const ( + ManagedPERequirementNotApplicable ManagedPERequirement = "NotApplicable" + ManagedPERequirementNotRequired ManagedPERequirement = "NotRequired" + ManagedPERequirementRequired ManagedPERequirement = "Required" +) + +// PossibleManagedPERequirementValues returns the possible values for the ManagedPERequirement const type. +func PossibleManagedPERequirementValues() []ManagedPERequirement { + return []ManagedPERequirement{ + ManagedPERequirementNotApplicable, + ManagedPERequirementNotRequired, + ManagedPERequirementRequired, + } +} + +type ManagedPEStatus string + +const ( + ManagedPEStatusActive ManagedPEStatus = "Active" + ManagedPEStatusInactive ManagedPEStatus = "Inactive" + ManagedPEStatusNotApplicable ManagedPEStatus = "NotApplicable" +) + +// PossibleManagedPEStatusValues returns the possible values for the ManagedPEStatus const type. +func PossibleManagedPEStatusValues() []ManagedPEStatus { + return []ManagedPEStatus{ + ManagedPEStatusActive, + ManagedPEStatusInactive, + ManagedPEStatusNotApplicable, + } +} + // ModelLifecycleStatus - Model lifecycle status. type ModelLifecycleStatus string @@ -412,6 +764,7 @@ type ProvisioningState string const ( ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" @@ -424,6 +777,7 @@ const ( func PossibleProvisioningStateValues() []ProvisioningState { return []ProvisioningState{ ProvisioningStateAccepted, + ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, @@ -486,7 +840,7 @@ func PossibleRaiPolicyContentSourceValues() []RaiPolicyContentSource { } // RaiPolicyMode - Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronousfilter -// =3. Please use 'Asynchronousfilter' after 2024-10-01. It is the same as 'Deferred' in +// =3. Please use 'Asynchronousfilter' after 2025-06-01. It is the same as 'Deferred' in // previous version. type RaiPolicyMode string @@ -616,6 +970,23 @@ func PossibleSKUTierValues() []SKUTier { } } +// ScenarioType - Specifies what features in AI Foundry network injection applies to. Currently only supports 'agent' for +// agent scenarios. 'none' means no network injection. +type ScenarioType string + +const ( + ScenarioTypeAgent ScenarioType = "agent" + ScenarioTypeNone ScenarioType = "none" +) + +// PossibleScenarioTypeValues returns the possible values for the ScenarioType const type. +func PossibleScenarioTypeValues() []ScenarioType { + return []ScenarioType{ + ScenarioTypeAgent, + ScenarioTypeNone, + } +} + // UnitType - The unit of the metric. type UnitType string diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client.go index 444cb8377c14..57eb5b383b6d 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,7 @@ func NewDefenderForAISettingsClient(subscriptionID string, credential azcore.Tok // CreateOrUpdate - Creates or Updates the specified Defender for AI setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - defenderForAISettingName - The name of the defender for AI setting. @@ -76,7 +73,7 @@ func (client *DefenderForAISettingsClient) CreateOrUpdate(ctx context.Context, r } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DefenderForAISettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, defenderForAISettingName string, defenderForAISettings DefenderForAISetting, options *DefenderForAISettingsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DefenderForAISettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, defenderForAISettingName string, defenderForAISettings DefenderForAISetting, _ *DefenderForAISettingsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -99,7 +96,7 @@ func (client *DefenderForAISettingsClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, defenderForAISettings); err != nil { @@ -120,7 +117,7 @@ func (client *DefenderForAISettingsClient) createOrUpdateHandleResponse(resp *ht // Get - Gets the specified Defender for AI setting by name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - defenderForAISettingName - The name of the defender for AI setting. @@ -149,7 +146,7 @@ func (client *DefenderForAISettingsClient) Get(ctx context.Context, resourceGrou } // getCreateRequest creates the Get request. -func (client *DefenderForAISettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, defenderForAISettingName string, options *DefenderForAISettingsClientGetOptions) (*policy.Request, error) { +func (client *DefenderForAISettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, defenderForAISettingName string, _ *DefenderForAISettingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -172,7 +169,7 @@ func (client *DefenderForAISettingsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,7 +186,7 @@ func (client *DefenderForAISettingsClient) getHandleResponse(resp *http.Response // NewListPager - Lists the Defender for AI settings. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - DefenderForAISettingsClientListOptions contains the optional parameters for the DefenderForAISettingsClient.NewListPager @@ -218,7 +215,7 @@ func (client *DefenderForAISettingsClient) NewListPager(resourceGroupName string } // listCreateRequest creates the List request. -func (client *DefenderForAISettingsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *DefenderForAISettingsClientListOptions) (*policy.Request, error) { +func (client *DefenderForAISettingsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *DefenderForAISettingsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -237,7 +234,7 @@ func (client *DefenderForAISettingsClient) listCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,7 +252,7 @@ func (client *DefenderForAISettingsClient) listHandleResponse(resp *http.Respons // Update - Updates the specified Defender for AI setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - defenderForAISettingName - The name of the defender for AI setting. @@ -285,7 +282,7 @@ func (client *DefenderForAISettingsClient) Update(ctx context.Context, resourceG } // updateCreateRequest creates the Update request. -func (client *DefenderForAISettingsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, defenderForAISettingName string, defenderForAISettings DefenderForAISetting, options *DefenderForAISettingsClientUpdateOptions) (*policy.Request, error) { +func (client *DefenderForAISettingsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, defenderForAISettingName string, defenderForAISettings DefenderForAISetting, _ *DefenderForAISettingsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -308,7 +305,7 @@ func (client *DefenderForAISettingsClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, defenderForAISettings); err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client_example_test.go deleted file mode 100644 index cdbdf2fbabbd..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client_example_test.go +++ /dev/null @@ -1,183 +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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListDefenderForAISetting.json -func ExampleDefenderForAISettingsClient_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.NewDefenderForAISettingsClient().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.DefenderForAISettingResult = armcognitiveservices.DefenderForAISettingResult{ - // Value: []*armcognitiveservices.DefenderForAISetting{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/defenderForAISettings"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/defenderForAISettings/Default"), - // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armcognitiveservices.DefenderForAISettingProperties{ - // State: to.Ptr(armcognitiveservices.DefenderForAISettingStateEnabled), - // }, - // SystemData: &armcognitiveservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("xxx@microsoft.com"), - // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("xxx@microsoft.com"), - // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetDefenderForAISetting.json -func ExampleDefenderForAISettingsClient_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.NewDefenderForAISettingsClient().Get(ctx, "resourceGroupName", "accountName", "Default", 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.DefenderForAISetting = armcognitiveservices.DefenderForAISetting{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/defenderForAISettings"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/defenderForAISettings/Default"), - // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armcognitiveservices.DefenderForAISettingProperties{ - // State: to.Ptr(armcognitiveservices.DefenderForAISettingStateEnabled), - // }, - // SystemData: &armcognitiveservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("xxx@microsoft.com"), - // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("xxx@microsoft.com"), - // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutDefenderForAISetting.json -func ExampleDefenderForAISettingsClient_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.NewDefenderForAISettingsClient().CreateOrUpdate(ctx, "resourceGroupName", "accountName", "Default", armcognitiveservices.DefenderForAISetting{ - Properties: &armcognitiveservices.DefenderForAISettingProperties{ - State: to.Ptr(armcognitiveservices.DefenderForAISettingStateEnabled), - }, - }, 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.DefenderForAISetting = armcognitiveservices.DefenderForAISetting{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/defenderForAISettings"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/defenderForAISettings/Default"), - // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armcognitiveservices.DefenderForAISettingProperties{ - // State: to.Ptr(armcognitiveservices.DefenderForAISettingStateEnabled), - // }, - // SystemData: &armcognitiveservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("xxx@microsoft.com"), - // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("xxx@microsoft.com"), - // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/UpdateDefenderForAISetting.json -func ExampleDefenderForAISettingsClient_Update() { - 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.NewDefenderForAISettingsClient().Update(ctx, "resourceGroupName", "accountName", "Default", armcognitiveservices.DefenderForAISetting{ - Properties: &armcognitiveservices.DefenderForAISettingProperties{ - State: to.Ptr(armcognitiveservices.DefenderForAISettingStateEnabled), - }, - }, 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.DefenderForAISetting = armcognitiveservices.DefenderForAISetting{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/defenderForAISettings"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/defenderForAISettings/Default"), - // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armcognitiveservices.DefenderForAISettingProperties{ - // State: to.Ptr(armcognitiveservices.DefenderForAISettingStateEnabled), - // }, - // SystemData: &armcognitiveservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // CreatedBy: to.Ptr("xxx@microsoft.com"), - // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-03T04:41:33.937Z"); return t}()), - // LastModifiedBy: to.Ptr("xxx@microsoft.com"), - // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // }, - // } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go index 692a0bbf6009..e3c3a3b8944a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,7 @@ func NewDeletedAccountsClient(subscriptionID string, credential azcore.TokenCred // Get - Returns a Cognitive Services account specified by the parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - location - Resource location. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. @@ -74,7 +71,7 @@ func (client *DeletedAccountsClient) Get(ctx context.Context, location string, r } // getCreateRequest creates the Get request. -func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, location string, resourceGroupName string, accountName string, options *DeletedAccountsClientGetOptions) (*policy.Request, error) { +func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, location string, resourceGroupName string, accountName string, _ *DeletedAccountsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -97,7 +94,7 @@ func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +111,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 2024-10-01 +// Generated from API version 2025-06-01 // - options - DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.NewListPager // method. func (client *DeletedAccountsClient) NewListPager(options *DeletedAccountsClientListOptions) *runtime.Pager[DeletedAccountsClientListResponse] { @@ -141,7 +138,7 @@ func (client *DeletedAccountsClient) NewListPager(options *DeletedAccountsClient } // listCreateRequest creates the List request. -func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, options *DeletedAccountsClientListOptions) (*policy.Request, error) { +func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, _ *DeletedAccountsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -152,7 +149,7 @@ func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -170,7 +167,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 2024-10-01 +// Generated from API version 2025-06-01 // - location - Resource location. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. @@ -196,7 +193,7 @@ func (client *DeletedAccountsClient) BeginPurge(ctx context.Context, location st // Purge - Deletes a Cognitive Services account from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *DeletedAccountsClient) purge(ctx context.Context, location string, resourceGroupName string, accountName string, options *DeletedAccountsClientBeginPurgeOptions) (*http.Response, error) { var err error const operationName = "DeletedAccountsClient.BeginPurge" @@ -219,7 +216,7 @@ func (client *DeletedAccountsClient) purge(ctx context.Context, location string, } // purgeCreateRequest creates the Purge request. -func (client *DeletedAccountsClient) purgeCreateRequest(ctx context.Context, location string, resourceGroupName string, accountName string, options *DeletedAccountsClientBeginPurgeOptions) (*policy.Request, error) { +func (client *DeletedAccountsClient) purgeCreateRequest(ctx context.Context, location string, resourceGroupName string, accountName string, _ *DeletedAccountsClientBeginPurgeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -242,7 +239,7 @@ func (client *DeletedAccountsClient) purgeCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client_example_test.go deleted file mode 100644 index e336d565c8e0..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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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 50c4d053a602..9936db5a10ec 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,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 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -74,7 +71,7 @@ func (client *DeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resour // CreateOrUpdate - Update the state of specified deployments associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DeploymentsClient.BeginCreateOrUpdate" @@ -97,7 +94,7 @@ func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGro } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment Deployment, _ *DeploymentsClientBeginCreateOrUpdateOptions) (*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") @@ -120,7 +117,7 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, deployment); err != nil { @@ -132,7 +129,7 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context // BeginDelete - Deletes the specified deployment associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -157,7 +154,7 @@ func (client *DeploymentsClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Deletes the specified deployment associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *DeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DeploymentsClient.BeginDelete" @@ -180,7 +177,7 @@ func (client *DeploymentsClient) deleteOperation(ctx context.Context, resourceGr } // deleteCreateRequest creates the Delete request. -func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, _ *DeploymentsClientBeginDeleteOptions) (*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") @@ -203,7 +200,7 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +209,7 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour // Get - Gets the specified deployments associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -240,7 +237,7 @@ func (client *DeploymentsClient) Get(ctx context.Context, resourceGroupName stri } // getCreateRequest creates the Get request. -func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *DeploymentsClientGetOptions) (*policy.Request, error) { +func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, _ *DeploymentsClientGetOptions) (*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") @@ -263,7 +260,7 @@ func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +277,7 @@ func (client *DeploymentsClient) getHandleResponse(resp *http.Response) (Deploym // NewListPager - Gets the deployments associated with the Cognitive Services account. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - DeploymentsClientListOptions contains the optional parameters for the DeploymentsClient.NewListPager method. @@ -308,7 +305,7 @@ func (client *DeploymentsClient) NewListPager(resourceGroupName string, accountN } // listCreateRequest creates the List request. -func (client *DeploymentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *DeploymentsClientListOptions) (*policy.Request, error) { +func (client *DeploymentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *DeploymentsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -327,7 +324,7 @@ func (client *DeploymentsClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,7 +341,7 @@ func (client *DeploymentsClient) listHandleResponse(resp *http.Response) (Deploy // NewListSKUsPager - Lists the specified deployments skus associated with the Cognitive Services account. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -374,7 +371,7 @@ func (client *DeploymentsClient) NewListSKUsPager(resourceGroupName string, acco } // listSKUsCreateRequest creates the ListSKUs request. -func (client *DeploymentsClient) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *DeploymentsClientListSKUsOptions) (*policy.Request, error) { +func (client *DeploymentsClient) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, _ *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") @@ -397,7 +394,7 @@ func (client *DeploymentsClient) listSKUsCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -415,7 +412,7 @@ func (client *DeploymentsClient) listSKUsHandleResponse(resp *http.Response) (De // BeginUpdate - Update specified deployments associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -442,7 +439,7 @@ func (client *DeploymentsClient) BeginUpdate(ctx context.Context, resourceGroupN // Update - Update specified deployments associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *DeploymentsClient) update(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment PatchResourceTagsAndSKU, options *DeploymentsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DeploymentsClient.BeginUpdate" @@ -465,7 +462,7 @@ func (client *DeploymentsClient) update(ctx context.Context, resourceGroupName s } // 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) { +func (client *DeploymentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment PatchResourceTagsAndSKU, _ *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") @@ -488,7 +485,7 @@ func (client *DeploymentsClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, deployment); err != 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 4d2ea89accdf..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client_example_test.go +++ /dev/null @@ -1,265 +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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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), - // }, - // 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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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), - // }, - // 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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/UpdateDeployment.json -func ExampleDeploymentsClient_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.NewDeploymentsClient().BeginUpdate(ctx, "resourceGroupName", "accountName", "deploymentName", armcognitiveservices.PatchResourceTagsAndSKU{ - 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/00000000-0000-0000-0000-000000000000/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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListDeploymentSkus.json -func ExampleDeploymentsClient_NewListSKUsPager() { - 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().NewListSKUsPager("resourceGroupName", "accountName", "deploymentName", 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.DeploymentSKUListResult = armcognitiveservices.DeploymentSKUListResult{ - // Value: []*armcognitiveservices.SKUResource{ - // { - // Capacity: &armcognitiveservices.CapacityConfig{ - // Default: to.Ptr[int32](100), - // AllowedValues: []*int32{ - // to.Ptr[int32](100), - // to.Ptr[int32](200)}, - // Maximum: to.Ptr[int32](1000), - // Minimum: to.Ptr[int32](100), - // Step: to.Ptr[int32](100), - // }, - // ResourceType: to.Ptr("Microsoft.CognitiveServices/accounts/deployments"), - // SKU: &armcognitiveservices.SKU{ - // Name: to.Ptr("Standard"), - // Capacity: to.Ptr[int32](1), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client.go index 6f3b137e4a5a..6dfa1504ea1b 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,7 @@ func NewEncryptionScopesClient(subscriptionID string, credential azcore.TokenCre // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -76,7 +73,7 @@ func (client *EncryptionScopesClient) CreateOrUpdate(ctx context.Context, resour } // 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) { +func (client *EncryptionScopesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, _ *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") @@ -99,7 +96,7 @@ func (client *EncryptionScopesClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, encryptionScope); err != nil { @@ -120,7 +117,7 @@ func (client *EncryptionScopesClient) createOrUpdateHandleResponse(resp *http.Re // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -146,7 +143,7 @@ func (client *EncryptionScopesClient) BeginDelete(ctx context.Context, resourceG // 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 2024-10-01 +// Generated from API version 2025-06-01 func (client *EncryptionScopesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "EncryptionScopesClient.BeginDelete" @@ -169,7 +166,7 @@ func (client *EncryptionScopesClient) deleteOperation(ctx context.Context, resou } // deleteCreateRequest creates the Delete request. -func (client *EncryptionScopesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *EncryptionScopesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, _ *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") @@ -192,7 +189,7 @@ func (client *EncryptionScopesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -201,7 +198,7 @@ func (client *EncryptionScopesClient) deleteCreateRequest(ctx context.Context, r // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -229,7 +226,7 @@ func (client *EncryptionScopesClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *EncryptionScopesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientGetOptions) (*policy.Request, error) { +func (client *EncryptionScopesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, _ *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") @@ -252,7 +249,7 @@ func (client *EncryptionScopesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +266,7 @@ func (client *EncryptionScopesClient) getHandleResponse(resp *http.Response) (En // NewListPager - Gets the content filters associated with the Azure OpenAI account. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -298,7 +295,7 @@ func (client *EncryptionScopesClient) NewListPager(resourceGroupName string, acc } // listCreateRequest creates the List request. -func (client *EncryptionScopesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *EncryptionScopesClientListOptions) (*policy.Request, error) { +func (client *EncryptionScopesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *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") @@ -317,7 +314,7 @@ func (client *EncryptionScopesClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client_example_test.go deleted file mode 100644 index d51f3b80bebc..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client_example_test.go +++ /dev/null @@ -1,194 +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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListEncryptionScopes.json -func ExampleEncryptionScopesClient_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.NewEncryptionScopesClient().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.EncryptionScopeListResult = armcognitiveservices.EncryptionScopeListResult{ - // Value: []*armcognitiveservices.EncryptionScope{ - // { - // Name: to.Ptr("encryptionScopeName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/encryptionScopes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/encryptionScopes/encryptionScopeName"), - // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armcognitiveservices.EncryptionScopeProperties{ - // KeySource: to.Ptr(armcognitiveservices.KeySourceMicrosoftKeyVault), - // KeyVaultProperties: &armcognitiveservices.KeyVaultProperties{ - // IdentityClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // KeyName: to.Ptr("DevKeyWestUS2"), - // KeyVaultURI: to.Ptr("https://devkvwestus2.vault.azure.net/"), - // KeyVersion: to.Ptr("9f85549d7bf14ff4bf178c10d3bdca95"), - // }, - // ProvisioningState: to.Ptr(armcognitiveservices.EncryptionScopeProvisioningStateSucceeded), - // State: to.Ptr(armcognitiveservices.EncryptionScopeStateEnabled), - // }, - // SystemData: &armcognitiveservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-08T06:35:08.066Z"); return t}()), - // CreatedBy: to.Ptr("xxx@microsoft.com"), - // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-08T06:35:08.066Z"); return t}()), - // LastModifiedBy: to.Ptr("xxx@microsoft.com"), - // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetEncryptionScope.json -func ExampleEncryptionScopesClient_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.NewEncryptionScopesClient().Get(ctx, "resourceGroupName", "accountName", "encryptionScopeName", 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.EncryptionScope = armcognitiveservices.EncryptionScope{ - // Name: to.Ptr("encryptionScopeName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/encryptionScopes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/encryptionScopes/encryptionScopeName"), - // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armcognitiveservices.EncryptionScopeProperties{ - // KeySource: to.Ptr(armcognitiveservices.KeySourceMicrosoftKeyVault), - // KeyVaultProperties: &armcognitiveservices.KeyVaultProperties{ - // IdentityClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // KeyName: to.Ptr("DevKeyWestUS2"), - // KeyVaultURI: to.Ptr("https://devkvwestus2.vault.azure.net/"), - // KeyVersion: to.Ptr("9f85549d7bf14ff4bf178c10d3bdca95"), - // }, - // ProvisioningState: to.Ptr(armcognitiveservices.EncryptionScopeProvisioningStateSucceeded), - // State: to.Ptr(armcognitiveservices.EncryptionScopeStateEnabled), - // }, - // SystemData: &armcognitiveservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-08T06:35:08.066Z"); return t}()), - // CreatedBy: to.Ptr("xxx@microsoft.com"), - // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-08T06:35:08.066Z"); return t}()), - // LastModifiedBy: to.Ptr("xxx@microsoft.com"), - // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutEncryptionScope.json -func ExampleEncryptionScopesClient_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.NewEncryptionScopesClient().CreateOrUpdate(ctx, "resourceGroupName", "accountName", "encryptionScopeName", armcognitiveservices.EncryptionScope{ - Properties: &armcognitiveservices.EncryptionScopeProperties{ - KeySource: to.Ptr(armcognitiveservices.KeySourceMicrosoftKeyVault), - KeyVaultProperties: &armcognitiveservices.KeyVaultProperties{ - IdentityClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - KeyName: to.Ptr("DevKeyWestUS2"), - KeyVaultURI: to.Ptr("https://devkvwestus2.vault.azure.net/"), - KeyVersion: to.Ptr("9f85549d7bf14ff4bf178c10d3bdca95"), - }, - State: to.Ptr(armcognitiveservices.EncryptionScopeStateEnabled), - }, - }, 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.EncryptionScope = armcognitiveservices.EncryptionScope{ - // Name: to.Ptr("encryptionScopeName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/encryptionScopes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/encryptionScopes/encryptionScopeName"), - // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armcognitiveservices.EncryptionScopeProperties{ - // KeySource: to.Ptr(armcognitiveservices.KeySourceMicrosoftKeyVault), - // KeyVaultProperties: &armcognitiveservices.KeyVaultProperties{ - // IdentityClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // KeyName: to.Ptr("DevKeyWestUS2"), - // KeyVaultURI: to.Ptr("https://devkvwestus2.vault.azure.net/"), - // KeyVersion: to.Ptr("9f85549d7bf14ff4bf178c10d3bdca95"), - // }, - // ProvisioningState: to.Ptr(armcognitiveservices.EncryptionScopeProvisioningStateSucceeded), - // State: to.Ptr(armcognitiveservices.EncryptionScopeStateEnabled), - // }, - // SystemData: &armcognitiveservices.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-08T06:35:08.066Z"); return t}()), - // CreatedBy: to.Ptr("xxx@microsoft.com"), - // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-08T06:35:08.066Z"); return t}()), - // LastModifiedBy: to.Ptr("xxx@microsoft.com"), - // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteEncryptionScope.json -func ExampleEncryptionScopesClient_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.NewEncryptionScopesClient().BeginDelete(ctx, "resourceGroupName", "accountName", "encryptionScopeName", 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/fake/accountcapabilityhosts_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountcapabilityhosts_server.go new file mode 100644 index 000000000000..151ec8db3a2f --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountcapabilityhosts_server.go @@ -0,0 +1,244 @@ +// 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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" + "net/http" + "net/url" + "regexp" +) + +// AccountCapabilityHostsServer is a fake server for instances of the armcognitiveservices.AccountCapabilityHostsClient type. +type AccountCapabilityHostsServer struct { + // BeginCreateOrUpdate is the fake for method AccountCapabilityHostsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, capabilityHostName string, capabilityHost armcognitiveservices.CapabilityHost, options *armcognitiveservices.AccountCapabilityHostsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcognitiveservices.AccountCapabilityHostsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AccountCapabilityHostsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, capabilityHostName string, options *armcognitiveservices.AccountCapabilityHostsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcognitiveservices.AccountCapabilityHostsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AccountCapabilityHostsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, capabilityHostName string, options *armcognitiveservices.AccountCapabilityHostsClientGetOptions) (resp azfake.Responder[armcognitiveservices.AccountCapabilityHostsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewAccountCapabilityHostsServerTransport creates a new instance of AccountCapabilityHostsServerTransport with the provided implementation. +// The returned AccountCapabilityHostsServerTransport instance is connected to an instance of armcognitiveservices.AccountCapabilityHostsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAccountCapabilityHostsServerTransport(srv *AccountCapabilityHostsServer) *AccountCapabilityHostsServerTransport { + return &AccountCapabilityHostsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcognitiveservices.AccountCapabilityHostsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcognitiveservices.AccountCapabilityHostsClientDeleteResponse]](), + } +} + +// AccountCapabilityHostsServerTransport connects instances of armcognitiveservices.AccountCapabilityHostsClient to instances of AccountCapabilityHostsServer. +// Don't use this type directly, use NewAccountCapabilityHostsServerTransport instead. +type AccountCapabilityHostsServerTransport struct { + srv *AccountCapabilityHostsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcognitiveservices.AccountCapabilityHostsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcognitiveservices.AccountCapabilityHostsClientDeleteResponse]] +} + +// Do implements the policy.Transporter interface for AccountCapabilityHostsServerTransport. +func (a *AccountCapabilityHostsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AccountCapabilityHostsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if accountCapabilityHostsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = accountCapabilityHostsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AccountCapabilityHostsClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AccountCapabilityHostsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AccountCapabilityHostsClient.Get": + res.resp, res.err = a.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AccountCapabilityHostsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityHosts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.CapabilityHost](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + capabilityHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capabilityHostName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, accountNameParam, capabilityHostNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + a.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + a.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (a *AccountCapabilityHostsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityHosts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + capabilityHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capabilityHostName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, capabilityHostNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AccountCapabilityHostsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityHosts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + capabilityHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capabilityHostName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, capabilityHostNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CapabilityHost, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to AccountCapabilityHostsServerTransport +var accountCapabilityHostsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountconnections_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountconnections_server.go new file mode 100644 index 000000000000..20062de33c2a --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountconnections_server.go @@ -0,0 +1,356 @@ +// 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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" + "net/http" + "net/url" + "reflect" + "regexp" + "strconv" +) + +// AccountConnectionsServer is a fake server for instances of the armcognitiveservices.AccountConnectionsClient type. +type AccountConnectionsServer struct { + // Create is the fake for method AccountConnectionsClient.Create + // HTTP status codes to indicate success: http.StatusOK + Create func(ctx context.Context, resourceGroupName string, accountName string, connectionName string, options *armcognitiveservices.AccountConnectionsClientCreateOptions) (resp azfake.Responder[armcognitiveservices.AccountConnectionsClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method AccountConnectionsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, accountName string, connectionName string, options *armcognitiveservices.AccountConnectionsClientDeleteOptions) (resp azfake.Responder[armcognitiveservices.AccountConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AccountConnectionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, connectionName string, options *armcognitiveservices.AccountConnectionsClientGetOptions) (resp azfake.Responder[armcognitiveservices.AccountConnectionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method AccountConnectionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, accountName string, options *armcognitiveservices.AccountConnectionsClientListOptions) (resp azfake.PagerResponder[armcognitiveservices.AccountConnectionsClientListResponse]) + + // Update is the fake for method AccountConnectionsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, accountName string, connectionName string, options *armcognitiveservices.AccountConnectionsClientUpdateOptions) (resp azfake.Responder[armcognitiveservices.AccountConnectionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewAccountConnectionsServerTransport creates a new instance of AccountConnectionsServerTransport with the provided implementation. +// The returned AccountConnectionsServerTransport instance is connected to an instance of armcognitiveservices.AccountConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAccountConnectionsServerTransport(srv *AccountConnectionsServer) *AccountConnectionsServerTransport { + return &AccountConnectionsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcognitiveservices.AccountConnectionsClientListResponse]](), + } +} + +// AccountConnectionsServerTransport connects instances of armcognitiveservices.AccountConnectionsClient to instances of AccountConnectionsServer. +// Don't use this type directly, use NewAccountConnectionsServerTransport instead. +type AccountConnectionsServerTransport struct { + srv *AccountConnectionsServer + newListPager *tracker[azfake.PagerResponder[armcognitiveservices.AccountConnectionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for AccountConnectionsServerTransport. +func (a *AccountConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AccountConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if accountConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = accountConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AccountConnectionsClient.Create": + res.resp, res.err = a.dispatchCreate(req) + case "AccountConnectionsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AccountConnectionsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AccountConnectionsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AccountConnectionsClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AccountConnectionsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if a.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.ConnectionPropertiesV2BasicResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + connectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectionName")]) + if err != nil { + return nil, err + } + var options *armcognitiveservices.AccountConnectionsClientCreateOptions + if !reflect.ValueOf(body).IsZero() { + options = &armcognitiveservices.AccountConnectionsClientCreateOptions{ + Connection: &body, + } + } + respr, errRespr := a.srv.Create(req.Context(), resourceGroupNameParam, accountNameParam, connectionNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectionPropertiesV2BasicResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AccountConnectionsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if a.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + connectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, accountNameParam, connectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AccountConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + connectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, connectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectionPropertiesV2BasicResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AccountConnectionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connections` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + targetUnescaped, err := url.QueryUnescape(qp.Get("target")) + if err != nil { + return nil, err + } + targetParam := getOptional(targetUnescaped) + categoryUnescaped, err := url.QueryUnescape(qp.Get("category")) + if err != nil { + return nil, err + } + categoryParam := getOptional(categoryUnescaped) + includeAllUnescaped, err := url.QueryUnescape(qp.Get("includeAll")) + if err != nil { + return nil, err + } + includeAllParam, err := parseOptional(includeAllUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + var options *armcognitiveservices.AccountConnectionsClientListOptions + if targetParam != nil || categoryParam != nil || includeAllParam != nil { + options = &armcognitiveservices.AccountConnectionsClientListOptions{ + Target: targetParam, + Category: categoryParam, + IncludeAll: includeAllParam, + } + } + resp := a.srv.NewListPager(resourceGroupNameParam, accountNameParam, options) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcognitiveservices.AccountConnectionsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +func (a *AccountConnectionsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if a.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.ConnectionUpdateContent](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + connectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectionName")]) + if err != nil { + return nil, err + } + var options *armcognitiveservices.AccountConnectionsClientUpdateOptions + if !reflect.ValueOf(body).IsZero() { + options = &armcognitiveservices.AccountConnectionsClientUpdateOptions{ + Connection: &body, + } + } + respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, accountNameParam, connectionNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectionPropertiesV2BasicResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to AccountConnectionsServerTransport +var accountConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accounts_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accounts_server.go index d302a1ee3811..249c7e02c973 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accounts_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accounts_server.go @@ -1,6 +1,3 @@ -//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. @@ -104,41 +101,60 @@ func (a *AccountsServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "AccountsClient.BeginCreate": - resp, err = a.dispatchBeginCreate(req) - case "AccountsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AccountsClient.Get": - resp, err = a.dispatchGet(req) - case "AccountsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AccountsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AccountsClient.ListKeys": - resp, err = a.dispatchListKeys(req) - case "AccountsClient.NewListModelsPager": - resp, err = a.dispatchNewListModelsPager(req) - case "AccountsClient.ListSKUs": - resp, err = a.dispatchListSKUs(req) - case "AccountsClient.ListUsages": - resp, err = a.dispatchListUsages(req) - case "AccountsClient.RegenerateKey": - resp, err = a.dispatchRegenerateKey(req) - case "AccountsClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return a.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (a *AccountsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if accountsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = accountsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AccountsClient.BeginCreate": + res.resp, res.err = a.dispatchBeginCreate(req) + case "AccountsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AccountsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AccountsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AccountsClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AccountsClient.ListKeys": + res.resp, res.err = a.dispatchListKeys(req) + case "AccountsClient.NewListModelsPager": + res.resp, res.err = a.dispatchNewListModelsPager(req) + case "AccountsClient.ListSKUs": + res.resp, res.err = a.dispatchListSKUs(req) + case "AccountsClient.ListUsages": + res.resp, res.err = a.dispatchListUsages(req) + case "AccountsClient.RegenerateKey": + res.resp, res.err = a.dispatchRegenerateKey(req) + case "AccountsClient.BeginUpdate": + res.resp, res.err = a.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AccountsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -572,3 +588,9 @@ func (a *AccountsServerTransport) dispatchBeginUpdate(req *http.Request) (*http. return resp, nil } + +// set this to conditionally intercept incoming requests to AccountsServerTransport +var accountsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmentplans_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmentplans_server.go index 49edbd0c019d..56d5cf239df6 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmentplans_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmentplans_server.go @@ -1,6 +1,3 @@ -//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. @@ -124,47 +121,66 @@ func (c *CommitmentPlansServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "CommitmentPlansClient.CreateOrUpdate": - resp, err = c.dispatchCreateOrUpdate(req) - case "CommitmentPlansClient.BeginCreateOrUpdateAssociation": - resp, err = c.dispatchBeginCreateOrUpdateAssociation(req) - case "CommitmentPlansClient.BeginCreateOrUpdatePlan": - resp, err = c.dispatchBeginCreateOrUpdatePlan(req) - case "CommitmentPlansClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CommitmentPlansClient.BeginDeleteAssociation": - resp, err = c.dispatchBeginDeleteAssociation(req) - case "CommitmentPlansClient.BeginDeletePlan": - resp, err = c.dispatchBeginDeletePlan(req) - case "CommitmentPlansClient.Get": - resp, err = c.dispatchGet(req) - case "CommitmentPlansClient.GetAssociation": - resp, err = c.dispatchGetAssociation(req) - case "CommitmentPlansClient.GetPlan": - resp, err = c.dispatchGetPlan(req) - case "CommitmentPlansClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - case "CommitmentPlansClient.NewListAssociationsPager": - resp, err = c.dispatchNewListAssociationsPager(req) - case "CommitmentPlansClient.NewListPlansByResourceGroupPager": - resp, err = c.dispatchNewListPlansByResourceGroupPager(req) - case "CommitmentPlansClient.NewListPlansBySubscriptionPager": - resp, err = c.dispatchNewListPlansBySubscriptionPager(req) - case "CommitmentPlansClient.BeginUpdatePlan": - resp, err = c.dispatchBeginUpdatePlan(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return c.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err +func (c *CommitmentPlansServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if commitmentPlansServerTransportInterceptor != nil { + res.resp, res.err, intercepted = commitmentPlansServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CommitmentPlansClient.CreateOrUpdate": + res.resp, res.err = c.dispatchCreateOrUpdate(req) + case "CommitmentPlansClient.BeginCreateOrUpdateAssociation": + res.resp, res.err = c.dispatchBeginCreateOrUpdateAssociation(req) + case "CommitmentPlansClient.BeginCreateOrUpdatePlan": + res.resp, res.err = c.dispatchBeginCreateOrUpdatePlan(req) + case "CommitmentPlansClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CommitmentPlansClient.BeginDeleteAssociation": + res.resp, res.err = c.dispatchBeginDeleteAssociation(req) + case "CommitmentPlansClient.BeginDeletePlan": + res.resp, res.err = c.dispatchBeginDeletePlan(req) + case "CommitmentPlansClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CommitmentPlansClient.GetAssociation": + res.resp, res.err = c.dispatchGetAssociation(req) + case "CommitmentPlansClient.GetPlan": + res.resp, res.err = c.dispatchGetPlan(req) + case "CommitmentPlansClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + case "CommitmentPlansClient.NewListAssociationsPager": + res.resp, res.err = c.dispatchNewListAssociationsPager(req) + case "CommitmentPlansClient.NewListPlansByResourceGroupPager": + res.resp, res.err = c.dispatchNewListPlansByResourceGroupPager(req) + case "CommitmentPlansClient.NewListPlansBySubscriptionPager": + res.resp, res.err = c.dispatchNewListPlansBySubscriptionPager(req) + case "CommitmentPlansClient.BeginUpdatePlan": + res.resp, res.err = c.dispatchBeginUpdatePlan(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err } - - return resp, nil } func (c *CommitmentPlansServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -754,3 +770,9 @@ func (c *CommitmentPlansServerTransport) dispatchBeginUpdatePlan(req *http.Reque return resp, nil } + +// set this to conditionally intercept incoming requests to CommitmentPlansServerTransport +var commitmentPlansServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmenttiers_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmenttiers_server.go index b669c8dcfc48..04264969b10a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmenttiers_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmenttiers_server.go @@ -1,6 +1,3 @@ -//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. @@ -53,21 +50,40 @@ func (c *CommitmentTiersServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "CommitmentTiersClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CommitmentTiersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if commitmentTiersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = commitmentTiersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CommitmentTiersClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CommitmentTiersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -106,3 +122,9 @@ func (c *CommitmentTiersServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to CommitmentTiersServerTransport +var commitmentTiersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/defenderforaisettings_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/defenderforaisettings_server.go index 074275b11c88..f317137a80ba 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/defenderforaisettings_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/defenderforaisettings_server.go @@ -1,6 +1,3 @@ -//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. @@ -66,27 +63,46 @@ func (d *DefenderForAISettingsServerTransport) Do(req *http.Request) (*http.Resp return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DefenderForAISettingsClient.CreateOrUpdate": - resp, err = d.dispatchCreateOrUpdate(req) - case "DefenderForAISettingsClient.Get": - resp, err = d.dispatchGet(req) - case "DefenderForAISettingsClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - case "DefenderForAISettingsClient.Update": - resp, err = d.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DefenderForAISettingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if defenderForAiSettingsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = defenderForAiSettingsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DefenderForAISettingsClient.CreateOrUpdate": + res.resp, res.err = d.dispatchCreateOrUpdate(req) + case "DefenderForAISettingsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DefenderForAISettingsClient.NewListPager": + res.resp, res.err = d.dispatchNewListPager(req) + case "DefenderForAISettingsClient.Update": + res.resp, res.err = d.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DefenderForAISettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -248,3 +264,9 @@ func (d *DefenderForAISettingsServerTransport) dispatchUpdate(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to DefenderForAISettingsServerTransport +var defenderForAiSettingsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deletedaccounts_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deletedaccounts_server.go index 8d42d1858e99..e88b9aac3278 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deletedaccounts_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deletedaccounts_server.go @@ -1,6 +1,3 @@ -//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. @@ -64,25 +61,44 @@ func (d *DeletedAccountsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DeletedAccountsClient.Get": - resp, err = d.dispatchGet(req) - case "DeletedAccountsClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - case "DeletedAccountsClient.BeginPurge": - resp, err = d.dispatchBeginPurge(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DeletedAccountsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if deletedAccountsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = deletedAccountsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DeletedAccountsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DeletedAccountsClient.NewListPager": + res.resp, res.err = d.dispatchNewListPager(req) + case "DeletedAccountsClient.BeginPurge": + res.resp, res.err = d.dispatchBeginPurge(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DeletedAccountsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -202,3 +218,9 @@ func (d *DeletedAccountsServerTransport) dispatchBeginPurge(req *http.Request) ( return resp, nil } + +// set this to conditionally intercept incoming requests to DeletedAccountsServerTransport +var deletedAccountsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deployments_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deployments_server.go index 0f4ebb5e9d6b..c2e96df03ba0 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deployments_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deployments_server.go @@ -1,6 +1,3 @@ -//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. @@ -82,31 +79,50 @@ func (d *DeploymentsServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DeploymentsClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DeploymentsClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DeploymentsClient.Get": - resp, err = d.dispatchGet(req) - case "DeploymentsClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - case "DeploymentsClient.NewListSKUsPager": - resp, err = d.dispatchNewListSKUsPager(req) - case "DeploymentsClient.BeginUpdate": - resp, err = d.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DeploymentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if deploymentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = deploymentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DeploymentsClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DeploymentsClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DeploymentsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DeploymentsClient.NewListPager": + res.resp, res.err = d.dispatchNewListPager(req) + case "DeploymentsClient.NewListSKUsPager": + res.resp, res.err = d.dispatchNewListSKUsPager(req) + case "DeploymentsClient.BeginUpdate": + res.resp, res.err = d.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DeploymentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -383,3 +399,9 @@ func (d *DeploymentsServerTransport) dispatchBeginUpdate(req *http.Request) (*ht return resp, nil } + +// set this to conditionally intercept incoming requests to DeploymentsServerTransport +var deploymentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/encryptionscopes_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/encryptionscopes_server.go index 31d4de9c844e..8d72e3d5ccf7 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/encryptionscopes_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/encryptionscopes_server.go @@ -1,6 +1,3 @@ -//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. @@ -29,7 +26,7 @@ type EncryptionScopesServer struct { CreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope armcognitiveservices.EncryptionScope, options *armcognitiveservices.EncryptionScopesClientCreateOrUpdateOptions) (resp azfake.Responder[armcognitiveservices.EncryptionScopesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method EncryptionScopesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *armcognitiveservices.EncryptionScopesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcognitiveservices.EncryptionScopesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method EncryptionScopesClient.Get @@ -68,27 +65,46 @@ func (e *EncryptionScopesServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return e.dispatchToMethodFake(req, method) +} - switch method { - case "EncryptionScopesClient.CreateOrUpdate": - resp, err = e.dispatchCreateOrUpdate(req) - case "EncryptionScopesClient.BeginDelete": - resp, err = e.dispatchBeginDelete(req) - case "EncryptionScopesClient.Get": - resp, err = e.dispatchGet(req) - case "EncryptionScopesClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (e *EncryptionScopesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if encryptionScopesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = encryptionScopesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EncryptionScopesClient.CreateOrUpdate": + res.resp, res.err = e.dispatchCreateOrUpdate(req) + case "EncryptionScopesClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "EncryptionScopesClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EncryptionScopesClient.NewListPager": + res.resp, res.err = e.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (e *EncryptionScopesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -169,9 +185,9 @@ func (e *EncryptionScopesServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { e.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { e.beginDelete.remove(req) @@ -257,3 +273,9 @@ func (e *EncryptionScopesServerTransport) dispatchNewListPager(req *http.Request } return resp, nil } + +// set this to conditionally intercept incoming requests to EncryptionScopesServerTransport +var encryptionScopesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/internal.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/internal.go index 94e060e89dbd..c614f8d5643a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/internal.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/internal.go @@ -1,6 +1,3 @@ -//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. @@ -15,6 +12,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -39,6 +41,17 @@ func getOptional[T any](v T) *T { return &v } +func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { + if v == "" { + return nil, nil + } + t, err := parse(v) + if err != nil { + return nil, err + } + return &t, err +} + func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/locationbasedmodelcapacities_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/locationbasedmodelcapacities_server.go index 5757004629d5..66ab8b224f38 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/locationbasedmodelcapacities_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/locationbasedmodelcapacities_server.go @@ -1,6 +1,3 @@ -//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. @@ -53,21 +50,40 @@ func (l *LocationBasedModelCapacitiesServerTransport) Do(req *http.Request) (*ht return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return l.dispatchToMethodFake(req, method) +} - switch method { - case "LocationBasedModelCapacitiesClient.NewListPager": - resp, err = l.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (l *LocationBasedModelCapacitiesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if locationBasedModelCapacitiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = locationBasedModelCapacitiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "LocationBasedModelCapacitiesClient.NewListPager": + res.resp, res.err = l.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (l *LocationBasedModelCapacitiesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -119,3 +135,9 @@ func (l *LocationBasedModelCapacitiesServerTransport) dispatchNewListPager(req * } return resp, nil } + +// set this to conditionally intercept incoming requests to LocationBasedModelCapacitiesServerTransport +var locationBasedModelCapacitiesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/management_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/management_server.go index f2390e054821..0eb33db22c26 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/management_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/management_server.go @@ -1,6 +1,3 @@ -//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. @@ -57,25 +54,44 @@ func (m *ManagementServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "ManagementClient.CalculateModelCapacity": - resp, err = m.dispatchCalculateModelCapacity(req) - case "ManagementClient.CheckDomainAvailability": - resp, err = m.dispatchCheckDomainAvailability(req) - case "ManagementClient.CheckSKUAvailability": - resp, err = m.dispatchCheckSKUAvailability(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return m.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err +func (m *ManagementServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if managementServerTransportInterceptor != nil { + res.resp, res.err, intercepted = managementServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ManagementClient.CalculateModelCapacity": + res.resp, res.err = m.dispatchCalculateModelCapacity(req) + case "ManagementClient.CheckDomainAvailability": + res.resp, res.err = m.dispatchCheckDomainAvailability(req) + case "ManagementClient.CheckSKUAvailability": + res.resp, res.err = m.dispatchCheckSKUAvailability(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err } - - return resp, nil } func (m *ManagementServerTransport) dispatchCalculateModelCapacity(req *http.Request) (*http.Response, error) { @@ -168,3 +184,9 @@ func (m *ManagementServerTransport) dispatchCheckSKUAvailability(req *http.Reque } return resp, nil } + +// set this to conditionally intercept incoming requests to ManagementServerTransport +var managementServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/modelcapacities_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/modelcapacities_server.go index 63b48a39e627..1301ecee2b1a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/modelcapacities_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/modelcapacities_server.go @@ -1,6 +1,3 @@ -//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. @@ -53,21 +50,40 @@ func (m *ModelCapacitiesServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return m.dispatchToMethodFake(req, method) +} - switch method { - case "ModelCapacitiesClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (m *ModelCapacitiesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if modelCapacitiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = modelCapacitiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ModelCapacitiesClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (m *ModelCapacitiesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -115,3 +131,9 @@ func (m *ModelCapacitiesServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to ModelCapacitiesServerTransport +var modelCapacitiesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/models_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/models_server.go index 055337f7b8f9..22bdf56017ae 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/models_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/models_server.go @@ -1,6 +1,3 @@ -//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. @@ -53,21 +50,40 @@ func (m *ModelsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return m.dispatchToMethodFake(req, method) +} - switch method { - case "ModelsClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (m *ModelsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if modelsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = modelsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ModelsClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (m *ModelsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -106,3 +122,9 @@ func (m *ModelsServerTransport) dispatchNewListPager(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to ModelsServerTransport +var modelsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/networksecurityperimeterconfigurations_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/networksecurityperimeterconfigurations_server.go index 0e3ec6fac5c3..647dda09f42d 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/networksecurityperimeterconfigurations_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/networksecurityperimeterconfigurations_server.go @@ -1,6 +1,3 @@ -//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. @@ -64,25 +61,44 @@ func (n *NetworkSecurityPerimeterConfigurationsServerTransport) Do(req *http.Req return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return n.dispatchToMethodFake(req, method) +} - switch method { - case "NetworkSecurityPerimeterConfigurationsClient.Get": - resp, err = n.dispatchGet(req) - case "NetworkSecurityPerimeterConfigurationsClient.NewListPager": - resp, err = n.dispatchNewListPager(req) - case "NetworkSecurityPerimeterConfigurationsClient.BeginReconcile": - resp, err = n.dispatchBeginReconcile(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (n *NetworkSecurityPerimeterConfigurationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if networkSecurityPerimeterConfigurationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = networkSecurityPerimeterConfigurationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "NetworkSecurityPerimeterConfigurationsClient.Get": + res.resp, res.err = n.dispatchGet(req) + case "NetworkSecurityPerimeterConfigurationsClient.NewListPager": + res.resp, res.err = n.dispatchNewListPager(req) + case "NetworkSecurityPerimeterConfigurationsClient.BeginReconcile": + res.resp, res.err = n.dispatchBeginReconcile(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (n *NetworkSecurityPerimeterConfigurationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -210,3 +226,9 @@ func (n *NetworkSecurityPerimeterConfigurationsServerTransport) dispatchBeginRec return resp, nil } + +// set this to conditionally intercept incoming requests to NetworkSecurityPerimeterConfigurationsServerTransport +var networkSecurityPerimeterConfigurationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/operations_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/operations_server.go index 9b08969bd99c..f3465557ddde 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/operations_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/operations_server.go @@ -1,6 +1,3 @@ -//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. @@ -51,21 +48,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -94,3 +110,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privateendpointconnections_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privateendpointconnections_server.go index 4c989203fa55..01d28f8c537c 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privateendpointconnections_server.go @@ -1,6 +1,3 @@ -//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. @@ -67,27 +64,46 @@ func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PrivateEndpointConnectionsClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PrivateEndpointConnectionsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.List": - resp, err = p.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.List": + res.resp, res.err = p.dispatchList(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -259,3 +275,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchList(req *http.Reque } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionsServerTransport +var privateEndpointConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privatelinkresources_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privatelinkresources_server.go index c621dbaca624..17778fefa906 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privatelinkresources_server.go @@ -1,6 +1,3 @@ -//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. @@ -49,21 +46,40 @@ func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PrivateLinkResourcesClient.List": - resp, err = p.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateLinkResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if privateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkResourcesClient.List": + res.resp, res.err = p.dispatchList(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateLinkResourcesServerTransport) dispatchList(req *http.Request) (*http.Response, error) { @@ -98,3 +114,9 @@ func (p *PrivateLinkResourcesServerTransport) dispatchList(req *http.Request) (* } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateLinkResourcesServerTransport +var privateLinkResourcesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectcapabilityhosts_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectcapabilityhosts_server.go new file mode 100644 index 000000000000..1f06ad05a088 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectcapabilityhosts_server.go @@ -0,0 +1,256 @@ +// 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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" + "net/http" + "net/url" + "regexp" +) + +// ProjectCapabilityHostsServer is a fake server for instances of the armcognitiveservices.ProjectCapabilityHostsClient type. +type ProjectCapabilityHostsServer struct { + // BeginCreateOrUpdate is the fake for method ProjectCapabilityHostsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, capabilityHost armcognitiveservices.CapabilityHost, options *armcognitiveservices.ProjectCapabilityHostsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcognitiveservices.ProjectCapabilityHostsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ProjectCapabilityHostsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, options *armcognitiveservices.ProjectCapabilityHostsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcognitiveservices.ProjectCapabilityHostsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ProjectCapabilityHostsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, options *armcognitiveservices.ProjectCapabilityHostsClientGetOptions) (resp azfake.Responder[armcognitiveservices.ProjectCapabilityHostsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewProjectCapabilityHostsServerTransport creates a new instance of ProjectCapabilityHostsServerTransport with the provided implementation. +// The returned ProjectCapabilityHostsServerTransport instance is connected to an instance of armcognitiveservices.ProjectCapabilityHostsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProjectCapabilityHostsServerTransport(srv *ProjectCapabilityHostsServer) *ProjectCapabilityHostsServerTransport { + return &ProjectCapabilityHostsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcognitiveservices.ProjectCapabilityHostsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcognitiveservices.ProjectCapabilityHostsClientDeleteResponse]](), + } +} + +// ProjectCapabilityHostsServerTransport connects instances of armcognitiveservices.ProjectCapabilityHostsClient to instances of ProjectCapabilityHostsServer. +// Don't use this type directly, use NewProjectCapabilityHostsServerTransport instead. +type ProjectCapabilityHostsServerTransport struct { + srv *ProjectCapabilityHostsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcognitiveservices.ProjectCapabilityHostsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcognitiveservices.ProjectCapabilityHostsClientDeleteResponse]] +} + +// Do implements the policy.Transporter interface for ProjectCapabilityHostsServerTransport. +func (p *ProjectCapabilityHostsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *ProjectCapabilityHostsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if projectCapabilityHostsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = projectCapabilityHostsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProjectCapabilityHostsClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "ProjectCapabilityHostsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "ProjectCapabilityHostsClient.Get": + res.resp, res.err = p.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *ProjectCapabilityHostsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityHosts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.CapabilityHost](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + capabilityHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capabilityHostName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, capabilityHostNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *ProjectCapabilityHostsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityHosts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + capabilityHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capabilityHostName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, capabilityHostNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *ProjectCapabilityHostsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityHosts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + capabilityHostNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("capabilityHostName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, capabilityHostNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CapabilityHost, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ProjectCapabilityHostsServerTransport +var projectCapabilityHostsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectconnections_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectconnections_server.go new file mode 100644 index 000000000000..65b19d2324d2 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectconnections_server.go @@ -0,0 +1,376 @@ +// 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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" + "net/http" + "net/url" + "reflect" + "regexp" + "strconv" +) + +// ProjectConnectionsServer is a fake server for instances of the armcognitiveservices.ProjectConnectionsClient type. +type ProjectConnectionsServer struct { + // Create is the fake for method ProjectConnectionsClient.Create + // HTTP status codes to indicate success: http.StatusOK + Create func(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, options *armcognitiveservices.ProjectConnectionsClientCreateOptions) (resp azfake.Responder[armcognitiveservices.ProjectConnectionsClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method ProjectConnectionsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, options *armcognitiveservices.ProjectConnectionsClientDeleteOptions) (resp azfake.Responder[armcognitiveservices.ProjectConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ProjectConnectionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, options *armcognitiveservices.ProjectConnectionsClientGetOptions) (resp azfake.Responder[armcognitiveservices.ProjectConnectionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ProjectConnectionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, accountName string, projectName string, options *armcognitiveservices.ProjectConnectionsClientListOptions) (resp azfake.PagerResponder[armcognitiveservices.ProjectConnectionsClientListResponse]) + + // Update is the fake for method ProjectConnectionsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, options *armcognitiveservices.ProjectConnectionsClientUpdateOptions) (resp azfake.Responder[armcognitiveservices.ProjectConnectionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewProjectConnectionsServerTransport creates a new instance of ProjectConnectionsServerTransport with the provided implementation. +// The returned ProjectConnectionsServerTransport instance is connected to an instance of armcognitiveservices.ProjectConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProjectConnectionsServerTransport(srv *ProjectConnectionsServer) *ProjectConnectionsServerTransport { + return &ProjectConnectionsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcognitiveservices.ProjectConnectionsClientListResponse]](), + } +} + +// ProjectConnectionsServerTransport connects instances of armcognitiveservices.ProjectConnectionsClient to instances of ProjectConnectionsServer. +// Don't use this type directly, use NewProjectConnectionsServerTransport instead. +type ProjectConnectionsServerTransport struct { + srv *ProjectConnectionsServer + newListPager *tracker[azfake.PagerResponder[armcognitiveservices.ProjectConnectionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for ProjectConnectionsServerTransport. +func (p *ProjectConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *ProjectConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if projectConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = projectConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProjectConnectionsClient.Create": + res.resp, res.err = p.dispatchCreate(req) + case "ProjectConnectionsClient.Delete": + res.resp, res.err = p.dispatchDelete(req) + case "ProjectConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "ProjectConnectionsClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "ProjectConnectionsClient.Update": + res.resp, res.err = p.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *ProjectConnectionsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if p.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.ConnectionPropertiesV2BasicResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + connectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectionName")]) + if err != nil { + return nil, err + } + var options *armcognitiveservices.ProjectConnectionsClientCreateOptions + if !reflect.ValueOf(body).IsZero() { + options = &armcognitiveservices.ProjectConnectionsClientCreateOptions{ + Connection: &body, + } + } + respr, errRespr := p.srv.Create(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, connectionNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectionPropertiesV2BasicResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *ProjectConnectionsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if p.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + connectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Delete(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, connectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *ProjectConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + connectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, connectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectionPropertiesV2BasicResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *ProjectConnectionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connections` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + targetUnescaped, err := url.QueryUnescape(qp.Get("target")) + if err != nil { + return nil, err + } + targetParam := getOptional(targetUnescaped) + categoryUnescaped, err := url.QueryUnescape(qp.Get("category")) + if err != nil { + return nil, err + } + categoryParam := getOptional(categoryUnescaped) + includeAllUnescaped, err := url.QueryUnescape(qp.Get("includeAll")) + if err != nil { + return nil, err + } + includeAllParam, err := parseOptional(includeAllUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + var options *armcognitiveservices.ProjectConnectionsClientListOptions + if targetParam != nil || categoryParam != nil || includeAllParam != nil { + options = &armcognitiveservices.ProjectConnectionsClientListOptions{ + Target: targetParam, + Category: categoryParam, + IncludeAll: includeAllParam, + } + } + resp := p.srv.NewListPager(resourceGroupNameParam, accountNameParam, projectNameParam, options) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcognitiveservices.ProjectConnectionsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +func (p *ProjectConnectionsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if p.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/connections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.ConnectionUpdateContent](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + connectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectionName")]) + if err != nil { + return nil, err + } + var options *armcognitiveservices.ProjectConnectionsClientUpdateOptions + if !reflect.ValueOf(body).IsZero() { + options = &armcognitiveservices.ProjectConnectionsClientUpdateOptions{ + Connection: &body, + } + } + respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, connectionNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectionPropertiesV2BasicResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ProjectConnectionsServerTransport +var projectConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projects_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projects_server.go new file mode 100644 index 000000000000..7d10a7cf2c3d --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projects_server.go @@ -0,0 +1,354 @@ +// 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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" + "net/http" + "net/url" + "regexp" +) + +// ProjectsServer is a fake server for instances of the armcognitiveservices.ProjectsClient type. +type ProjectsServer struct { + // BeginCreate is the fake for method ProjectsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated, http.StatusAccepted + BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, projectName string, project armcognitiveservices.Project, options *armcognitiveservices.ProjectsClientBeginCreateOptions) (resp azfake.PollerResponder[armcognitiveservices.ProjectsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ProjectsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, projectName string, options *armcognitiveservices.ProjectsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcognitiveservices.ProjectsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ProjectsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, projectName string, options *armcognitiveservices.ProjectsClientGetOptions) (resp azfake.Responder[armcognitiveservices.ProjectsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ProjectsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, accountName string, options *armcognitiveservices.ProjectsClientListOptions) (resp azfake.PagerResponder[armcognitiveservices.ProjectsClientListResponse]) + + // BeginUpdate is the fake for method ProjectsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, accountName string, projectName string, project armcognitiveservices.Project, options *armcognitiveservices.ProjectsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcognitiveservices.ProjectsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewProjectsServerTransport creates a new instance of ProjectsServerTransport with the provided implementation. +// The returned ProjectsServerTransport instance is connected to an instance of armcognitiveservices.ProjectsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProjectsServerTransport(srv *ProjectsServer) *ProjectsServerTransport { + return &ProjectsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armcognitiveservices.ProjectsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcognitiveservices.ProjectsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcognitiveservices.ProjectsClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armcognitiveservices.ProjectsClientUpdateResponse]](), + } +} + +// ProjectsServerTransport connects instances of armcognitiveservices.ProjectsClient to instances of ProjectsServer. +// Don't use this type directly, use NewProjectsServerTransport instead. +type ProjectsServerTransport struct { + srv *ProjectsServer + beginCreate *tracker[azfake.PollerResponder[armcognitiveservices.ProjectsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcognitiveservices.ProjectsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armcognitiveservices.ProjectsClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armcognitiveservices.ProjectsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ProjectsServerTransport. +func (p *ProjectsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *ProjectsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if projectsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = projectsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProjectsClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "ProjectsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "ProjectsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "ProjectsClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "ProjectsClient.BeginUpdate": + res.resp, res.err = p.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *ProjectsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := p.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.Project](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreate(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + p.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + p.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + p.beginCreate.remove(req) + } + + return resp, nil +} + +func (p *ProjectsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *ProjectsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Project, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *ProjectsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(resourceGroupNameParam, accountNameParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcognitiveservices.ProjectsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +func (p *ProjectsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.Project](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ProjectsServerTransport +var projectsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklistitems_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklistitems_server.go index 3b6036763b0f..2804c40d0ee3 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklistitems_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklistitems_server.go @@ -1,6 +1,3 @@ -//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. @@ -37,7 +34,7 @@ type RaiBlocklistItemsServer struct { CreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, raiBlocklistItem armcognitiveservices.RaiBlocklistItem, options *armcognitiveservices.RaiBlocklistItemsClientCreateOrUpdateOptions) (resp azfake.Responder[armcognitiveservices.RaiBlocklistItemsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method RaiBlocklistItemsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, options *armcognitiveservices.RaiBlocklistItemsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcognitiveservices.RaiBlocklistItemsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method RaiBlocklistItemsClient.Get @@ -76,31 +73,50 @@ func (r *RaiBlocklistItemsServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RaiBlocklistItemsClient.BatchAdd": - resp, err = r.dispatchBatchAdd(req) - case "RaiBlocklistItemsClient.BatchDelete": - resp, err = r.dispatchBatchDelete(req) - case "RaiBlocklistItemsClient.CreateOrUpdate": - resp, err = r.dispatchCreateOrUpdate(req) - case "RaiBlocklistItemsClient.BeginDelete": - resp, err = r.dispatchBeginDelete(req) - case "RaiBlocklistItemsClient.Get": - resp, err = r.dispatchGet(req) - case "RaiBlocklistItemsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RaiBlocklistItemsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if raiBlocklistItemsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = raiBlocklistItemsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RaiBlocklistItemsClient.BatchAdd": + res.resp, res.err = r.dispatchBatchAdd(req) + case "RaiBlocklistItemsClient.BatchDelete": + res.resp, res.err = r.dispatchBatchDelete(req) + case "RaiBlocklistItemsClient.CreateOrUpdate": + res.resp, res.err = r.dispatchCreateOrUpdate(req) + case "RaiBlocklistItemsClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "RaiBlocklistItemsClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RaiBlocklistItemsClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RaiBlocklistItemsServerTransport) dispatchBatchAdd(req *http.Request) (*http.Response, error) { @@ -271,9 +287,9 @@ func (r *RaiBlocklistItemsServerTransport) dispatchBeginDelete(req *http.Request return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { r.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { r.beginDelete.remove(req) @@ -367,3 +383,9 @@ func (r *RaiBlocklistItemsServerTransport) dispatchNewListPager(req *http.Reques } return resp, nil } + +// set this to conditionally intercept incoming requests to RaiBlocklistItemsServerTransport +var raiBlocklistItemsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklists_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklists_server.go index 1227d497b32a..90385675849c 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklists_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklists_server.go @@ -1,6 +1,3 @@ -//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. @@ -29,7 +26,7 @@ type RaiBlocklistsServer struct { CreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklist armcognitiveservices.RaiBlocklist, options *armcognitiveservices.RaiBlocklistsClientCreateOrUpdateOptions) (resp azfake.Responder[armcognitiveservices.RaiBlocklistsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method RaiBlocklistsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, options *armcognitiveservices.RaiBlocklistsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcognitiveservices.RaiBlocklistsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method RaiBlocklistsClient.Get @@ -68,27 +65,46 @@ func (r *RaiBlocklistsServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RaiBlocklistsClient.CreateOrUpdate": - resp, err = r.dispatchCreateOrUpdate(req) - case "RaiBlocklistsClient.BeginDelete": - resp, err = r.dispatchBeginDelete(req) - case "RaiBlocklistsClient.Get": - resp, err = r.dispatchGet(req) - case "RaiBlocklistsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RaiBlocklistsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if raiBlocklistsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = raiBlocklistsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RaiBlocklistsClient.CreateOrUpdate": + res.resp, res.err = r.dispatchCreateOrUpdate(req) + case "RaiBlocklistsClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "RaiBlocklistsClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RaiBlocklistsClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RaiBlocklistsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -169,9 +185,9 @@ func (r *RaiBlocklistsServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { r.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { r.beginDelete.remove(req) @@ -257,3 +273,9 @@ func (r *RaiBlocklistsServerTransport) dispatchNewListPager(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to RaiBlocklistsServerTransport +var raiBlocklistsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raicontentfilters_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raicontentfilters_server.go index a580a7f16f9e..ae2e1b36e45b 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raicontentfilters_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raicontentfilters_server.go @@ -1,6 +1,3 @@ -//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. @@ -58,23 +55,42 @@ func (r *RaiContentFiltersServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RaiContentFiltersClient.Get": - resp, err = r.dispatchGet(req) - case "RaiContentFiltersClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RaiContentFiltersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if raiContentFiltersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = raiContentFiltersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RaiContentFiltersClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RaiContentFiltersClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RaiContentFiltersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -146,3 +162,9 @@ func (r *RaiContentFiltersServerTransport) dispatchNewListPager(req *http.Reques } return resp, nil } + +// set this to conditionally intercept incoming requests to RaiContentFiltersServerTransport +var raiContentFiltersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raipolicies_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raipolicies_server.go index 1cf7f8be6b8b..f73cde9c3c66 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raipolicies_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raipolicies_server.go @@ -1,6 +1,3 @@ -//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. @@ -29,7 +26,7 @@ type RaiPoliciesServer struct { CreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, raiPolicy armcognitiveservices.RaiPolicy, options *armcognitiveservices.RaiPoliciesClientCreateOrUpdateOptions) (resp azfake.Responder[armcognitiveservices.RaiPoliciesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method RaiPoliciesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, options *armcognitiveservices.RaiPoliciesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcognitiveservices.RaiPoliciesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method RaiPoliciesClient.Get @@ -68,27 +65,46 @@ func (r *RaiPoliciesServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RaiPoliciesClient.CreateOrUpdate": - resp, err = r.dispatchCreateOrUpdate(req) - case "RaiPoliciesClient.BeginDelete": - resp, err = r.dispatchBeginDelete(req) - case "RaiPoliciesClient.Get": - resp, err = r.dispatchGet(req) - case "RaiPoliciesClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RaiPoliciesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if raiPoliciesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = raiPoliciesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RaiPoliciesClient.CreateOrUpdate": + res.resp, res.err = r.dispatchCreateOrUpdate(req) + case "RaiPoliciesClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "RaiPoliciesClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RaiPoliciesClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RaiPoliciesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -169,9 +185,9 @@ func (r *RaiPoliciesServerTransport) dispatchBeginDelete(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { r.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { r.beginDelete.remove(req) @@ -257,3 +273,9 @@ func (r *RaiPoliciesServerTransport) dispatchNewListPager(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to RaiPoliciesServerTransport +var raiPoliciesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/resourceskus_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/resourceskus_server.go index 903b72e9a6d0..07bc82010065 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/resourceskus_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/resourceskus_server.go @@ -1,6 +1,3 @@ -//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. @@ -52,21 +49,40 @@ func (r *ResourceSKUsServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "ResourceSKUsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *ResourceSKUsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if resourceSkUsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = resourceSkUsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ResourceSKUsClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *ResourceSKUsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -101,3 +117,9 @@ func (r *ResourceSKUsServerTransport) dispatchNewListPager(req *http.Request) (* } return resp, nil } + +// set this to conditionally intercept incoming requests to ResourceSKUsServerTransport +var resourceSkUsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/server_factory.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/server_factory.go index 3a8efe405b8a..81d6aae6fd7f 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/server_factory.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/server_factory.go @@ -1,6 +1,3 @@ -//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. @@ -19,27 +16,83 @@ import ( // ServerFactory is a fake server for instances of the armcognitiveservices.ClientFactory type. type ServerFactory struct { - AccountsServer AccountsServer - CommitmentPlansServer CommitmentPlansServer - CommitmentTiersServer CommitmentTiersServer - DefenderForAISettingsServer DefenderForAISettingsServer - DeletedAccountsServer DeletedAccountsServer - DeploymentsServer DeploymentsServer - EncryptionScopesServer EncryptionScopesServer - LocationBasedModelCapacitiesServer LocationBasedModelCapacitiesServer - ManagementServer ManagementServer - ModelCapacitiesServer ModelCapacitiesServer - ModelsServer ModelsServer + // AccountCapabilityHostsServer contains the fakes for client AccountCapabilityHostsClient + AccountCapabilityHostsServer AccountCapabilityHostsServer + + // AccountConnectionsServer contains the fakes for client AccountConnectionsClient + AccountConnectionsServer AccountConnectionsServer + + // AccountsServer contains the fakes for client AccountsClient + AccountsServer AccountsServer + + // CommitmentPlansServer contains the fakes for client CommitmentPlansClient + CommitmentPlansServer CommitmentPlansServer + + // CommitmentTiersServer contains the fakes for client CommitmentTiersClient + CommitmentTiersServer CommitmentTiersServer + + // DefenderForAISettingsServer contains the fakes for client DefenderForAISettingsClient + DefenderForAISettingsServer DefenderForAISettingsServer + + // DeletedAccountsServer contains the fakes for client DeletedAccountsClient + DeletedAccountsServer DeletedAccountsServer + + // DeploymentsServer contains the fakes for client DeploymentsClient + DeploymentsServer DeploymentsServer + + // EncryptionScopesServer contains the fakes for client EncryptionScopesClient + EncryptionScopesServer EncryptionScopesServer + + // LocationBasedModelCapacitiesServer contains the fakes for client LocationBasedModelCapacitiesClient + LocationBasedModelCapacitiesServer LocationBasedModelCapacitiesServer + + // ManagementServer contains the fakes for client ManagementClient + ManagementServer ManagementServer + + // ModelCapacitiesServer contains the fakes for client ModelCapacitiesClient + ModelCapacitiesServer ModelCapacitiesServer + + // ModelsServer contains the fakes for client ModelsClient + ModelsServer ModelsServer + + // NetworkSecurityPerimeterConfigurationsServer contains the fakes for client NetworkSecurityPerimeterConfigurationsClient NetworkSecurityPerimeterConfigurationsServer NetworkSecurityPerimeterConfigurationsServer - OperationsServer OperationsServer - PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer - PrivateLinkResourcesServer PrivateLinkResourcesServer - RaiBlocklistItemsServer RaiBlocklistItemsServer - RaiBlocklistsServer RaiBlocklistsServer - RaiContentFiltersServer RaiContentFiltersServer - RaiPoliciesServer RaiPoliciesServer - ResourceSKUsServer ResourceSKUsServer - UsagesServer UsagesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + + // PrivateLinkResourcesServer contains the fakes for client PrivateLinkResourcesClient + PrivateLinkResourcesServer PrivateLinkResourcesServer + + // ProjectCapabilityHostsServer contains the fakes for client ProjectCapabilityHostsClient + ProjectCapabilityHostsServer ProjectCapabilityHostsServer + + // ProjectConnectionsServer contains the fakes for client ProjectConnectionsClient + ProjectConnectionsServer ProjectConnectionsServer + + // ProjectsServer contains the fakes for client ProjectsClient + ProjectsServer ProjectsServer + + // RaiBlocklistItemsServer contains the fakes for client RaiBlocklistItemsClient + RaiBlocklistItemsServer RaiBlocklistItemsServer + + // RaiBlocklistsServer contains the fakes for client RaiBlocklistsClient + RaiBlocklistsServer RaiBlocklistsServer + + // RaiContentFiltersServer contains the fakes for client RaiContentFiltersClient + RaiContentFiltersServer RaiContentFiltersServer + + // RaiPoliciesServer contains the fakes for client RaiPoliciesClient + RaiPoliciesServer RaiPoliciesServer + + // ResourceSKUsServer contains the fakes for client ResourceSKUsClient + ResourceSKUsServer ResourceSKUsServer + + // UsagesServer contains the fakes for client UsagesClient + UsagesServer UsagesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -56,6 +109,8 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { type ServerFactoryTransport struct { srv *ServerFactory trMu sync.Mutex + trAccountCapabilityHostsServer *AccountCapabilityHostsServerTransport + trAccountConnectionsServer *AccountConnectionsServerTransport trAccountsServer *AccountsServerTransport trCommitmentPlansServer *CommitmentPlansServerTransport trCommitmentTiersServer *CommitmentTiersServerTransport @@ -71,6 +126,9 @@ type ServerFactoryTransport struct { trOperationsServer *OperationsServerTransport trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trProjectCapabilityHostsServer *ProjectCapabilityHostsServerTransport + trProjectConnectionsServer *ProjectConnectionsServerTransport + trProjectsServer *ProjectsServerTransport trRaiBlocklistItemsServer *RaiBlocklistItemsServerTransport trRaiBlocklistsServer *RaiBlocklistsServerTransport trRaiContentFiltersServer *RaiContentFiltersServerTransport @@ -92,6 +150,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "AccountCapabilityHostsClient": + initServer(s, &s.trAccountCapabilityHostsServer, func() *AccountCapabilityHostsServerTransport { + return NewAccountCapabilityHostsServerTransport(&s.srv.AccountCapabilityHostsServer) + }) + resp, err = s.trAccountCapabilityHostsServer.Do(req) + case "AccountConnectionsClient": + initServer(s, &s.trAccountConnectionsServer, func() *AccountConnectionsServerTransport { + return NewAccountConnectionsServerTransport(&s.srv.AccountConnectionsServer) + }) + resp, err = s.trAccountConnectionsServer.Do(req) case "AccountsClient": initServer(s, &s.trAccountsServer, func() *AccountsServerTransport { return NewAccountsServerTransport(&s.srv.AccountsServer) }) resp, err = s.trAccountsServer.Do(req) @@ -157,6 +225,19 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) }) resp, err = s.trPrivateLinkResourcesServer.Do(req) + case "ProjectCapabilityHostsClient": + initServer(s, &s.trProjectCapabilityHostsServer, func() *ProjectCapabilityHostsServerTransport { + return NewProjectCapabilityHostsServerTransport(&s.srv.ProjectCapabilityHostsServer) + }) + resp, err = s.trProjectCapabilityHostsServer.Do(req) + case "ProjectConnectionsClient": + initServer(s, &s.trProjectConnectionsServer, func() *ProjectConnectionsServerTransport { + return NewProjectConnectionsServerTransport(&s.srv.ProjectConnectionsServer) + }) + resp, err = s.trProjectConnectionsServer.Do(req) + case "ProjectsClient": + initServer(s, &s.trProjectsServer, func() *ProjectsServerTransport { return NewProjectsServerTransport(&s.srv.ProjectsServer) }) + resp, err = s.trProjectsServer.Do(req) case "RaiBlocklistItemsClient": initServer(s, &s.trRaiBlocklistItemsServer, func() *RaiBlocklistItemsServerTransport { return NewRaiBlocklistItemsServerTransport(&s.srv.RaiBlocklistItemsServer) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/time_rfc3339.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) - -const ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/usages_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/usages_server.go index c0d4af2745c6..c62063939b37 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/usages_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/usages_server.go @@ -1,6 +1,3 @@ -//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. @@ -53,21 +50,40 @@ func (u *UsagesServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return u.dispatchToMethodFake(req, method) +} - switch method { - case "UsagesClient.NewListPager": - resp, err = u.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (u *UsagesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if usagesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = usagesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "UsagesClient.NewListPager": + res.resp, res.err = u.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (u *UsagesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -118,3 +134,9 @@ func (u *UsagesServerTransport) dispatchNewListPager(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to UsagesServerTransport +var usagesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod index d975d3448ba2..8026a90bbe90 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/a go 1.23.0 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -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-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/interfaces.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/interfaces.go new file mode 100644 index 000000000000..ddacbc55a2c9 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/interfaces.go @@ -0,0 +1,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 + +// ConnectionPropertiesV2Classification provides polymorphic access to related types. +// Call the interface's GetConnectionPropertiesV2() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AADAuthTypeConnectionProperties, *APIKeyAuthConnectionProperties, *AccessKeyAuthTypeConnectionProperties, *AccountKeyAuthTypeConnectionProperties, +// - *ConnectionPropertiesV2, *CustomKeysConnectionProperties, *ManagedIdentityAuthTypeConnectionProperties, *NoneAuthTypeConnectionProperties, +// - *OAuth2AuthTypeConnectionProperties, *PATAuthTypeConnectionProperties, *SASAuthTypeConnectionProperties, *ServicePrincipalAuthTypeConnectionProperties, +// - *UsernamePasswordAuthTypeConnectionProperties +type ConnectionPropertiesV2Classification interface { + // GetConnectionPropertiesV2 returns the ConnectionPropertiesV2 content of the underlying type. + GetConnectionPropertiesV2() *ConnectionPropertiesV2 +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client.go index 514e8b3545a1..7671f11884cc 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client.go @@ -1,6 +1,3 @@ -//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. @@ -45,7 +42,7 @@ func NewLocationBasedModelCapacitiesClient(subscriptionID string, credential azc // NewListPager - List Location Based ModelCapacities. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - location - Resource location. // - modelFormat - The format of the Model // - modelName - The name of the Model @@ -76,7 +73,7 @@ func (client *LocationBasedModelCapacitiesClient) NewListPager(location string, } // listCreateRequest creates the List request. -func (client *LocationBasedModelCapacitiesClient) listCreateRequest(ctx context.Context, location string, modelFormat string, modelName string, modelVersion string, options *LocationBasedModelCapacitiesClientListOptions) (*policy.Request, error) { +func (client *LocationBasedModelCapacitiesClient) listCreateRequest(ctx context.Context, location string, modelFormat string, modelName string, modelVersion string, _ *LocationBasedModelCapacitiesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/modelCapacities" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -91,7 +88,7 @@ func (client *LocationBasedModelCapacitiesClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") reqQP.Set("modelFormat", modelFormat) reqQP.Set("modelName", modelName) reqQP.Set("modelVersion", modelVersion) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client_example_test.go deleted file mode 100644 index 59c65490e60f..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client_example_test.go +++ /dev/null @@ -1,62 +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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListLocationBasedModelCapacities.json -func ExampleLocationBasedModelCapacitiesClient_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.NewLocationBasedModelCapacitiesClient().NewListPager("WestUS", "OpenAI", "ada", "1", 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.ModelCapacityListResult = armcognitiveservices.ModelCapacityListResult{ - // Value: []*armcognitiveservices.ModelCapacityListResultValueItem{ - // { - // Name: to.Ptr("Standard"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/models/skuCapacities"), - // ID: to.Ptr("/subscriptions/{subscriptionContext.SubscriptionId}/providers/Microsoft.CognitiveServices/locations/WestUS/models/OpenAI.ada.1/skuCapacities/Standard"), - // Location: to.Ptr("WestUS"), - // Properties: &armcognitiveservices.ModelSKUCapacityProperties{ - // AvailableCapacity: to.Ptr[float32](300), - // AvailableFinetuneCapacity: to.Ptr[float32](20), - // Model: &armcognitiveservices.DeploymentModel{ - // Name: to.Ptr("ada"), - // Format: to.Ptr("OpenAI"), - // Version: to.Ptr("1"), - // }, - // SKUName: to.Ptr("Standard"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go index 07bfa4f2dfc3..c3f7dc93ed05 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,7 @@ func NewManagementClient(subscriptionID string, credential azcore.TokenCredentia // CalculateModelCapacity - Model capacity calculator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - parameters - Check Domain Availability parameter. // - options - ManagementClientCalculateModelCapacityOptions contains the optional parameters for the ManagementClient.CalculateModelCapacity // method. @@ -73,7 +70,7 @@ func (client *ManagementClient) CalculateModelCapacity(ctx context.Context, para } // calculateModelCapacityCreateRequest creates the CalculateModelCapacity request. -func (client *ManagementClient) calculateModelCapacityCreateRequest(ctx context.Context, parameters CalculateModelCapacityParameter, options *ManagementClientCalculateModelCapacityOptions) (*policy.Request, error) { +func (client *ManagementClient) calculateModelCapacityCreateRequest(ctx context.Context, parameters CalculateModelCapacityParameter, _ *ManagementClientCalculateModelCapacityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/calculateModelCapacity" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -84,7 +81,7 @@ func (client *ManagementClient) calculateModelCapacityCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -105,7 +102,7 @@ func (client *ManagementClient) calculateModelCapacityHandleResponse(resp *http. // CheckDomainAvailability - Check whether a domain is available. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - parameters - Check Domain Availability parameter. // - options - ManagementClientCheckDomainAvailabilityOptions contains the optional parameters for the ManagementClient.CheckDomainAvailability // method. @@ -132,7 +129,7 @@ func (client *ManagementClient) CheckDomainAvailability(ctx context.Context, par } // checkDomainAvailabilityCreateRequest creates the CheckDomainAvailability request. -func (client *ManagementClient) checkDomainAvailabilityCreateRequest(ctx context.Context, parameters CheckDomainAvailabilityParameter, options *ManagementClientCheckDomainAvailabilityOptions) (*policy.Request, error) { +func (client *ManagementClient) checkDomainAvailabilityCreateRequest(ctx context.Context, parameters CheckDomainAvailabilityParameter, _ *ManagementClientCheckDomainAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -143,7 +140,7 @@ func (client *ManagementClient) checkDomainAvailabilityCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -164,7 +161,7 @@ func (client *ManagementClient) checkDomainAvailabilityHandleResponse(resp *http // CheckSKUAvailability - Check available SKUs. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - location - Resource location. // - parameters - Check SKU Availability POST body. // - options - ManagementClientCheckSKUAvailabilityOptions contains the optional parameters for the ManagementClient.CheckSKUAvailability @@ -192,7 +189,7 @@ func (client *ManagementClient) CheckSKUAvailability(ctx context.Context, locati } // checkSKUAvailabilityCreateRequest creates the CheckSKUAvailability request. -func (client *ManagementClient) checkSKUAvailabilityCreateRequest(ctx context.Context, location string, parameters CheckSKUAvailabilityParameter, options *ManagementClientCheckSKUAvailabilityOptions) (*policy.Request, error) { +func (client *ManagementClient) checkSKUAvailabilityCreateRequest(ctx context.Context, location string, parameters CheckSKUAvailabilityParameter, _ *ManagementClientCheckSKUAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -207,7 +204,7 @@ func (client *ManagementClient) checkSKUAvailabilityCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 40f272e2afa6..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client_example_test.go +++ /dev/null @@ -1,136 +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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CalculateModelCapacity.json -func ExampleManagementClient_CalculateModelCapacity() { - 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().CalculateModelCapacity(ctx, armcognitiveservices.CalculateModelCapacityParameter{ - Model: &armcognitiveservices.DeploymentModel{ - Name: to.Ptr("gpt-4"), - Format: to.Ptr("OpenAI"), - Version: to.Ptr("0613"), - }, - SKUName: to.Ptr("ProvisionedManaged"), - Workloads: []*armcognitiveservices.ModelCapacityCalculatorWorkload{ - { - RequestParameters: &armcognitiveservices.ModelCapacityCalculatorWorkloadRequestParam{ - AvgGeneratedTokens: to.Ptr[int64](50), - AvgPromptTokens: to.Ptr[int64](30), - }, - RequestPerMinute: to.Ptr[int64](10), - }, - { - RequestParameters: &armcognitiveservices.ModelCapacityCalculatorWorkloadRequestParam{ - AvgGeneratedTokens: to.Ptr[int64](20), - AvgPromptTokens: to.Ptr[int64](60), - }, - RequestPerMinute: to.Ptr[int64](20), - }}, - }, 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.CalculateModelCapacityResult = armcognitiveservices.CalculateModelCapacityResult{ - // EstimatedCapacity: &armcognitiveservices.CalculateModelCapacityResultEstimatedCapacity{ - // DeployableValue: to.Ptr[int32](400), - // Value: to.Ptr[int32](346), - // }, - // Model: &armcognitiveservices.DeploymentModel{ - // Name: to.Ptr("gpt-4"), - // Format: to.Ptr("OpenAI"), - // Version: to.Ptr("0613"), - // }, - // SKUName: to.Ptr("ProvisionedManaged"), - // } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client.go index 9a4be0a60356..5f9bf8855675 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client.go @@ -1,6 +1,3 @@ -//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. @@ -45,7 +42,7 @@ func NewModelCapacitiesClient(subscriptionID string, credential azcore.TokenCred // NewListPager - List ModelCapacities. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - modelFormat - The format of the Model // - modelName - The name of the Model // - modelVersion - The version of the Model @@ -75,7 +72,7 @@ func (client *ModelCapacitiesClient) NewListPager(modelFormat string, modelName } // listCreateRequest creates the List request. -func (client *ModelCapacitiesClient) listCreateRequest(ctx context.Context, modelFormat string, modelName string, modelVersion string, options *ModelCapacitiesClientListOptions) (*policy.Request, error) { +func (client *ModelCapacitiesClient) listCreateRequest(ctx context.Context, modelFormat string, modelName string, modelVersion string, _ *ModelCapacitiesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/modelCapacities" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -86,7 +83,7 @@ func (client *ModelCapacitiesClient) listCreateRequest(ctx context.Context, mode return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") reqQP.Set("modelFormat", modelFormat) reqQP.Set("modelName", modelName) reqQP.Set("modelVersion", modelVersion) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client_example_test.go deleted file mode 100644 index a4a7322798b1..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client_example_test.go +++ /dev/null @@ -1,62 +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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListModelCapacities.json -func ExampleModelCapacitiesClient_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.NewModelCapacitiesClient().NewListPager("OpenAI", "ada", "1", 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.ModelCapacityListResult = armcognitiveservices.ModelCapacityListResult{ - // Value: []*armcognitiveservices.ModelCapacityListResultValueItem{ - // { - // Name: to.Ptr("Standard"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/models/skuCapacities"), - // ID: to.Ptr("/subscriptions/{subscriptionContext.SubscriptionId}/providers/Microsoft.CognitiveServices/locations/WestUS/models/OpenAI.ada.1/skuCapacities/Standard"), - // Location: to.Ptr("WestUS"), - // Properties: &armcognitiveservices.ModelSKUCapacityProperties{ - // AvailableCapacity: to.Ptr[float32](300), - // AvailableFinetuneCapacity: to.Ptr[float32](20), - // Model: &armcognitiveservices.DeploymentModel{ - // Name: to.Ptr("ada"), - // Format: to.Ptr("OpenAI"), - // Version: to.Ptr("1"), - // }, - // SKUName: to.Ptr("Standard"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go index 2acc95538e89..63dc61b631c9 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go @@ -1,6 +1,3 @@ -//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. @@ -10,6 +7,122 @@ package armcognitiveservices import "time" +// AADAuthTypeConnectionProperties - This connection type covers the AAD auth for any applicable Azure service +type AADAuthTypeConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type AADAuthTypeConnectionProperties. +func (a *AADAuthTypeConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: a.AuthType, + Category: a.Category, + CreatedByWorkspaceArmID: a.CreatedByWorkspaceArmID, + Error: a.Error, + ExpiryTime: a.ExpiryTime, + Group: a.Group, + IsSharedToAll: a.IsSharedToAll, + Metadata: a.Metadata, + PeRequirement: a.PeRequirement, + PeStatus: a.PeStatus, + SharedUserList: a.SharedUserList, + Target: a.Target, + UseWorkspaceManagedIdentity: a.UseWorkspaceManagedIdentity, + } +} + +// APIKeyAuthConnectionProperties - This connection type covers the generic ApiKey auth connection categories, for examples: +// AzureOpenAI: Category:= AzureOpenAI AuthType:= ApiKey (as type discriminator) Credentials:= {ApiKey} as .ApiKey +// Target:= {ApiBase} +// CognitiveService: Category:= CognitiveService AuthType:= ApiKey (as type discriminator) Credentials:= {SubscriptionKey} +// as ApiKey Target:= ServiceRegion={serviceRegion} +// CognitiveSearch: Category:= CognitiveSearch AuthType:= ApiKey (as type discriminator) Credentials:= {Key} as ApiKey Target:= +// {Endpoint} +// Use Metadata property bag for ApiType, ApiVersion, Kind and other metadata fields +type APIKeyAuthConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + + // Api key object for connection credential. + Credentials *ConnectionAPIKey + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type APIKeyAuthConnectionProperties. +func (a *APIKeyAuthConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: a.AuthType, + Category: a.Category, + CreatedByWorkspaceArmID: a.CreatedByWorkspaceArmID, + Error: a.Error, + ExpiryTime: a.ExpiryTime, + Group: a.Group, + IsSharedToAll: a.IsSharedToAll, + Metadata: a.Metadata, + PeRequirement: a.PeRequirement, + PeStatus: a.PeStatus, + SharedUserList: a.SharedUserList, + Target: a.Target, + UseWorkspaceManagedIdentity: a.UseWorkspaceManagedIdentity, + } +} + // APIKeys - The access keys for the cognitive services account. type APIKeys struct { // Gets the value of key 1. @@ -67,6 +180,59 @@ type AbusePenalty struct { RateLimitPercentage *float32 } +type AccessKeyAuthTypeConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + Credentials *ConnectionAccessKey + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type AccessKeyAuthTypeConnectionProperties. +func (a *AccessKeyAuthTypeConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: a.AuthType, + Category: a.Category, + CreatedByWorkspaceArmID: a.CreatedByWorkspaceArmID, + Error: a.Error, + ExpiryTime: a.ExpiryTime, + Group: a.Group, + IsSharedToAll: a.IsSharedToAll, + Metadata: a.Metadata, + PeRequirement: a.PeRequirement, + PeStatus: a.PeStatus, + SharedUserList: a.SharedUserList, + Target: a.Target, + UseWorkspaceManagedIdentity: a.UseWorkspaceManagedIdentity, + } +} + // Account - Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and // SKU. type Account struct { @@ -104,6 +270,62 @@ type Account struct { Type *string } +// AccountKeyAuthTypeConnectionProperties - This connection type covers the account key connection for Azure storage +type AccountKeyAuthTypeConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + + // Account key object for connection credential. + Credentials *ConnectionAccountKey + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type AccountKeyAuthTypeConnectionProperties. +func (a *AccountKeyAuthTypeConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: a.AuthType, + Category: a.Category, + CreatedByWorkspaceArmID: a.CreatedByWorkspaceArmID, + Error: a.Error, + ExpiryTime: a.ExpiryTime, + Group: a.Group, + IsSharedToAll: a.IsSharedToAll, + Metadata: a.Metadata, + PeRequirement: a.PeRequirement, + PeStatus: a.PeStatus, + SharedUserList: a.SharedUserList, + Target: a.Target, + UseWorkspaceManagedIdentity: a.UseWorkspaceManagedIdentity, + } +} + // AccountListResult - The list of cognitive services accounts operation response. type AccountListResult struct { // The link used to get the next page of accounts. @@ -178,15 +400,25 @@ type AccountModelListResult struct { // AccountProperties - Properties of Cognitive Services account. type AccountProperties struct { // The api properties for special APIs. - APIProperties *APIProperties - AllowedFqdnList []*string + APIProperties *APIProperties - // The user owned AML workspace properties. + // Specifies whether this resource support project management as child resources, used as containers for access management, + // data isolation and cost in AI Foundry. + AllowProjectManagement *bool + AllowedFqdnList []*string + + // The user owned AML account properties. AmlWorkspace *UserOwnedAmlWorkspace + // Specifies the projects, by project name, that are associated with this resource. + AssociatedProjects []*string + // Optional subdomain name used for token-based authentication. CustomSubDomainName *string - DisableLocalAuth *bool + + // Specifies the project, by project name, that is targeted when data plane endpoints are called without a project parameter. + DefaultProject *string + DisableLocalAuth *bool // The flag to enable dynamic throttling. DynamicThrottlingEnabled *bool @@ -203,6 +435,11 @@ type AccountProperties struct { // A collection of rules governing the accessibility from specific network locations. NetworkACLs *NetworkRuleSet + // Specifies in AI Foundry where virtual network injection occurs to secure scenarios like Agents entirely within the user's + // private network, eliminating public internet exposure while maintaining + // control over network configurations and resources. + NetworkInjections *NetworkInjections + // Whether or not public endpoint access is allowed for this account. PublicNetworkAccess *PublicNetworkAccess @@ -335,6 +572,50 @@ type CallRateLimit struct { Rules []*ThrottlingRule } +// CapabilityHost - Azure Resource Manager resource envelope. +type CapabilityHost struct { + // REQUIRED; [Required] Additional attributes of the entity. + Properties *CapabilityHostProperties + + // 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +type CapabilityHostProperties struct { + // List of AI services connections. + AiServicesConnections []*string + + // Kind of this capability host. + CapabilityHostKind *CapabilityHostKind + + // Customer subnet info to help set up this capability host. + CustomerSubnet *string + + // The asset description text. + Description *string + + // List of connection names from those available in the account or project to be used as a storage resource. + StorageConnections []*string + + // Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string + + // List of connection names from those available in the account or project to be used for Thread storage. + ThreadStorageConnections []*string + + // List of connection names from those available in the account or project to be used for vector database (e.g. CosmosDB). + VectorStoreConnections []*string + + // READ-ONLY; Provisioning state for the CapabilityHost. + ProvisioningState *CapabilityHostProvisioningState +} + // CapacityConfig - The capacity configuration. type CapacityConfig struct { // The array of allowed values for capacity. @@ -570,6 +851,136 @@ type CommitmentTierListResult struct { Value []*CommitmentTier } +// ConnectionAPIKey - Api key object for connection credential. +type ConnectionAPIKey struct { + Key *string +} + +type ConnectionAccessKey struct { + AccessKeyID *string + SecretAccessKey *string +} + +// ConnectionAccountKey - Account key object for connection credential. +type ConnectionAccountKey struct { + Key *string +} + +type ConnectionManagedIdentity struct { + ClientID *string + ResourceID *string +} + +// ConnectionOAuth2 - ClientId and ClientSecret are required. Other properties are optional depending on each OAuth2 provider's +// implementation. +type ConnectionOAuth2 struct { + // Required by Concur connection category + AuthURL *string + + // Client id in the format of UUID + ClientID *string + ClientSecret *string + + // Required by GoogleAdWords connection category + DeveloperToken *string + Password *string + + // Required by GoogleBigQuery, GoogleAdWords, Hubspot, QuickBooks, Square, Xero, Zoho where user needs to get RefreshToken + // offline + RefreshToken *string + + // Required by QuickBooks and Xero connection categories + TenantID *string + + // Concur, ServiceNow auth server AccessToken grant type is 'Password' which requires UsernamePassword + Username *string +} + +type ConnectionPersonalAccessToken struct { + Pat *string +} + +// ConnectionPropertiesV2 - Connection property base schema. +type ConnectionPropertiesV2 struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type ConnectionPropertiesV2. +func (c *ConnectionPropertiesV2) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { return c } + +// ConnectionPropertiesV2BasicResource - Connection base resource schema. +type ConnectionPropertiesV2BasicResource struct { + // REQUIRED; Connection property base schema. + Properties ConnectionPropertiesV2Classification + + // 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +type ConnectionPropertiesV2BasicResourceArmPaginatedResult struct { + NextLink *string + Value []*ConnectionPropertiesV2BasicResource +} + +type ConnectionServicePrincipal struct { + ClientID *string + ClientSecret *string + TenantID *string +} + +type ConnectionSharedAccessSignature struct { + Sas *string +} + +// ConnectionUpdateContent - The properties that the Cognitive services connection will be updated with. +type ConnectionUpdateContent struct { + // The properties that the Cognitive services connection will be updated with. + Properties ConnectionPropertiesV2Classification +} + +type ConnectionUsernamePassword struct { + Password *string + + // Optional, required by connections like SalesForce for extra security in addition to UsernamePassword + SecurityToken *string + Username *string +} + // CustomBlocklistConfig - Gets or sets the source to which filter applies. type CustomBlocklistConfig struct { // If blocking would occur. @@ -582,6 +993,69 @@ type CustomBlocklistConfig struct { Source *RaiPolicyContentSource } +// CustomKeys - Custom Keys credential object +type CustomKeys struct { + // Dictionary of + Keys map[string]*string +} + +// CustomKeysConnectionProperties - Category:= CustomKeys AuthType:= CustomKeys (as type discriminator) Credentials:= {CustomKeys} +// as CustomKeys Target:= {any value} Use Metadata property bag for ApiVersion and other metadata fields +type CustomKeysConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + + // Custom Keys credential object + Credentials *CustomKeys + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type CustomKeysConnectionProperties. +func (c *CustomKeysConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: c.AuthType, + Category: c.Category, + CreatedByWorkspaceArmID: c.CreatedByWorkspaceArmID, + Error: c.Error, + ExpiryTime: c.ExpiryTime, + Group: c.Group, + IsSharedToAll: c.IsSharedToAll, + Metadata: c.Metadata, + PeRequirement: c.PeRequirement, + PeStatus: c.PeStatus, + SharedUserList: c.SharedUserList, + Target: c.Target, + UseWorkspaceManagedIdentity: c.UseWorkspaceManagedIdentity, + } +} + // DefenderForAISetting - The Defender for AI resource. type DefenderForAISetting struct { // The Defender for AI resource properties. @@ -712,6 +1186,10 @@ type DeploymentProperties struct { // Properties of Cognitive Services account deployment model. (Deprecated, please use Deployment.sku instead.) ScaleSettings *DeploymentScaleSettings + // Specifies the deployment name that should serve requests when the request would have otherwise been throttled due to reaching + // current deployment throughput limit. + SpilloverDeploymentName *string + // Deployment model version upgrade option. VersionUpgradeOption *DeploymentModelVersionUpgradeOption @@ -900,6 +1378,59 @@ type KeyVaultProperties struct { KeyVersion *string } +type ManagedIdentityAuthTypeConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + Credentials *ConnectionManagedIdentity + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type ManagedIdentityAuthTypeConnectionProperties. +func (m *ManagedIdentityAuthTypeConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: m.AuthType, + Category: m.Category, + CreatedByWorkspaceArmID: m.CreatedByWorkspaceArmID, + Error: m.Error, + ExpiryTime: m.ExpiryTime, + Group: m.Group, + IsSharedToAll: m.IsSharedToAll, + Metadata: m.Metadata, + PeRequirement: m.PeRequirement, + PeStatus: m.PeStatus, + SharedUserList: m.SharedUserList, + Target: m.Target, + UseWorkspaceManagedIdentity: m.UseWorkspaceManagedIdentity, + } +} + // MetricName - A metric name. type MetricName struct { // The friendly name of the metric. @@ -1028,6 +1559,21 @@ type MultiRegionSettings struct { RoutingMethod *RoutingMethods } +// NetworkInjections - Specifies in AI Foundry where virtual network injection occurs to secure scenarios like Agents entirely +// within the user's private network, eliminating public internet exposure while maintaining +// control over network configurations and resources. +type NetworkInjections struct { + // Specifies what features in AI Foundry network injection applies to. Currently only supports 'agent' for agent scenarios. + // 'none' means no network injection. + Scenario *ScenarioType + + // Specify the subnet for which your Agent Client is injected into. + SubnetArmID *string + + // Boolean to enable Microsoft Managed Network for subnet delegation + UseMicrosoftManagedNetwork *bool +} + // NetworkRuleSet - A set of rules governing the network accessibility. type NetworkRuleSet struct { // Setting for trusted services. @@ -1157,6 +1703,113 @@ type NetworkSecurityPerimeterProfileInfo struct { Name *string } +type NoneAuthTypeConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type NoneAuthTypeConnectionProperties. +func (n *NoneAuthTypeConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: n.AuthType, + Category: n.Category, + CreatedByWorkspaceArmID: n.CreatedByWorkspaceArmID, + Error: n.Error, + ExpiryTime: n.ExpiryTime, + Group: n.Group, + IsSharedToAll: n.IsSharedToAll, + Metadata: n.Metadata, + PeRequirement: n.PeRequirement, + PeStatus: n.PeStatus, + SharedUserList: n.SharedUserList, + Target: n.Target, + UseWorkspaceManagedIdentity: n.UseWorkspaceManagedIdentity, + } +} + +type OAuth2AuthTypeConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + + // ClientId and ClientSecret are required. Other properties are optional depending on each OAuth2 provider's implementation. + Credentials *ConnectionOAuth2 + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type OAuth2AuthTypeConnectionProperties. +func (o *OAuth2AuthTypeConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: o.AuthType, + Category: o.Category, + CreatedByWorkspaceArmID: o.CreatedByWorkspaceArmID, + Error: o.Error, + ExpiryTime: o.ExpiryTime, + Group: o.Group, + IsSharedToAll: o.IsSharedToAll, + Metadata: o.Metadata, + PeRequirement: o.PeRequirement, + PeStatus: o.PeStatus, + SharedUserList: o.SharedUserList, + Target: o.Target, + UseWorkspaceManagedIdentity: o.UseWorkspaceManagedIdentity, + } +} + // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -1206,6 +1859,59 @@ type OperationListResult struct { Value []*Operation } +type PATAuthTypeConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + Credentials *ConnectionPersonalAccessToken + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type PATAuthTypeConnectionProperties. +func (p *PATAuthTypeConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: p.AuthType, + Category: p.Category, + CreatedByWorkspaceArmID: p.CreatedByWorkspaceArmID, + Error: p.Error, + ExpiryTime: p.ExpiryTime, + Group: p.Group, + IsSharedToAll: p.IsSharedToAll, + Metadata: p.Metadata, + PeRequirement: p.PeRequirement, + PeStatus: p.PeStatus, + SharedUserList: p.SharedUserList, + Target: p.Target, + UseWorkspaceManagedIdentity: p.UseWorkspaceManagedIdentity, + } +} + // PatchResourceTags - The object being used to update tags of a resource, in general used for PATCH operations. type PatchResourceTags struct { // Resource tags. @@ -1321,6 +2027,64 @@ type PrivateLinkServiceConnectionState struct { Status *PrivateEndpointServiceConnectionStatus } +// Project - Cognitive Services project is an Azure resource representing the provisioned account's project, it's type, location +// and SKU. +type Project struct { + // Identity for the resource. + Identity *Identity + + // The geo-location where the resource lives + Location *string + + // Properties of Cognitive Services project. + Properties *ProjectProperties + + // 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 +} + +// ProjectListResult - The list of cognitive services projects operation response. +type ProjectListResult struct { + // The link used to get the next page of projects. + NextLink *string + + // READ-ONLY; Gets the list of Cognitive Services projects and their properties. + Value []*Project +} + +// ProjectProperties - Properties of Cognitive Services Project'. +type ProjectProperties struct { + // The description of the Cognitive Services Project. + Description *string + + // The display name of the Cognitive Services Project. + DisplayName *string + + // READ-ONLY; The list of endpoint for this Cognitive Services Project. + Endpoints map[string]*string + + // READ-ONLY; Indicates whether the project is the default project for the account. + IsDefault *bool + + // READ-ONLY; Gets the status of the cognitive services project at the time the operation was called. + ProvisioningState *ProvisioningState +} + type ProvisioningIssue struct { // Name of the NSP provisioning issue Name *string @@ -1572,7 +2336,7 @@ type RaiPolicyProperties struct { CustomBlocklists []*CustomBlocklistConfig // Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronousfilter =3. Please - // use 'Asynchronousfilter' after 2024-10-01. It is the same as 'Deferred' in + // use 'Asynchronousfilter' after 2025-06-01. It is the same as 'Deferred' in // previous version. Mode *RaiPolicyMode @@ -1615,6 +2379,14 @@ type Resource struct { Type *string } +type ResourceBase struct { + // The asset description text. + Description *string + + // Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string +} + // ResourceSKU - Describes an available Cognitive Services SKU. type ResourceSKU struct { // The Kind of resources that are supported in this SKU. @@ -1669,6 +2441,59 @@ type ResourceSKURestrictions struct { Values []*string } +type SASAuthTypeConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + Credentials *ConnectionSharedAccessSignature + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type SASAuthTypeConnectionProperties. +func (s *SASAuthTypeConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: s.AuthType, + Category: s.Category, + CreatedByWorkspaceArmID: s.CreatedByWorkspaceArmID, + Error: s.Error, + ExpiryTime: s.ExpiryTime, + Group: s.Group, + IsSharedToAll: s.IsSharedToAll, + Metadata: s.Metadata, + PeRequirement: s.PeRequirement, + PeStatus: s.PeStatus, + SharedUserList: s.SharedUserList, + Target: s.Target, + UseWorkspaceManagedIdentity: s.UseWorkspaceManagedIdentity, + } +} + // 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 @@ -1749,6 +2574,59 @@ type SKUResource struct { SKU *SKU } +type ServicePrincipalAuthTypeConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + Credentials *ConnectionServicePrincipal + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type ServicePrincipalAuthTypeConnectionProperties. +func (s *ServicePrincipalAuthTypeConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: s.AuthType, + Category: s.Category, + CreatedByWorkspaceArmID: s.CreatedByWorkspaceArmID, + Error: s.Error, + ExpiryTime: s.ExpiryTime, + Group: s.Group, + IsSharedToAll: s.IsSharedToAll, + Metadata: s.Metadata, + PeRequirement: s.PeRequirement, + PeStatus: s.PeStatus, + SharedUserList: s.SharedUserList, + Target: s.Target, + UseWorkspaceManagedIdentity: s.UseWorkspaceManagedIdentity, + } +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -1821,12 +2699,12 @@ type UserAssignedIdentity struct { PrincipalID *string } -// UserOwnedAmlWorkspace - The user owned AML workspace for Cognitive Services account. +// UserOwnedAmlWorkspace - The user owned AML account for Cognitive Services account. type UserOwnedAmlWorkspace struct { - // Identity Client id of a AML workspace resource. + // Identity Client id of a AML account resource. IdentityClientID *string - // Full resource id of a AML workspace resource. + // Full resource id of a AML account resource. ResourceID *string } @@ -1838,6 +2716,59 @@ type UserOwnedStorage struct { ResourceID *string } +type UsernamePasswordAuthTypeConnectionProperties struct { + // REQUIRED; Authentication type of the connection target + AuthType *ConnectionAuthType + + // Category of the connection + Category *ConnectionCategory + Credentials *ConnectionUsernamePassword + + // Provides the error message if the connection fails + Error *string + ExpiryTime *time.Time + IsSharedToAll *bool + + // Store user metadata for this connection + Metadata map[string]*string + + // Specifies how private endpoints are used with this connection: 'Required', 'NotRequired', or 'NotApplicable'. + PeRequirement *ManagedPERequirement + + // Specifies the status of private endpoints for this connection: 'Inactive', 'Active', or 'NotApplicable'. + PeStatus *ManagedPEStatus + SharedUserList []*string + + // The connection URL to be used. + Target *string + UseWorkspaceManagedIdentity *bool + + // READ-ONLY + CreatedByWorkspaceArmID *string + + // READ-ONLY; Group based on connection category + Group *ConnectionGroup +} + +// GetConnectionPropertiesV2 implements the ConnectionPropertiesV2Classification interface for type UsernamePasswordAuthTypeConnectionProperties. +func (u *UsernamePasswordAuthTypeConnectionProperties) GetConnectionPropertiesV2() *ConnectionPropertiesV2 { + return &ConnectionPropertiesV2{ + AuthType: u.AuthType, + Category: u.Category, + CreatedByWorkspaceArmID: u.CreatedByWorkspaceArmID, + Error: u.Error, + ExpiryTime: u.ExpiryTime, + Group: u.Group, + IsSharedToAll: u.IsSharedToAll, + Metadata: u.Metadata, + PeRequirement: u.PeRequirement, + PeStatus: u.PeStatus, + SharedUserList: u.SharedUserList, + Target: u.Target, + UseWorkspaceManagedIdentity: u.UseWorkspaceManagedIdentity, + } +} + // VirtualNetworkRule - A rule governing the accessibility from a specific virtual network. type VirtualNetworkRule struct { // REQUIRED; Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go index ccebf9f86b24..21a3b3c316c7 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go @@ -1,6 +1,3 @@ -//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. @@ -45,7 +42,7 @@ func NewModelsClient(subscriptionID string, credential azcore.TokenCredential, o // NewListPager - List Models. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - location - Resource location. // - options - ModelsClientListOptions contains the optional parameters for the ModelsClient.NewListPager method. func (client *ModelsClient) NewListPager(location string, options *ModelsClientListOptions) *runtime.Pager[ModelsClientListResponse] { @@ -72,7 +69,7 @@ func (client *ModelsClient) NewListPager(location string, options *ModelsClientL } // listCreateRequest creates the List request. -func (client *ModelsClient) listCreateRequest(ctx context.Context, location string, options *ModelsClientListOptions) (*policy.Request, error) { +func (client *ModelsClient) listCreateRequest(ctx context.Context, location string, _ *ModelsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/models" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -87,7 +84,7 @@ func (client *ModelsClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") 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 a7428563c875..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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListLocationModels.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:00.000Z"); return t}()), - // CreatedBy: to.Ptr("Microsoft"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-07T00:00:00.000Z"); 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 8f2ab6234348..f8a94ebe4f9d 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go @@ -1,6 +1,3 @@ -//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. @@ -15,6 +12,160 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type AADAuthTypeConnectionProperties. +func (a AADAuthTypeConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = ConnectionAuthTypeAAD + populate(objectMap, "category", a.Category) + populate(objectMap, "createdByWorkspaceArmId", a.CreatedByWorkspaceArmID) + populate(objectMap, "error", a.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", a.ExpiryTime) + populate(objectMap, "group", a.Group) + populate(objectMap, "isSharedToAll", a.IsSharedToAll) + populate(objectMap, "metadata", a.Metadata) + populate(objectMap, "peRequirement", a.PeRequirement) + populate(objectMap, "peStatus", a.PeStatus) + populate(objectMap, "sharedUserList", a.SharedUserList) + populate(objectMap, "target", a.Target) + populate(objectMap, "useWorkspaceManagedIdentity", a.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADAuthTypeConnectionProperties. +func (a *AADAuthTypeConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &a.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &a.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &a.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &a.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &a.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &a.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &a.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &a.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &a.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &a.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &a.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &a.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &a.UseWorkspaceManagedIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type APIKeyAuthConnectionProperties. +func (a APIKeyAuthConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = ConnectionAuthTypeAPIKey + populate(objectMap, "category", a.Category) + populate(objectMap, "createdByWorkspaceArmId", a.CreatedByWorkspaceArmID) + populate(objectMap, "credentials", a.Credentials) + populate(objectMap, "error", a.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", a.ExpiryTime) + populate(objectMap, "group", a.Group) + populate(objectMap, "isSharedToAll", a.IsSharedToAll) + populate(objectMap, "metadata", a.Metadata) + populate(objectMap, "peRequirement", a.PeRequirement) + populate(objectMap, "peStatus", a.PeStatus) + populate(objectMap, "sharedUserList", a.SharedUserList) + populate(objectMap, "target", a.Target) + populate(objectMap, "useWorkspaceManagedIdentity", a.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIKeyAuthConnectionProperties. +func (a *APIKeyAuthConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &a.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &a.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &a.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &a.Credentials) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &a.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &a.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &a.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &a.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &a.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &a.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &a.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &a.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &a.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &a.UseWorkspaceManagedIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type APIKeys. func (a APIKeys) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -159,6 +310,85 @@ func (a *AbusePenalty) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccessKeyAuthTypeConnectionProperties. +func (a AccessKeyAuthTypeConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = ConnectionAuthTypeAccessKey + populate(objectMap, "category", a.Category) + populate(objectMap, "createdByWorkspaceArmId", a.CreatedByWorkspaceArmID) + populate(objectMap, "credentials", a.Credentials) + populate(objectMap, "error", a.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", a.ExpiryTime) + populate(objectMap, "group", a.Group) + populate(objectMap, "isSharedToAll", a.IsSharedToAll) + populate(objectMap, "metadata", a.Metadata) + populate(objectMap, "peRequirement", a.PeRequirement) + populate(objectMap, "peStatus", a.PeStatus) + populate(objectMap, "sharedUserList", a.SharedUserList) + populate(objectMap, "target", a.Target) + populate(objectMap, "useWorkspaceManagedIdentity", a.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessKeyAuthTypeConnectionProperties. +func (a *AccessKeyAuthTypeConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &a.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &a.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &a.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &a.Credentials) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &a.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &a.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &a.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &a.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &a.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &a.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &a.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &a.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &a.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &a.UseWorkspaceManagedIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Account. func (a Account) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -226,6 +456,85 @@ func (a *Account) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccountKeyAuthTypeConnectionProperties. +func (a AccountKeyAuthTypeConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = ConnectionAuthTypeAccountKey + populate(objectMap, "category", a.Category) + populate(objectMap, "createdByWorkspaceArmId", a.CreatedByWorkspaceArmID) + populate(objectMap, "credentials", a.Credentials) + populate(objectMap, "error", a.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", a.ExpiryTime) + populate(objectMap, "group", a.Group) + populate(objectMap, "isSharedToAll", a.IsSharedToAll) + populate(objectMap, "metadata", a.Metadata) + populate(objectMap, "peRequirement", a.PeRequirement) + populate(objectMap, "peStatus", a.PeStatus) + populate(objectMap, "sharedUserList", a.SharedUserList) + populate(objectMap, "target", a.Target) + populate(objectMap, "useWorkspaceManagedIdentity", a.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountKeyAuthTypeConnectionProperties. +func (a *AccountKeyAuthTypeConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &a.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &a.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &a.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &a.Credentials) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &a.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &a.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &a.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &a.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &a.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &a.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &a.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &a.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &a.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &a.UseWorkspaceManagedIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AccountListResult. func (a AccountListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -380,13 +689,16 @@ func (a AccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "apiProperties", a.APIProperties) populate(objectMap, "abusePenalty", a.AbusePenalty) + populate(objectMap, "allowProjectManagement", a.AllowProjectManagement) populate(objectMap, "allowedFqdnList", a.AllowedFqdnList) populate(objectMap, "amlWorkspace", a.AmlWorkspace) + populate(objectMap, "associatedProjects", a.AssociatedProjects) populate(objectMap, "callRateLimit", a.CallRateLimit) populate(objectMap, "capabilities", a.Capabilities) populate(objectMap, "commitmentPlanAssociations", a.CommitmentPlanAssociations) populate(objectMap, "customSubDomainName", a.CustomSubDomainName) populate(objectMap, "dateCreated", a.DateCreated) + populate(objectMap, "defaultProject", a.DefaultProject) populate(objectMap, "deletionDate", a.DeletionDate) populate(objectMap, "disableLocalAuth", a.DisableLocalAuth) populate(objectMap, "dynamicThrottlingEnabled", a.DynamicThrottlingEnabled) @@ -398,6 +710,7 @@ func (a AccountProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "locations", a.Locations) populate(objectMap, "migrationToken", a.MigrationToken) populate(objectMap, "networkAcls", a.NetworkACLs) + populate(objectMap, "networkInjections", a.NetworkInjections) populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) @@ -426,12 +739,18 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { case "abusePenalty": err = unpopulate(val, "AbusePenalty", &a.AbusePenalty) delete(rawMsg, key) + case "allowProjectManagement": + err = unpopulate(val, "AllowProjectManagement", &a.AllowProjectManagement) + delete(rawMsg, key) case "allowedFqdnList": err = unpopulate(val, "AllowedFqdnList", &a.AllowedFqdnList) delete(rawMsg, key) case "amlWorkspace": err = unpopulate(val, "AmlWorkspace", &a.AmlWorkspace) delete(rawMsg, key) + case "associatedProjects": + err = unpopulate(val, "AssociatedProjects", &a.AssociatedProjects) + delete(rawMsg, key) case "callRateLimit": err = unpopulate(val, "CallRateLimit", &a.CallRateLimit) delete(rawMsg, key) @@ -447,6 +766,9 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { case "dateCreated": err = unpopulate(val, "DateCreated", &a.DateCreated) delete(rawMsg, key) + case "defaultProject": + err = unpopulate(val, "DefaultProject", &a.DefaultProject) + delete(rawMsg, key) case "deletionDate": err = unpopulate(val, "DeletionDate", &a.DeletionDate) delete(rawMsg, key) @@ -480,6 +802,9 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { case "networkAcls": err = unpopulate(val, "NetworkACLs", &a.NetworkACLs) delete(rawMsg, key) + case "networkInjections": + err = unpopulate(val, "NetworkInjections", &a.NetworkInjections) + delete(rawMsg, key) case "privateEndpointConnections": err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) delete(rawMsg, key) @@ -786,6 +1111,104 @@ func (c *CallRateLimit) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CapabilityHost. +func (c CapabilityHost) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapabilityHost. +func (c *CapabilityHost) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CapabilityHostProperties. +func (c CapabilityHostProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aiServicesConnections", c.AiServicesConnections) + populate(objectMap, "capabilityHostKind", c.CapabilityHostKind) + populate(objectMap, "customerSubnet", c.CustomerSubnet) + populate(objectMap, "description", c.Description) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "storageConnections", c.StorageConnections) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "threadStorageConnections", c.ThreadStorageConnections) + populate(objectMap, "vectorStoreConnections", c.VectorStoreConnections) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapabilityHostProperties. +func (c *CapabilityHostProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aiServicesConnections": + err = unpopulate(val, "AiServicesConnections", &c.AiServicesConnections) + delete(rawMsg, key) + case "capabilityHostKind": + err = unpopulate(val, "CapabilityHostKind", &c.CapabilityHostKind) + delete(rawMsg, key) + case "customerSubnet": + err = unpopulate(val, "CustomerSubnet", &c.CustomerSubnet) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "storageConnections": + err = unpopulate(val, "StorageConnections", &c.StorageConnections) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "threadStorageConnections": + err = unpopulate(val, "ThreadStorageConnections", &c.ThreadStorageConnections) + delete(rawMsg, key) + case "vectorStoreConnections": + err = unpopulate(val, "VectorStoreConnections", &c.VectorStoreConnections) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CapacityConfig. func (c CapacityConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1266,16 +1689,566 @@ func (c *CommitmentPlanProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CommitmentQuota. -func (c CommitmentQuota) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CommitmentQuota. +func (c CommitmentQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "quantity", c.Quantity) + populate(objectMap, "unit", c.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommitmentQuota. +func (c *CommitmentQuota) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "quantity": + err = unpopulate(val, "Quantity", &c.Quantity) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &c.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommitmentTier. +func (c CommitmentTier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cost", c.Cost) + populate(objectMap, "hostingModel", c.HostingModel) + populate(objectMap, "kind", c.Kind) + populate(objectMap, "maxCount", c.MaxCount) + populate(objectMap, "planType", c.PlanType) + populate(objectMap, "quota", c.Quota) + populate(objectMap, "skuName", c.SKUName) + populate(objectMap, "tier", c.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommitmentTier. +func (c *CommitmentTier) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cost": + err = unpopulate(val, "Cost", &c.Cost) + delete(rawMsg, key) + case "hostingModel": + err = unpopulate(val, "HostingModel", &c.HostingModel) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &c.Kind) + delete(rawMsg, key) + case "maxCount": + err = unpopulate(val, "MaxCount", &c.MaxCount) + delete(rawMsg, key) + case "planType": + err = unpopulate(val, "PlanType", &c.PlanType) + delete(rawMsg, key) + case "quota": + err = unpopulate(val, "Quota", &c.Quota) + delete(rawMsg, key) + case "skuName": + err = unpopulate(val, "SKUName", &c.SKUName) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &c.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CommitmentTierListResult. +func (c CommitmentTierListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommitmentTierListResult. +func (c *CommitmentTierListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionAPIKey. +func (c ConnectionAPIKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", c.Key) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionAPIKey. +func (c *ConnectionAPIKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "key": + err = unpopulate(val, "Key", &c.Key) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionAccessKey. +func (c ConnectionAccessKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessKeyId", c.AccessKeyID) + populate(objectMap, "secretAccessKey", c.SecretAccessKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionAccessKey. +func (c *ConnectionAccessKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessKeyId": + err = unpopulate(val, "AccessKeyID", &c.AccessKeyID) + delete(rawMsg, key) + case "secretAccessKey": + err = unpopulate(val, "SecretAccessKey", &c.SecretAccessKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionAccountKey. +func (c ConnectionAccountKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", c.Key) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionAccountKey. +func (c *ConnectionAccountKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "key": + err = unpopulate(val, "Key", &c.Key) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionManagedIdentity. +func (c ConnectionManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", c.ClientID) + populate(objectMap, "resourceId", c.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionManagedIdentity. +func (c *ConnectionManagedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &c.ClientID) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &c.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionOAuth2. +func (c ConnectionOAuth2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authUrl", c.AuthURL) + populate(objectMap, "clientId", c.ClientID) + populate(objectMap, "clientSecret", c.ClientSecret) + populate(objectMap, "developerToken", c.DeveloperToken) + populate(objectMap, "password", c.Password) + populate(objectMap, "refreshToken", c.RefreshToken) + populate(objectMap, "tenantId", c.TenantID) + populate(objectMap, "username", c.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionOAuth2. +func (c *ConnectionOAuth2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authUrl": + err = unpopulate(val, "AuthURL", &c.AuthURL) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &c.ClientID) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &c.ClientSecret) + delete(rawMsg, key) + case "developerToken": + err = unpopulate(val, "DeveloperToken", &c.DeveloperToken) + delete(rawMsg, key) + case "password": + err = unpopulate(val, "Password", &c.Password) + delete(rawMsg, key) + case "refreshToken": + err = unpopulate(val, "RefreshToken", &c.RefreshToken) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &c.TenantID) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &c.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionPersonalAccessToken. +func (c ConnectionPersonalAccessToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "pat", c.Pat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionPersonalAccessToken. +func (c *ConnectionPersonalAccessToken) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "pat": + err = unpopulate(val, "Pat", &c.Pat) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionPropertiesV2. +func (c ConnectionPropertiesV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = c.AuthType + populate(objectMap, "category", c.Category) + populate(objectMap, "createdByWorkspaceArmId", c.CreatedByWorkspaceArmID) + populate(objectMap, "error", c.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", c.ExpiryTime) + populate(objectMap, "group", c.Group) + populate(objectMap, "isSharedToAll", c.IsSharedToAll) + populate(objectMap, "metadata", c.Metadata) + populate(objectMap, "peRequirement", c.PeRequirement) + populate(objectMap, "peStatus", c.PeStatus) + populate(objectMap, "sharedUserList", c.SharedUserList) + populate(objectMap, "target", c.Target) + populate(objectMap, "useWorkspaceManagedIdentity", c.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionPropertiesV2. +func (c *ConnectionPropertiesV2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &c.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &c.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &c.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &c.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &c.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &c.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &c.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &c.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &c.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &c.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &c.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &c.UseWorkspaceManagedIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionPropertiesV2BasicResource. +func (c ConnectionPropertiesV2BasicResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionPropertiesV2BasicResource. +func (c *ConnectionPropertiesV2BasicResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + c.Properties, err = unmarshalConnectionPropertiesV2Classification(val) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionPropertiesV2BasicResourceArmPaginatedResult. +func (c ConnectionPropertiesV2BasicResourceArmPaginatedResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionPropertiesV2BasicResourceArmPaginatedResult. +func (c *ConnectionPropertiesV2BasicResourceArmPaginatedResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionServicePrincipal. +func (c ConnectionServicePrincipal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", c.ClientID) + populate(objectMap, "clientSecret", c.ClientSecret) + populate(objectMap, "tenantId", c.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionServicePrincipal. +func (c *ConnectionServicePrincipal) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &c.ClientID) + delete(rawMsg, key) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &c.ClientSecret) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &c.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionSharedAccessSignature. +func (c ConnectionSharedAccessSignature) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sas", c.Sas) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionSharedAccessSignature. +func (c *ConnectionSharedAccessSignature) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "sas": + err = unpopulate(val, "Sas", &c.Sas) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionUpdateContent. +func (c ConnectionUpdateContent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionUpdateContent. +func (c *ConnectionUpdateContent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + c.Properties, err = unmarshalConnectionPropertiesV2Classification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionUsernamePassword. +func (c ConnectionUsernamePassword) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "quantity", c.Quantity) - populate(objectMap, "unit", c.Unit) + populate(objectMap, "password", c.Password) + populate(objectMap, "securityToken", c.SecurityToken) + populate(objectMap, "username", c.Username) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CommitmentQuota. -func (c *CommitmentQuota) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionUsernamePassword. +func (c *ConnectionUsernamePassword) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1283,11 +2256,14 @@ func (c *CommitmentQuota) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "quantity": - err = unpopulate(val, "Quantity", &c.Quantity) + case "password": + err = unpopulate(val, "Password", &c.Password) delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &c.Unit) + case "securityToken": + err = unpopulate(val, "SecurityToken", &c.SecurityToken) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &c.Username) delete(rawMsg, key) } if err != nil { @@ -1297,22 +2273,17 @@ func (c *CommitmentQuota) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CommitmentTier. -func (c CommitmentTier) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CustomBlocklistConfig. +func (c CustomBlocklistConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "cost", c.Cost) - populate(objectMap, "hostingModel", c.HostingModel) - populate(objectMap, "kind", c.Kind) - populate(objectMap, "maxCount", c.MaxCount) - populate(objectMap, "planType", c.PlanType) - populate(objectMap, "quota", c.Quota) - populate(objectMap, "skuName", c.SKUName) - populate(objectMap, "tier", c.Tier) + populate(objectMap, "blocking", c.Blocking) + populate(objectMap, "blocklistName", c.BlocklistName) + populate(objectMap, "source", c.Source) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CommitmentTier. -func (c *CommitmentTier) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomBlocklistConfig. +func (c *CustomBlocklistConfig) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1320,29 +2291,14 @@ func (c *CommitmentTier) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "cost": - err = unpopulate(val, "Cost", &c.Cost) - delete(rawMsg, key) - case "hostingModel": - err = unpopulate(val, "HostingModel", &c.HostingModel) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &c.Kind) - delete(rawMsg, key) - case "maxCount": - err = unpopulate(val, "MaxCount", &c.MaxCount) - delete(rawMsg, key) - case "planType": - err = unpopulate(val, "PlanType", &c.PlanType) - delete(rawMsg, key) - case "quota": - err = unpopulate(val, "Quota", &c.Quota) + case "blocking": + err = unpopulate(val, "Blocking", &c.Blocking) delete(rawMsg, key) - case "skuName": - err = unpopulate(val, "SKUName", &c.SKUName) + case "blocklistName": + err = unpopulate(val, "BlocklistName", &c.BlocklistName) delete(rawMsg, key) - case "tier": - err = unpopulate(val, "Tier", &c.Tier) + case "source": + err = unpopulate(val, "Source", &c.Source) delete(rawMsg, key) } if err != nil { @@ -1352,16 +2308,15 @@ func (c *CommitmentTier) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CommitmentTierListResult. -func (c CommitmentTierListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CustomKeys. +func (c CustomKeys) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "keys", c.Keys) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CommitmentTierListResult. -func (c *CommitmentTierListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomKeys. +func (c *CustomKeys) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1369,11 +2324,8 @@ func (c *CommitmentTierListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + case "keys": + err = unpopulate(val, "Keys", &c.Keys) delete(rawMsg, key) } if err != nil { @@ -1383,17 +2335,28 @@ func (c *CommitmentTierListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomBlocklistConfig. -func (c CustomBlocklistConfig) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CustomKeysConnectionProperties. +func (c CustomKeysConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "blocking", c.Blocking) - populate(objectMap, "blocklistName", c.BlocklistName) - populate(objectMap, "source", c.Source) + objectMap["authType"] = ConnectionAuthTypeCustomKeys + populate(objectMap, "category", c.Category) + populate(objectMap, "createdByWorkspaceArmId", c.CreatedByWorkspaceArmID) + populate(objectMap, "credentials", c.Credentials) + populate(objectMap, "error", c.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", c.ExpiryTime) + populate(objectMap, "group", c.Group) + populate(objectMap, "isSharedToAll", c.IsSharedToAll) + populate(objectMap, "metadata", c.Metadata) + populate(objectMap, "peRequirement", c.PeRequirement) + populate(objectMap, "peStatus", c.PeStatus) + populate(objectMap, "sharedUserList", c.SharedUserList) + populate(objectMap, "target", c.Target) + populate(objectMap, "useWorkspaceManagedIdentity", c.UseWorkspaceManagedIdentity) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomBlocklistConfig. -func (c *CustomBlocklistConfig) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomKeysConnectionProperties. +func (c *CustomKeysConnectionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1401,14 +2364,47 @@ func (c *CustomBlocklistConfig) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "blocking": - err = unpopulate(val, "Blocking", &c.Blocking) + case "authType": + err = unpopulate(val, "AuthType", &c.AuthType) delete(rawMsg, key) - case "blocklistName": - err = unpopulate(val, "BlocklistName", &c.BlocklistName) + case "category": + err = unpopulate(val, "Category", &c.Category) delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &c.Source) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &c.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &c.Credentials) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &c.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &c.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &c.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &c.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &c.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &c.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &c.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &c.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &c.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &c.UseWorkspaceManagedIdentity) delete(rawMsg, key) } if err != nil { @@ -1709,6 +2705,7 @@ func (d DeploymentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "raiPolicyName", d.RaiPolicyName) populate(objectMap, "rateLimits", d.RateLimits) populate(objectMap, "scaleSettings", d.ScaleSettings) + populate(objectMap, "spilloverDeploymentName", d.SpilloverDeploymentName) populate(objectMap, "versionUpgradeOption", d.VersionUpgradeOption) return json.Marshal(objectMap) } @@ -1755,6 +2752,9 @@ func (d *DeploymentProperties) UnmarshalJSON(data []byte) error { case "scaleSettings": err = unpopulate(val, "ScaleSettings", &d.ScaleSettings) delete(rawMsg, key) + case "spilloverDeploymentName": + err = unpopulate(val, "SpilloverDeploymentName", &d.SpilloverDeploymentName) + delete(rawMsg, key) case "versionUpgradeOption": err = unpopulate(val, "VersionUpgradeOption", &d.VersionUpgradeOption) delete(rawMsg, key) @@ -2233,6 +3233,85 @@ func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedIdentityAuthTypeConnectionProperties. +func (m ManagedIdentityAuthTypeConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = ConnectionAuthTypeManagedIdentity + populate(objectMap, "category", m.Category) + populate(objectMap, "createdByWorkspaceArmId", m.CreatedByWorkspaceArmID) + populate(objectMap, "credentials", m.Credentials) + populate(objectMap, "error", m.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", m.ExpiryTime) + populate(objectMap, "group", m.Group) + populate(objectMap, "isSharedToAll", m.IsSharedToAll) + populate(objectMap, "metadata", m.Metadata) + populate(objectMap, "peRequirement", m.PeRequirement) + populate(objectMap, "peStatus", m.PeStatus) + populate(objectMap, "sharedUserList", m.SharedUserList) + populate(objectMap, "target", m.Target) + populate(objectMap, "useWorkspaceManagedIdentity", m.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedIdentityAuthTypeConnectionProperties. +func (m *ManagedIdentityAuthTypeConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &m.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &m.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &m.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &m.Credentials) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &m.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &m.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &m.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &m.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &m.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &m.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &m.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &m.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &m.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &m.UseWorkspaceManagedIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MetricName. func (m MetricName) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2618,6 +3697,41 @@ func (m *MultiRegionSettings) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type NetworkInjections. +func (n NetworkInjections) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scenario", n.Scenario) + populate(objectMap, "subnetArmId", n.SubnetArmID) + populate(objectMap, "useMicrosoftManagedNetwork", n.UseMicrosoftManagedNetwork) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInjections. +func (n *NetworkInjections) 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", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scenario": + err = unpopulate(val, "Scenario", &n.Scenario) + delete(rawMsg, key) + case "subnetArmId": + err = unpopulate(val, "SubnetArmID", &n.SubnetArmID) + delete(rawMsg, key) + case "useMicrosoftManagedNetwork": + err = unpopulate(val, "UseMicrosoftManagedNetwork", &n.UseMicrosoftManagedNetwork) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2980,6 +4094,160 @@ func (n *NetworkSecurityPerimeterProfileInfo) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type NoneAuthTypeConnectionProperties. +func (n NoneAuthTypeConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = ConnectionAuthTypeNone + populate(objectMap, "category", n.Category) + populate(objectMap, "createdByWorkspaceArmId", n.CreatedByWorkspaceArmID) + populate(objectMap, "error", n.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", n.ExpiryTime) + populate(objectMap, "group", n.Group) + populate(objectMap, "isSharedToAll", n.IsSharedToAll) + populate(objectMap, "metadata", n.Metadata) + populate(objectMap, "peRequirement", n.PeRequirement) + populate(objectMap, "peStatus", n.PeStatus) + populate(objectMap, "sharedUserList", n.SharedUserList) + populate(objectMap, "target", n.Target) + populate(objectMap, "useWorkspaceManagedIdentity", n.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NoneAuthTypeConnectionProperties. +func (n *NoneAuthTypeConnectionProperties) 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", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &n.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &n.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &n.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &n.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &n.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &n.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &n.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &n.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &n.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &n.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &n.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &n.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &n.UseWorkspaceManagedIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OAuth2AuthTypeConnectionProperties. +func (o OAuth2AuthTypeConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = ConnectionAuthTypeOAuth2 + populate(objectMap, "category", o.Category) + populate(objectMap, "createdByWorkspaceArmId", o.CreatedByWorkspaceArmID) + populate(objectMap, "credentials", o.Credentials) + populate(objectMap, "error", o.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", o.ExpiryTime) + populate(objectMap, "group", o.Group) + populate(objectMap, "isSharedToAll", o.IsSharedToAll) + populate(objectMap, "metadata", o.Metadata) + populate(objectMap, "peRequirement", o.PeRequirement) + populate(objectMap, "peStatus", o.PeStatus) + populate(objectMap, "sharedUserList", o.SharedUserList) + populate(objectMap, "target", o.Target) + populate(objectMap, "useWorkspaceManagedIdentity", o.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OAuth2AuthTypeConnectionProperties. +func (o *OAuth2AuthTypeConnectionProperties) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &o.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &o.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &o.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &o.Credentials) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &o.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &o.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &o.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &o.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &o.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &o.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &o.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &o.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &o.UseWorkspaceManagedIdentity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3082,12 +4350,91 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { case "nextLink": err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PATAuthTypeConnectionProperties. +func (p PATAuthTypeConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = ConnectionAuthTypePAT + populate(objectMap, "category", p.Category) + populate(objectMap, "createdByWorkspaceArmId", p.CreatedByWorkspaceArmID) + populate(objectMap, "credentials", p.Credentials) + populate(objectMap, "error", p.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", p.ExpiryTime) + populate(objectMap, "group", p.Group) + populate(objectMap, "isSharedToAll", p.IsSharedToAll) + populate(objectMap, "metadata", p.Metadata) + populate(objectMap, "peRequirement", p.PeRequirement) + populate(objectMap, "peStatus", p.PeStatus) + populate(objectMap, "sharedUserList", p.SharedUserList) + populate(objectMap, "target", p.Target) + populate(objectMap, "useWorkspaceManagedIdentity", p.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PATAuthTypeConnectionProperties. +func (p *PATAuthTypeConnectionProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authType": + err = unpopulate(val, "AuthType", &p.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &p.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &p.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &p.Credentials) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &p.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &p.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &p.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &p.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &p.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &p.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &p.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &p.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &p.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &p.UseWorkspaceManagedIdentity) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil @@ -3435,6 +4782,139 @@ func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Project. +func (p Project) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Project. +func (p *Project) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &p.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProjectListResult. +func (p ProjectListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectListResult. +func (p *ProjectListResult) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProjectProperties. +func (p ProjectProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "endpoints", p.Endpoints) + populate(objectMap, "isDefault", p.IsDefault) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectProperties. +func (p *ProjectProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "endpoints": + err = unpopulate(val, "Endpoints", &p.Endpoints) + delete(rawMsg, key) + case "isDefault": + err = unpopulate(val, "IsDefault", &p.IsDefault) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProvisioningIssue. func (p ProvisioningIssue) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4295,6 +5775,37 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceBase. +func (r ResourceBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", r.Description) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceBase. +func (r *ResourceBase) 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 "tags": + err = unpopulate(val, "Tags", &r.Tags) + 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) @@ -4443,6 +5954,85 @@ func (r *ResourceSKURestrictions) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SASAuthTypeConnectionProperties. +func (s SASAuthTypeConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = ConnectionAuthTypeSAS + populate(objectMap, "category", s.Category) + populate(objectMap, "createdByWorkspaceArmId", s.CreatedByWorkspaceArmID) + populate(objectMap, "credentials", s.Credentials) + populate(objectMap, "error", s.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", s.ExpiryTime) + populate(objectMap, "group", s.Group) + populate(objectMap, "isSharedToAll", s.IsSharedToAll) + populate(objectMap, "metadata", s.Metadata) + populate(objectMap, "peRequirement", s.PeRequirement) + populate(objectMap, "peStatus", s.PeStatus) + populate(objectMap, "sharedUserList", s.SharedUserList) + populate(objectMap, "target", s.Target) + populate(objectMap, "useWorkspaceManagedIdentity", s.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SASAuthTypeConnectionProperties. +func (s *SASAuthTypeConnectionProperties) 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 "authType": + err = unpopulate(val, "AuthType", &s.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &s.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &s.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &s.Credentials) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &s.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &s.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &s.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &s.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &s.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &s.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &s.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &s.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &s.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &s.UseWorkspaceManagedIdentity) + 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 SKU. func (s SKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4661,6 +6251,85 @@ func (s *SKUResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ServicePrincipalAuthTypeConnectionProperties. +func (s ServicePrincipalAuthTypeConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = ConnectionAuthTypeServicePrincipal + populate(objectMap, "category", s.Category) + populate(objectMap, "createdByWorkspaceArmId", s.CreatedByWorkspaceArmID) + populate(objectMap, "credentials", s.Credentials) + populate(objectMap, "error", s.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", s.ExpiryTime) + populate(objectMap, "group", s.Group) + populate(objectMap, "isSharedToAll", s.IsSharedToAll) + populate(objectMap, "metadata", s.Metadata) + populate(objectMap, "peRequirement", s.PeRequirement) + populate(objectMap, "peStatus", s.PeStatus) + populate(objectMap, "sharedUserList", s.SharedUserList) + populate(objectMap, "target", s.Target) + populate(objectMap, "useWorkspaceManagedIdentity", s.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrincipalAuthTypeConnectionProperties. +func (s *ServicePrincipalAuthTypeConnectionProperties) 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 "authType": + err = unpopulate(val, "AuthType", &s.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &s.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &s.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &s.Credentials) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &s.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &s.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &s.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &s.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &s.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &s.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &s.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &s.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &s.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &s.UseWorkspaceManagedIdentity) + 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) @@ -4930,6 +6599,85 @@ func (u *UserOwnedStorage) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type UsernamePasswordAuthTypeConnectionProperties. +func (u UsernamePasswordAuthTypeConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["authType"] = ConnectionAuthTypeUsernamePassword + populate(objectMap, "category", u.Category) + populate(objectMap, "createdByWorkspaceArmId", u.CreatedByWorkspaceArmID) + populate(objectMap, "credentials", u.Credentials) + populate(objectMap, "error", u.Error) + populateDateTimeRFC3339(objectMap, "expiryTime", u.ExpiryTime) + populate(objectMap, "group", u.Group) + populate(objectMap, "isSharedToAll", u.IsSharedToAll) + populate(objectMap, "metadata", u.Metadata) + populate(objectMap, "peRequirement", u.PeRequirement) + populate(objectMap, "peStatus", u.PeStatus) + populate(objectMap, "sharedUserList", u.SharedUserList) + populate(objectMap, "target", u.Target) + populate(objectMap, "useWorkspaceManagedIdentity", u.UseWorkspaceManagedIdentity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UsernamePasswordAuthTypeConnectionProperties. +func (u *UsernamePasswordAuthTypeConnectionProperties) 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 "authType": + err = unpopulate(val, "AuthType", &u.AuthType) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &u.Category) + delete(rawMsg, key) + case "createdByWorkspaceArmId": + err = unpopulate(val, "CreatedByWorkspaceArmID", &u.CreatedByWorkspaceArmID) + delete(rawMsg, key) + case "credentials": + err = unpopulate(val, "Credentials", &u.Credentials) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &u.Error) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateDateTimeRFC3339(val, "ExpiryTime", &u.ExpiryTime) + delete(rawMsg, key) + case "group": + err = unpopulate(val, "Group", &u.Group) + delete(rawMsg, key) + case "isSharedToAll": + err = unpopulate(val, "IsSharedToAll", &u.IsSharedToAll) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &u.Metadata) + delete(rawMsg, key) + case "peRequirement": + err = unpopulate(val, "PeRequirement", &u.PeRequirement) + delete(rawMsg, key) + case "peStatus": + err = unpopulate(val, "PeStatus", &u.PeStatus) + delete(rawMsg, key) + case "sharedUserList": + err = unpopulate(val, "SharedUserList", &u.SharedUserList) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &u.Target) + delete(rawMsg, key) + case "useWorkspaceManagedIdentity": + err = unpopulate(val, "UseWorkspaceManagedIdentity", &u.UseWorkspaceManagedIdentity) + 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 VirtualNetworkRule. func (v VirtualNetworkRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client.go index 5387c0dbd184..b4c1c7661472 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,7 @@ func NewNetworkSecurityPerimeterConfigurationsClient(subscriptionID string, cred // Get - Gets the specified NSP configurations for an account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - nspConfigurationName - The name of the NSP Configuration. @@ -75,7 +72,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) Get(ctx context.Cont } // getCreateRequest creates the Get request. -func (client *NetworkSecurityPerimeterConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, nspConfigurationName string, options *NetworkSecurityPerimeterConfigurationsClientGetOptions) (*policy.Request, error) { +func (client *NetworkSecurityPerimeterConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, nspConfigurationName string, _ *NetworkSecurityPerimeterConfigurationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -98,7 +95,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) getCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +112,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) getHandleResponse(re // NewListPager - Gets a list of NSP configurations for an account. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - NetworkSecurityPerimeterConfigurationsClientListOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.NewListPager @@ -144,7 +141,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) NewListPager(resourc } // listCreateRequest creates the List request. -func (client *NetworkSecurityPerimeterConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *NetworkSecurityPerimeterConfigurationsClientListOptions) (*policy.Request, error) { +func (client *NetworkSecurityPerimeterConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *NetworkSecurityPerimeterConfigurationsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -163,7 +160,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) listCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +178,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) listHandleResponse(r // BeginReconcile - Reconcile the NSP configuration for an account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - nspConfigurationName - The name of the NSP Configuration. @@ -208,7 +205,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) BeginReconcile(ctx c // Reconcile - Reconcile the NSP configuration for an account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *NetworkSecurityPerimeterConfigurationsClient) reconcile(ctx context.Context, resourceGroupName string, accountName string, nspConfigurationName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*http.Response, error) { var err error const operationName = "NetworkSecurityPerimeterConfigurationsClient.BeginReconcile" @@ -231,7 +228,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) reconcile(ctx contex } // reconcileCreateRequest creates the Reconcile request. -func (client *NetworkSecurityPerimeterConfigurationsClient) reconcileCreateRequest(ctx context.Context, resourceGroupName string, accountName string, nspConfigurationName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*policy.Request, error) { +func (client *NetworkSecurityPerimeterConfigurationsClient) reconcileCreateRequest(ctx context.Context, resourceGroupName string, accountName string, nspConfigurationName string, _ *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName}/reconcile" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -254,7 +251,7 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) reconcileCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client_example_test.go deleted file mode 100644 index 01b97f333a22..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client_example_test.go +++ /dev/null @@ -1,183 +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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListNetworkSecurityPerimeterConfigurations.json -func ExampleNetworkSecurityPerimeterConfigurationsClient_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.NewNetworkSecurityPerimeterConfigurationsClient().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.NetworkSecurityPerimeterConfigurationList = armcognitiveservices.NetworkSecurityPerimeterConfigurationList{ - // Value: []*armcognitiveservices.NetworkSecurityPerimeterConfiguration{ - // { - // Name: to.Ptr("networkSecurityPerimeterConfigurationName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/networkSecurityPerimeterConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/networkSecurityPerimeterConfigurations"), - // Properties: &armcognitiveservices.NetworkSecurityPerimeterConfigurationProperties{ - // NetworkSecurityPerimeter: &armcognitiveservices.NetworkSecurityPerimeter{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.Network/networkSecurityPerimeters/perimeter"), - // Location: to.Ptr("East US"), - // PerimeterGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Profile: &armcognitiveservices.NetworkSecurityPerimeterProfileInfo{ - // Name: to.Ptr("profileName"), - // AccessRules: []*armcognitiveservices.NetworkSecurityPerimeterAccessRule{ - // { - // Name: to.Ptr("ruleName"), - // Properties: &armcognitiveservices.NetworkSecurityPerimeterAccessRuleProperties{ - // AddressPrefixes: []*string{ - // to.Ptr("148.0.0.0/8"), - // to.Ptr("152.4.6.0/24")}, - // Direction: to.Ptr(armcognitiveservices.NspAccessRuleDirectionInbound), - // }, - // }}, - // AccessRulesVersion: to.Ptr[int64](1), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // ResourceAssociation: &armcognitiveservices.NetworkSecurityPerimeterConfigurationAssociationInfo{ - // Name: to.Ptr("associationName"), - // AccessMode: to.Ptr("Enforced"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetNetworkSecurityPerimeterConfigurations.json -func ExampleNetworkSecurityPerimeterConfigurationsClient_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.NewNetworkSecurityPerimeterConfigurationsClient().Get(ctx, "resourceGroupName", "accountName", "NSPConfigurationName", 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.NetworkSecurityPerimeterConfiguration = armcognitiveservices.NetworkSecurityPerimeterConfiguration{ - // Name: to.Ptr("networkSecurityPerimeterConfigurationName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/networkSecurityPerimeterConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/networkSecurityPerimeterConfigurations"), - // Properties: &armcognitiveservices.NetworkSecurityPerimeterConfigurationProperties{ - // NetworkSecurityPerimeter: &armcognitiveservices.NetworkSecurityPerimeter{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.Network/networkSecurityPerimeters/perimeter"), - // Location: to.Ptr("East US"), - // PerimeterGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Profile: &armcognitiveservices.NetworkSecurityPerimeterProfileInfo{ - // Name: to.Ptr("profileName"), - // AccessRules: []*armcognitiveservices.NetworkSecurityPerimeterAccessRule{ - // { - // Name: to.Ptr("ruleName"), - // Properties: &armcognitiveservices.NetworkSecurityPerimeterAccessRuleProperties{ - // AddressPrefixes: []*string{ - // to.Ptr("148.0.0.0/8"), - // to.Ptr("152.4.6.0/24")}, - // Direction: to.Ptr(armcognitiveservices.NspAccessRuleDirectionInbound), - // }, - // }}, - // AccessRulesVersion: to.Ptr[int64](1), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // ResourceAssociation: &armcognitiveservices.NetworkSecurityPerimeterConfigurationAssociationInfo{ - // Name: to.Ptr("associationName"), - // AccessMode: to.Ptr("Enforced"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ReconcileNetworkSecurityPerimeterConfigurations.json -func ExampleNetworkSecurityPerimeterConfigurationsClient_BeginReconcile() { - 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.NewNetworkSecurityPerimeterConfigurationsClient().BeginReconcile(ctx, "resourceGroupName", "accountName", "NSPConfigurationName", 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.NetworkSecurityPerimeterConfiguration = armcognitiveservices.NetworkSecurityPerimeterConfiguration{ - // Name: to.Ptr("networkSecurityPerimeterConfigurationName"), - // Type: to.Ptr("Microsoft.CognitiveServices/accounts/networkSecurityPerimeterConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/networkSecurityPerimeterConfigurations"), - // Properties: &armcognitiveservices.NetworkSecurityPerimeterConfigurationProperties{ - // NetworkSecurityPerimeter: &armcognitiveservices.NetworkSecurityPerimeter{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.Network/networkSecurityPerimeters/perimeter"), - // Location: to.Ptr("East US"), - // PerimeterGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Profile: &armcognitiveservices.NetworkSecurityPerimeterProfileInfo{ - // Name: to.Ptr("profileName"), - // AccessRules: []*armcognitiveservices.NetworkSecurityPerimeterAccessRule{ - // { - // Name: to.Ptr("ruleName"), - // Properties: &armcognitiveservices.NetworkSecurityPerimeterAccessRuleProperties{ - // AddressPrefixes: []*string{ - // to.Ptr("148.0.0.0/8"), - // to.Ptr("152.4.6.0/24")}, - // Direction: to.Ptr(armcognitiveservices.NspAccessRuleDirectionInbound), - // }, - // }}, - // AccessRulesVersion: to.Ptr[int64](1), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // ResourceAssociation: &armcognitiveservices.NetworkSecurityPerimeterConfigurationAssociationInfo{ - // Name: to.Ptr("associationName"), - // AccessMode: to.Ptr("Enforced"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go index 48be898d0103..2666d1e35e26 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go @@ -1,6 +1,3 @@ -//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. @@ -39,7 +36,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all the available Cognitive Services account operations. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -65,14 +62,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.CognitiveServices/operations" 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", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client_example_test.go deleted file mode 100644 index 114c3a029332..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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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 index d309b9f6da96..c93562ccff75 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/options.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/options.go @@ -1,6 +1,3 @@ -//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. @@ -8,21 +5,74 @@ package armcognitiveservices +// AccountCapabilityHostsClientBeginCreateOrUpdateOptions contains the optional parameters for the AccountCapabilityHostsClient.BeginCreateOrUpdate +// method. +type AccountCapabilityHostsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// AccountCapabilityHostsClientBeginDeleteOptions contains the optional parameters for the AccountCapabilityHostsClient.BeginDelete +// method. +type AccountCapabilityHostsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// AccountCapabilityHostsClientGetOptions contains the optional parameters for the AccountCapabilityHostsClient.Get method. +type AccountCapabilityHostsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AccountConnectionsClientCreateOptions contains the optional parameters for the AccountConnectionsClient.Create method. +type AccountConnectionsClientCreateOptions struct { + // The object for creating or updating a new account connection + Connection *ConnectionPropertiesV2BasicResource +} + +// AccountConnectionsClientDeleteOptions contains the optional parameters for the AccountConnectionsClient.Delete method. +type AccountConnectionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AccountConnectionsClientGetOptions contains the optional parameters for the AccountConnectionsClient.Get method. +type AccountConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AccountConnectionsClientListOptions contains the optional parameters for the AccountConnectionsClient.NewListPager method. +type AccountConnectionsClientListOptions struct { + // Category of the connection. + Category *string + + // query parameter that indicates if get connection call should return both connections and datastores + IncludeAll *bool + + // Target of the connection. + Target *string +} + +// AccountConnectionsClientUpdateOptions contains the optional parameters for the AccountConnectionsClient.Update method. +type AccountConnectionsClientUpdateOptions struct { + // Parameters for account connection update. + Connection *ConnectionUpdateContent +} + // AccountsClientBeginCreateOptions contains the optional parameters for the AccountsClient.BeginCreate method. type AccountsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -72,41 +122,41 @@ type AccountsClientRegenerateKeyOptions struct { // CommitmentPlansClientBeginCreateOrUpdateAssociationOptions contains the optional parameters for the CommitmentPlansClient.BeginCreateOrUpdateAssociation // method. type CommitmentPlansClientBeginCreateOrUpdateAssociationOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -184,7 +234,7 @@ type DefenderForAISettingsClientUpdateOptions struct { // DeletedAccountsClientBeginPurgeOptions contains the optional parameters for the DeletedAccountsClient.BeginPurge method. type DeletedAccountsClientBeginPurgeOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -201,19 +251,19 @@ type DeletedAccountsClientListOptions struct { // DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate // method. type DeploymentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -234,7 +284,7 @@ type DeploymentsClientListSKUsOptions struct { // EncryptionScopesClientBeginDeleteOptions contains the optional parameters for the EncryptionScopesClient.BeginDelete method. type EncryptionScopesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -291,7 +341,7 @@ type ModelsClientListOptions struct { // NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.BeginReconcile // method. type NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -315,14 +365,14 @@ type OperationsClientListOptions struct { // PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate // method. type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -343,6 +393,87 @@ type PrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters } +// ProjectCapabilityHostsClientBeginCreateOrUpdateOptions contains the optional parameters for the ProjectCapabilityHostsClient.BeginCreateOrUpdate +// method. +type ProjectCapabilityHostsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ProjectCapabilityHostsClientBeginDeleteOptions contains the optional parameters for the ProjectCapabilityHostsClient.BeginDelete +// method. +type ProjectCapabilityHostsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ProjectCapabilityHostsClientGetOptions contains the optional parameters for the ProjectCapabilityHostsClient.Get method. +type ProjectCapabilityHostsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProjectConnectionsClientCreateOptions contains the optional parameters for the ProjectConnectionsClient.Create method. +type ProjectConnectionsClientCreateOptions struct { + // The object for creating or updating a new account connection + Connection *ConnectionPropertiesV2BasicResource +} + +// ProjectConnectionsClientDeleteOptions contains the optional parameters for the ProjectConnectionsClient.Delete method. +type ProjectConnectionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ProjectConnectionsClientGetOptions contains the optional parameters for the ProjectConnectionsClient.Get method. +type ProjectConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProjectConnectionsClientListOptions contains the optional parameters for the ProjectConnectionsClient.NewListPager method. +type ProjectConnectionsClientListOptions struct { + // Category of the connection. + Category *string + + // query parameter that indicates if get connection call should return both connections and datastores + IncludeAll *bool + + // Target of the connection. + Target *string +} + +// ProjectConnectionsClientUpdateOptions contains the optional parameters for the ProjectConnectionsClient.Update method. +type ProjectConnectionsClientUpdateOptions struct { + // Parameters for account connection update. + Connection *ConnectionUpdateContent +} + +// ProjectsClientBeginCreateOptions contains the optional parameters for the ProjectsClient.BeginCreate method. +type ProjectsClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ProjectsClientBeginDeleteOptions contains the optional parameters for the ProjectsClient.BeginDelete method. +type ProjectsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ProjectsClientBeginUpdateOptions contains the optional parameters for the ProjectsClient.BeginUpdate method. +type ProjectsClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ProjectsClientGetOptions contains the optional parameters for the ProjectsClient.Get method. +type ProjectsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProjectsClientListOptions contains the optional parameters for the ProjectsClient.NewListPager method. +type ProjectsClientListOptions struct { + // placeholder for future optional parameters +} + // RaiBlocklistItemsClientBatchAddOptions contains the optional parameters for the RaiBlocklistItemsClient.BatchAdd method. type RaiBlocklistItemsClientBatchAddOptions struct { // placeholder for future optional parameters @@ -357,7 +488,7 @@ type RaiBlocklistItemsClientBatchDeleteOptions struct { // RaiBlocklistItemsClientBeginDeleteOptions contains the optional parameters for the RaiBlocklistItemsClient.BeginDelete // method. type RaiBlocklistItemsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -379,7 +510,7 @@ type RaiBlocklistItemsClientListOptions struct { // RaiBlocklistsClientBeginDeleteOptions contains the optional parameters for the RaiBlocklistsClient.BeginDelete method. type RaiBlocklistsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -410,7 +541,7 @@ type RaiContentFiltersClientListOptions struct { // RaiPoliciesClientBeginDeleteOptions contains the optional parameters for the RaiPoliciesClient.BeginDelete method. type RaiPoliciesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/polymorphic_helpers.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/polymorphic_helpers.go new file mode 100644 index 000000000000..adb4c13cfad4 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/polymorphic_helpers.go @@ -0,0 +1,51 @@ +// 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 "encoding/json" + +func unmarshalConnectionPropertiesV2Classification(rawMsg json.RawMessage) (ConnectionPropertiesV2Classification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ConnectionPropertiesV2Classification + switch m["authType"] { + case string(ConnectionAuthTypeAAD): + b = &AADAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeAccessKey): + b = &AccessKeyAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeAccountKey): + b = &AccountKeyAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeAPIKey): + b = &APIKeyAuthConnectionProperties{} + case string(ConnectionAuthTypeCustomKeys): + b = &CustomKeysConnectionProperties{} + case string(ConnectionAuthTypeManagedIdentity): + b = &ManagedIdentityAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeNone): + b = &NoneAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeOAuth2): + b = &OAuth2AuthTypeConnectionProperties{} + case string(ConnectionAuthTypePAT): + b = &PATAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeSAS): + b = &SASAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeServicePrincipal): + b = &ServicePrincipalAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeUsernamePassword): + b = &UsernamePasswordAuthTypeConnectionProperties{} + default: + b = &ConnectionPropertiesV2{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go index e26bedfd82e1..ddd375a13778 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go @@ -1,6 +1,3 @@ -//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. @@ -47,7 +44,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Cognitive Services Account @@ -74,7 +71,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Update the state of specified private endpoint connection associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" @@ -97,7 +94,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Conte } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, _ *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -120,7 +117,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { @@ -132,7 +129,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes the specified private endpoint connection associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Cognitive Services Account @@ -158,7 +155,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes the specified private endpoint connection associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -181,7 +178,7 @@ func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -204,7 +201,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -213,7 +210,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets the specified private endpoint connection associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Cognitive Services Account @@ -242,7 +239,7 @@ func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourc } // getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -265,7 +262,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +280,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // List - Gets the private endpoint connections associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List @@ -311,7 +308,7 @@ func (client *PrivateEndpointConnectionsClient) List(ctx context.Context, resour } // listCreateRequest creates the List request. -func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -330,7 +327,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client_example_test.go deleted file mode 100644 index 05c817596757..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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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 0284f57a3840..64076218d72b 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // List - Gets the private link resources that need to be created for a Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List @@ -74,7 +71,7 @@ func (client *PrivateLinkResourcesClient) List(ctx context.Context, resourceGrou } // listCreateRequest creates the List request. -func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { +func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateLinkResources" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -93,7 +90,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client_example_test.go deleted file mode 100644 index f56f9da4f9a0..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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/projectcapabilityhosts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectcapabilityhosts_client.go new file mode 100644 index 000000000000..04731964300d --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectcapabilityhosts_client.go @@ -0,0 +1,294 @@ +// 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" +) + +// ProjectCapabilityHostsClient contains the methods for the ProjectCapabilityHosts group. +// Don't use this type directly, use NewProjectCapabilityHostsClient() instead. +type ProjectCapabilityHostsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProjectCapabilityHostsClient creates a new instance of ProjectCapabilityHostsClient 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 NewProjectCapabilityHostsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectCapabilityHostsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProjectCapabilityHostsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update project capabilityHost. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - capabilityHostName - The name of the capability host associated with the Cognitive Services Resource +// - capabilityHost - CapabilityHost definition. +// - options - ProjectCapabilityHostsClientBeginCreateOrUpdateOptions contains the optional parameters for the ProjectCapabilityHostsClient.BeginCreateOrUpdate +// method. +func (client *ProjectCapabilityHostsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, capabilityHost CapabilityHost, options *ProjectCapabilityHostsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ProjectCapabilityHostsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, projectName, capabilityHostName, capabilityHost, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectCapabilityHostsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaOriginalURI, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectCapabilityHostsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update project capabilityHost. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +func (client *ProjectCapabilityHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, capabilityHost CapabilityHost, options *ProjectCapabilityHostsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ProjectCapabilityHostsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, projectName, capabilityHostName, capabilityHost, 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.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ProjectCapabilityHostsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, capabilityHost CapabilityHost, _ *ProjectCapabilityHostsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/capabilityHosts/{capabilityHostName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if capabilityHostName == "" { + return nil, errors.New("parameter capabilityHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capabilityHostName}", url.PathEscape(capabilityHostName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, capabilityHost); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete project capabilityHost. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - capabilityHostName - The name of the capability host associated with the Cognitive Services Resource +// - options - ProjectCapabilityHostsClientBeginDeleteOptions contains the optional parameters for the ProjectCapabilityHostsClient.BeginDelete +// method. +func (client *ProjectCapabilityHostsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, options *ProjectCapabilityHostsClientBeginDeleteOptions) (*runtime.Poller[ProjectCapabilityHostsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, projectName, capabilityHostName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectCapabilityHostsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectCapabilityHostsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete project capabilityHost. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +func (client *ProjectCapabilityHostsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, options *ProjectCapabilityHostsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ProjectCapabilityHostsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, projectName, capabilityHostName, 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 *ProjectCapabilityHostsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, _ *ProjectCapabilityHostsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/capabilityHosts/{capabilityHostName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if capabilityHostName == "" { + return nil, errors.New("parameter capabilityHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capabilityHostName}", url.PathEscape(capabilityHostName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get project capabilityHost. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - capabilityHostName - The name of the capability host associated with the Cognitive Services Resource +// - options - ProjectCapabilityHostsClientGetOptions contains the optional parameters for the ProjectCapabilityHostsClient.Get +// method. +func (client *ProjectCapabilityHostsClient) Get(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, options *ProjectCapabilityHostsClientGetOptions) (ProjectCapabilityHostsClientGetResponse, error) { + var err error + const operationName = "ProjectCapabilityHostsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, projectName, capabilityHostName, options) + if err != nil { + return ProjectCapabilityHostsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProjectCapabilityHostsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProjectCapabilityHostsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ProjectCapabilityHostsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, _ *ProjectCapabilityHostsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/capabilityHosts/{capabilityHostName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if capabilityHostName == "" { + return nil, errors.New("parameter capabilityHostName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capabilityHostName}", url.PathEscape(capabilityHostName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProjectCapabilityHostsClient) getHandleResponse(resp *http.Response) (ProjectCapabilityHostsClientGetResponse, error) { + result := ProjectCapabilityHostsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CapabilityHost); err != nil { + return ProjectCapabilityHostsClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectconnections_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectconnections_client.go new file mode 100644 index 000000000000..803342efdc68 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectconnections_client.go @@ -0,0 +1,422 @@ +// 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" + "strconv" + "strings" +) + +// ProjectConnectionsClient contains the methods for the ProjectConnections group. +// Don't use this type directly, use NewProjectConnectionsClient() instead. +type ProjectConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProjectConnectionsClient creates a new instance of ProjectConnectionsClient 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 NewProjectConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProjectConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create or update Cognitive Services project connection under the specified project. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - connectionName - Friendly name of the connection +// - options - ProjectConnectionsClientCreateOptions contains the optional parameters for the ProjectConnectionsClient.Create +// method. +func (client *ProjectConnectionsClient) Create(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, options *ProjectConnectionsClientCreateOptions) (ProjectConnectionsClientCreateResponse, error) { + var err error + const operationName = "ProjectConnectionsClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, projectName, connectionName, options) + if err != nil { + return ProjectConnectionsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProjectConnectionsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProjectConnectionsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *ProjectConnectionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, options *ProjectConnectionsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Connection != nil { + if err := runtime.MarshalAsJSON(req, *options.Connection); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *ProjectConnectionsClient) createHandleResponse(resp *http.Response) (ProjectConnectionsClientCreateResponse, error) { + result := ProjectConnectionsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionPropertiesV2BasicResource); err != nil { + return ProjectConnectionsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete Cognitive Services project connection by name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - connectionName - Friendly name of the connection +// - options - ProjectConnectionsClientDeleteOptions contains the optional parameters for the ProjectConnectionsClient.Delete +// method. +func (client *ProjectConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, options *ProjectConnectionsClientDeleteOptions) (ProjectConnectionsClientDeleteResponse, error) { + var err error + const operationName = "ProjectConnectionsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, projectName, connectionName, options) + if err != nil { + return ProjectConnectionsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProjectConnectionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ProjectConnectionsClientDeleteResponse{}, err + } + return ProjectConnectionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ProjectConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, _ *ProjectConnectionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Lists Cognitive Services project connection by name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - connectionName - Friendly name of the connection +// - options - ProjectConnectionsClientGetOptions contains the optional parameters for the ProjectConnectionsClient.Get method. +func (client *ProjectConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, options *ProjectConnectionsClientGetOptions) (ProjectConnectionsClientGetResponse, error) { + var err error + const operationName = "ProjectConnectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, projectName, connectionName, options) + if err != nil { + return ProjectConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProjectConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProjectConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ProjectConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, _ *ProjectConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProjectConnectionsClient) getHandleResponse(resp *http.Response) (ProjectConnectionsClientGetResponse, error) { + result := ProjectConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionPropertiesV2BasicResource); err != nil { + return ProjectConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the available Cognitive Services project connections under the specified project. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - options - ProjectConnectionsClientListOptions contains the optional parameters for the ProjectConnectionsClient.NewListPager +// method. +func (client *ProjectConnectionsClient) NewListPager(resourceGroupName string, accountName string, projectName string, options *ProjectConnectionsClientListOptions) *runtime.Pager[ProjectConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProjectConnectionsClientListResponse]{ + More: func(page ProjectConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProjectConnectionsClientListResponse) (ProjectConnectionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProjectConnectionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, projectName, options) + }, nil) + if err != nil { + return ProjectConnectionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ProjectConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, options *ProjectConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + 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", "2025-06-01") + if options != nil && options.Category != nil { + reqQP.Set("category", *options.Category) + } + if options != nil && options.IncludeAll != nil { + reqQP.Set("includeAll", strconv.FormatBool(*options.IncludeAll)) + } + if options != nil && options.Target != nil { + reqQP.Set("target", *options.Target) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProjectConnectionsClient) listHandleResponse(resp *http.Response) (ProjectConnectionsClientListResponse, error) { + result := ProjectConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionPropertiesV2BasicResourceArmPaginatedResult); err != nil { + return ProjectConnectionsClientListResponse{}, err + } + return result, nil +} + +// Update - Update Cognitive Services project connection under the specified project. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - connectionName - Friendly name of the connection +// - options - ProjectConnectionsClientUpdateOptions contains the optional parameters for the ProjectConnectionsClient.Update +// method. +func (client *ProjectConnectionsClient) Update(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, options *ProjectConnectionsClientUpdateOptions) (ProjectConnectionsClientUpdateResponse, error) { + var err error + const operationName = "ProjectConnectionsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, projectName, connectionName, options) + if err != nil { + return ProjectConnectionsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProjectConnectionsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProjectConnectionsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *ProjectConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, connectionName string, options *ProjectConnectionsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if connectionName == "" { + return nil, errors.New("parameter connectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionName}", url.PathEscape(connectionName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Connection != nil { + if err := runtime.MarshalAsJSON(req, *options.Connection); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ProjectConnectionsClient) updateHandleResponse(resp *http.Response) (ProjectConnectionsClientUpdateResponse, error) { + result := ProjectConnectionsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionPropertiesV2BasicResource); err != nil { + return ProjectConnectionsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projects_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projects_client.go new file mode 100644 index 000000000000..dff5cfd1a6a4 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projects_client.go @@ -0,0 +1,424 @@ +// 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" +) + +// ProjectsClient contains the methods for the Projects group. +// Don't use this type directly, use NewProjectsClient() instead. +type ProjectsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProjectsClient creates a new instance of ProjectsClient 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 NewProjectsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProjectsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create Cognitive Services Account's Project. Project is a sub-resource of an account which give AI developer +// it's individual container to work on. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - project - The parameters to provide for the created project. +// - options - ProjectsClientBeginCreateOptions contains the optional parameters for the ProjectsClient.BeginCreate method. +func (client *ProjectsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, projectName string, project Project, options *ProjectsClientBeginCreateOptions) (*runtime.Poller[ProjectsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, projectName, project, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create Cognitive Services Account's Project. Project is a sub-resource of an account which give AI developer it's +// individual container to work on. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +func (client *ProjectsClient) create(ctx context.Context, resourceGroupName string, accountName string, projectName string, project Project, options *ProjectsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "ProjectsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, projectName, project, 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.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *ProjectsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, project Project, _ *ProjectsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + 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.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, project); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a Cognitive Services project from the resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - options - ProjectsClientBeginDeleteOptions contains the optional parameters for the ProjectsClient.BeginDelete method. +func (client *ProjectsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, projectName string, options *ProjectsClientBeginDeleteOptions) (*runtime.Poller[ProjectsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, projectName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a Cognitive Services project from the resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +func (client *ProjectsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, projectName string, options *ProjectsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ProjectsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, projectName, 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 *ProjectsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, _ *ProjectsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + 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.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns a Cognitive Services project specified by the parameters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - options - ProjectsClientGetOptions contains the optional parameters for the ProjectsClient.Get method. +func (client *ProjectsClient) Get(ctx context.Context, resourceGroupName string, accountName string, projectName string, options *ProjectsClientGetOptions) (ProjectsClientGetResponse, error) { + var err error + const operationName = "ProjectsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, projectName, options) + if err != nil { + return ProjectsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProjectsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProjectsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ProjectsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, _ *ProjectsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProjectsClient) getHandleResponse(resp *http.Response) (ProjectsClientGetResponse, error) { + result := ProjectsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Project); err != nil { + return ProjectsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Returns all the projects in a Cognitive Services account. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - options - ProjectsClientListOptions contains the optional parameters for the ProjectsClient.NewListPager method. +func (client *ProjectsClient) NewListPager(resourceGroupName string, accountName string, options *ProjectsClientListOptions) *runtime.Pager[ProjectsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProjectsClientListResponse]{ + More: func(page ProjectsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProjectsClientListResponse) (ProjectsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProjectsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return ProjectsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ProjectsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *ProjectsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects" + 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", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProjectsClient) listHandleResponse(resp *http.Response) (ProjectsClientListResponse, error) { + result := ProjectsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProjectListResult); err != nil { + return ProjectsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a Cognitive Services Project +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - projectName - The name of Cognitive Services account's project. +// - project - The parameters to provide for the created project. +// - options - ProjectsClientBeginUpdateOptions contains the optional parameters for the ProjectsClient.BeginUpdate method. +func (client *ProjectsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, projectName string, project Project, options *ProjectsClientBeginUpdateOptions) (*runtime.Poller[ProjectsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, projectName, project, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a Cognitive Services Project +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-06-01 +func (client *ProjectsClient) update(ctx context.Context, resourceGroupName string, accountName string, projectName string, project Project, options *ProjectsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ProjectsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, projectName, project, 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 *ProjectsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, project Project, _ *ProjectsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + 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.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, project); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client.go index add242331be6..4d0b739a0b04 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,7 @@ func NewRaiBlocklistItemsClient(subscriptionID string, credential azcore.TokenCr // BatchAdd - Batch operation to add blocklist items. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -76,7 +73,7 @@ func (client *RaiBlocklistItemsClient) BatchAdd(ctx context.Context, resourceGro } // batchAddCreateRequest creates the BatchAdd request. -func (client *RaiBlocklistItemsClient) batchAddCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItems []*RaiBlocklistItemBulkRequest, options *RaiBlocklistItemsClientBatchAddOptions) (*policy.Request, error) { +func (client *RaiBlocklistItemsClient) batchAddCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItems []*RaiBlocklistItemBulkRequest, _ *RaiBlocklistItemsClientBatchAddOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/addRaiBlocklistItems" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -99,7 +96,7 @@ func (client *RaiBlocklistItemsClient) batchAddCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiBlocklistItems); err != nil { @@ -120,7 +117,7 @@ func (client *RaiBlocklistItemsClient) batchAddHandleResponse(resp *http.Respons // BatchDelete - Batch operation to delete blocklist items. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -149,7 +146,7 @@ func (client *RaiBlocklistItemsClient) BatchDelete(ctx context.Context, resource } // batchDeleteCreateRequest creates the BatchDelete request. -func (client *RaiBlocklistItemsClient) batchDeleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemsNames any, options *RaiBlocklistItemsClientBatchDeleteOptions) (*policy.Request, error) { +func (client *RaiBlocklistItemsClient) batchDeleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemsNames any, _ *RaiBlocklistItemsClientBatchDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -172,7 +169,7 @@ func (client *RaiBlocklistItemsClient) batchDeleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiBlocklistItemsNames); err != nil { @@ -184,7 +181,7 @@ func (client *RaiBlocklistItemsClient) batchDeleteCreateRequest(ctx context.Cont // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -215,7 +212,7 @@ func (client *RaiBlocklistItemsClient) CreateOrUpdate(ctx context.Context, resou } // 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) { +func (client *RaiBlocklistItemsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, raiBlocklistItem RaiBlocklistItem, _ *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") @@ -242,7 +239,7 @@ func (client *RaiBlocklistItemsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiBlocklistItem); err != nil { @@ -263,7 +260,7 @@ func (client *RaiBlocklistItemsClient) createOrUpdateHandleResponse(resp *http.R // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -291,7 +288,7 @@ func (client *RaiBlocklistItemsClient) BeginDelete(ctx context.Context, resource // 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 2024-10-01 +// Generated from API version 2025-06-01 func (client *RaiBlocklistItemsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, options *RaiBlocklistItemsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "RaiBlocklistItemsClient.BeginDelete" @@ -314,7 +311,7 @@ func (client *RaiBlocklistItemsClient) deleteOperation(ctx context.Context, reso } // 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) { +func (client *RaiBlocklistItemsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, _ *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") @@ -341,7 +338,7 @@ func (client *RaiBlocklistItemsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -350,7 +347,7 @@ func (client *RaiBlocklistItemsClient) deleteCreateRequest(ctx context.Context, // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -379,7 +376,7 @@ func (client *RaiBlocklistItemsClient) Get(ctx context.Context, resourceGroupNam } // 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) { +func (client *RaiBlocklistItemsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklistItemName string, _ *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") @@ -406,7 +403,7 @@ func (client *RaiBlocklistItemsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -423,7 +420,7 @@ func (client *RaiBlocklistItemsClient) getHandleResponse(resp *http.Response) (R // NewListPager - Gets the blocklist items associated with the custom blocklist. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -453,7 +450,7 @@ func (client *RaiBlocklistItemsClient) NewListPager(resourceGroupName string, ac } // listCreateRequest creates the List request. -func (client *RaiBlocklistItemsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, options *RaiBlocklistItemsClientListOptions) (*policy.Request, error) { +func (client *RaiBlocklistItemsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, _ *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") @@ -476,7 +473,7 @@ func (client *RaiBlocklistItemsClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client_example_test.go deleted file mode 100644 index 1ac098f8629a..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client_example_test.go +++ /dev/null @@ -1,206 +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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListBlocklistItems.json -func ExampleRaiBlocklistItemsClient_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.NewRaiBlocklistItemsClient().NewListPager("resourceGroupName", "accountName", "raiBlocklistName", 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.RaiBlockListItemsResult = armcognitiveservices.RaiBlockListItemsResult{ - // Value: []*armcognitiveservices.RaiBlocklistItem{ - // { - // Name: to.Ptr("raiBlocklistItemName"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiBlocklists/raiBlocklistName/raiBlocklistItems/raiBlocklistItemName"), - // Properties: &armcognitiveservices.RaiBlocklistItemProperties{ - // IsRegex: to.Ptr(false), - // Pattern: to.Ptr("Pattern To Block"), - // }, - // }, - // { - // Name: to.Ptr("raiBlocklistItemName2"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiBlocklists/raiBlocklistName/raiBlocklistItems/raiBlocklistItemName2"), - // Properties: &armcognitiveservices.RaiBlocklistItemProperties{ - // IsRegex: to.Ptr(false), - // Pattern: to.Ptr("Another Pattern To Block"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiBlocklistItem.json -func ExampleRaiBlocklistItemsClient_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.NewRaiBlocklistItemsClient().Get(ctx, "resourceGroupName", "accountName", "raiBlocklistName", "raiBlocklistItemName", 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.RaiBlocklistItem = armcognitiveservices.RaiBlocklistItem{ - // Name: to.Ptr("raiBlocklistItemName"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiBlocklists/raiBlocklistName/raiBlocklistItems/raiBlocklistItemName"), - // Properties: &armcognitiveservices.RaiBlocklistItemProperties{ - // IsRegex: to.Ptr(false), - // Pattern: to.Ptr("Pattern To Block"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutRaiBlocklistItem.json -func ExampleRaiBlocklistItemsClient_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.NewRaiBlocklistItemsClient().CreateOrUpdate(ctx, "resourceGroupName", "accountName", "raiBlocklistName", "raiBlocklistItemName", armcognitiveservices.RaiBlocklistItem{ - Properties: &armcognitiveservices.RaiBlocklistItemProperties{ - IsRegex: to.Ptr(false), - Pattern: to.Ptr("Pattern To Block"), - }, - }, 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.RaiBlocklistItem = armcognitiveservices.RaiBlocklistItem{ - // Name: to.Ptr("raiBlocklistItemName"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiBlocklists/raiBlocklistName/raiBlocklistItems/raiBlocklistItemName"), - // Properties: &armcognitiveservices.RaiBlocklistItemProperties{ - // IsRegex: to.Ptr(false), - // Pattern: to.Ptr("Pattern To Block"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiBlocklistItem.json -func ExampleRaiBlocklistItemsClient_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.NewRaiBlocklistItemsClient().BeginDelete(ctx, "resourceGroupName", "accountName", "raiBlocklistName", "raiBlocklistItemName", 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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/AddRaiBlocklistItems.json -func ExampleRaiBlocklistItemsClient_BatchAdd() { - 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.NewRaiBlocklistItemsClient().BatchAdd(ctx, "resourceGroupName", "accountName", "myblocklist", []*armcognitiveservices.RaiBlocklistItemBulkRequest{ - { - Name: to.Ptr("myblocklistitem1"), - Properties: &armcognitiveservices.RaiBlocklistItemProperties{ - IsRegex: to.Ptr(true), - Pattern: to.Ptr("^[a-z0-9_-]{2,16}$"), - }, - }, - { - Name: to.Ptr("myblocklistitem2"), - Properties: &armcognitiveservices.RaiBlocklistItemProperties{ - IsRegex: to.Ptr(false), - Pattern: to.Ptr("blockwords"), - }, - }}, 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.RaiBlocklist = armcognitiveservices.RaiBlocklist{ - // Name: to.Ptr("myblocklist"), - // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), - // Properties: &armcognitiveservices.RaiBlocklistProperties{ - // Description: to.Ptr("Brief description of the blocklist"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiBlocklistItems.json -func ExampleRaiBlocklistItemsClient_BatchDelete() { - 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) - } - _, err = clientFactory.NewRaiBlocklistItemsClient().BatchDelete(ctx, "resourceGroupName", "accountName", "raiBlocklistName", []any{ - "myblocklistitem1", - "myblocklistitem2", - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client.go index 89a321d90468..86321c095ef4 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,7 @@ func NewRaiBlocklistsClient(subscriptionID string, credential azcore.TokenCreden // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -76,7 +73,7 @@ func (client *RaiBlocklistsClient) CreateOrUpdate(ctx context.Context, resourceG } // 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) { +func (client *RaiBlocklistsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, raiBlocklist RaiBlocklist, _ *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") @@ -99,7 +96,7 @@ func (client *RaiBlocklistsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiBlocklist); err != nil { @@ -120,7 +117,7 @@ func (client *RaiBlocklistsClient) createOrUpdateHandleResponse(resp *http.Respo // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -147,7 +144,7 @@ func (client *RaiBlocklistsClient) BeginDelete(ctx context.Context, resourceGrou // 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 2024-10-01 +// Generated from API version 2025-06-01 func (client *RaiBlocklistsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, options *RaiBlocklistsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "RaiBlocklistsClient.BeginDelete" @@ -170,7 +167,7 @@ func (client *RaiBlocklistsClient) deleteOperation(ctx context.Context, resource } // deleteCreateRequest creates the Delete request. -func (client *RaiBlocklistsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, options *RaiBlocklistsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *RaiBlocklistsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, _ *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") @@ -193,7 +190,7 @@ func (client *RaiBlocklistsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +199,7 @@ func (client *RaiBlocklistsClient) deleteCreateRequest(ctx context.Context, reso // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -230,7 +227,7 @@ func (client *RaiBlocklistsClient) Get(ctx context.Context, resourceGroupName st } // getCreateRequest creates the Get request. -func (client *RaiBlocklistsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, options *RaiBlocklistsClientGetOptions) (*policy.Request, error) { +func (client *RaiBlocklistsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiBlocklistName string, _ *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") @@ -253,7 +250,7 @@ func (client *RaiBlocklistsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,7 +267,7 @@ func (client *RaiBlocklistsClient) getHandleResponse(resp *http.Response) (RaiBl // NewListPager - Gets the custom blocklists associated with the Azure OpenAI account. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - 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. @@ -298,7 +295,7 @@ func (client *RaiBlocklistsClient) NewListPager(resourceGroupName string, accoun } // listCreateRequest creates the List request. -func (client *RaiBlocklistsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *RaiBlocklistsClientListOptions) (*policy.Request, error) { +func (client *RaiBlocklistsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *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") @@ -317,7 +314,7 @@ func (client *RaiBlocklistsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client_example_test.go deleted file mode 100644 index 8b86d0c43ec5..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client_example_test.go +++ /dev/null @@ -1,133 +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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListBlocklists.json -func ExampleRaiBlocklistsClient_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.NewRaiBlocklistsClient().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.RaiBlockListResult = armcognitiveservices.RaiBlockListResult{ - // Value: []*armcognitiveservices.RaiBlocklist{ - // { - // Name: to.Ptr("raiBlocklistName"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiBlocklists/raiBlocklistName"), - // Properties: &armcognitiveservices.RaiBlocklistProperties{ - // Description: to.Ptr("This is a sample blocklist"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiBlocklist.json -func ExampleRaiBlocklistsClient_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.NewRaiBlocklistsClient().Get(ctx, "resourceGroupName", "accountName", "raiBlocklistName", 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.RaiBlocklist = armcognitiveservices.RaiBlocklist{ - // Name: to.Ptr("raiBlocklistName"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiBlocklists/raiBlocklistName"), - // Properties: &armcognitiveservices.RaiBlocklistProperties{ - // Description: to.Ptr("This is a sample blocklist"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutRaiBlocklist.json -func ExampleRaiBlocklistsClient_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.NewRaiBlocklistsClient().CreateOrUpdate(ctx, "resourceGroupName", "accountName", "raiBlocklistName", armcognitiveservices.RaiBlocklist{ - Properties: &armcognitiveservices.RaiBlocklistProperties{ - Description: to.Ptr("Basic blocklist description"), - }, - }, 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.RaiBlocklist = armcognitiveservices.RaiBlocklist{ - // Name: to.Ptr("raiBlocklistName"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiBlocklists/raiBlocklistName"), - // Properties: &armcognitiveservices.RaiBlocklistProperties{ - // Description: to.Ptr("Basic blocklist description"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiBlocklist.json -func ExampleRaiBlocklistsClient_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.NewRaiBlocklistsClient().BeginDelete(ctx, "resourceGroupName", "accountName", "raiBlocklistName", 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/raicontentfilters_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client.go index b6e74785613e..4b124c85514e 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,7 @@ func NewRaiContentFiltersClient(subscriptionID string, credential azcore.TokenCr // Get - Get Content Filters by Name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - location - Resource location. // - filterName - The name of the RAI Content Filter. // - options - RaiContentFiltersClientGetOptions contains the optional parameters for the RaiContentFiltersClient.Get method. @@ -73,7 +70,7 @@ func (client *RaiContentFiltersClient) Get(ctx context.Context, location string, } // getCreateRequest creates the Get request. -func (client *RaiContentFiltersClient) getCreateRequest(ctx context.Context, location string, filterName string, options *RaiContentFiltersClientGetOptions) (*policy.Request, error) { +func (client *RaiContentFiltersClient) getCreateRequest(ctx context.Context, location string, filterName string, _ *RaiContentFiltersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -92,7 +89,7 @@ func (client *RaiContentFiltersClient) getCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +106,7 @@ func (client *RaiContentFiltersClient) getHandleResponse(resp *http.Response) (R // NewListPager - List Content Filters types. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - location - Resource location. // - options - RaiContentFiltersClientListOptions contains the optional parameters for the RaiContentFiltersClient.NewListPager // method. @@ -137,7 +134,7 @@ func (client *RaiContentFiltersClient) NewListPager(location string, options *Ra } // listCreateRequest creates the List request. -func (client *RaiContentFiltersClient) listCreateRequest(ctx context.Context, location string, options *RaiContentFiltersClientListOptions) (*policy.Request, error) { +func (client *RaiContentFiltersClient) listCreateRequest(ctx context.Context, location string, _ *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") @@ -152,7 +149,7 @@ func (client *RaiContentFiltersClient) listCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client_example_test.go deleted file mode 100644 index be5c981c914d..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client_example_test.go +++ /dev/null @@ -1,161 +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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListRaiContentFilters.json -func ExampleRaiContentFiltersClient_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.NewRaiContentFiltersClient().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.RaiContentFilterListResult = armcognitiveservices.RaiContentFilterListResult{ - // Value: []*armcognitiveservices.RaiContentFilter{ - // { - // Name: to.Ptr("Hate"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/raiContentFilters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/WestUS/raiContentFilters/Hate"), - // Properties: &armcognitiveservices.RaiContentFilterProperties{ - // Name: to.Ptr("Hate"), - // IsMultiLevelFilter: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("Sexual"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/raiContentFilters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/WestUS/raiContentFilters/Sexual"), - // Properties: &armcognitiveservices.RaiContentFilterProperties{ - // Name: to.Ptr("Sexual"), - // IsMultiLevelFilter: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("Violence"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/raiContentFilters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/WestUS/raiContentFilters/Violence"), - // Properties: &armcognitiveservices.RaiContentFilterProperties{ - // Name: to.Ptr("Violence"), - // IsMultiLevelFilter: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("Selfharm"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/raiContentFilters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/WestUS/raiContentFilters/Selfharm"), - // Properties: &armcognitiveservices.RaiContentFilterProperties{ - // Name: to.Ptr("Selfharm"), - // IsMultiLevelFilter: to.Ptr(true), - // }, - // }, - // { - // Name: to.Ptr("Jailbreak"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/raiContentFilters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/WestUS/raiContentFilters/Jailbreak"), - // Properties: &armcognitiveservices.RaiContentFilterProperties{ - // Name: to.Ptr("Jailbreak"), - // IsMultiLevelFilter: to.Ptr(false), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // }, - // { - // Name: to.Ptr("ProtectedMaterialText"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/raiContentFilters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/WestUS/raiContentFilters/ProtectedMaterialText"), - // Properties: &armcognitiveservices.RaiContentFilterProperties{ - // Name: to.Ptr("Protected Material Text"), - // IsMultiLevelFilter: to.Ptr(false), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // }, - // { - // Name: to.Ptr("ProtectedMaterialCode"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/raiContentFilters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/WestUS/raiContentFilters/ProtectedMaterialCode"), - // Properties: &armcognitiveservices.RaiContentFilterProperties{ - // Name: to.Ptr("Protected Material Code"), - // IsMultiLevelFilter: to.Ptr(false), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // }, - // { - // Name: to.Ptr("Profanity"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/raiContentFilters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/WestUS/raiContentFilters/Profanity"), - // Properties: &armcognitiveservices.RaiContentFilterProperties{ - // Name: to.Ptr("Profanity"), - // IsMultiLevelFilter: to.Ptr(false), - // }, - // }, - // { - // Name: to.Ptr("IndirectAttack"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/raiContentFilters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/WestUS/raiContentFilters/IndirectAttack"), - // Properties: &armcognitiveservices.RaiContentFilterProperties{ - // Name: to.Ptr("Indirect Attack"), - // IsMultiLevelFilter: to.Ptr(false), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiContentFilter.json -func ExampleRaiContentFiltersClient_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.NewRaiContentFiltersClient().Get(ctx, "WestUS", "IndirectAttack", 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.RaiContentFilter = armcognitiveservices.RaiContentFilter{ - // Name: to.Ptr("IndirectAttack"), - // Type: to.Ptr("Microsoft.CognitiveServices/locations/raiContentFilters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/WestUS/raiContentFilters/IndirectAttack"), - // Properties: &armcognitiveservices.RaiContentFilterProperties{ - // Name: to.Ptr("Indirect Attack"), - // IsMultiLevelFilter: to.Ptr(false), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // } -} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client.go index 5655ab83c98b..8034b7f1e876 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client.go @@ -1,6 +1,3 @@ -//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. @@ -46,7 +43,7 @@ func NewRaiPoliciesClient(subscriptionID string, credential azcore.TokenCredenti // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -76,7 +73,7 @@ func (client *RaiPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGro } // 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) { +func (client *RaiPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, raiPolicy RaiPolicy, _ *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") @@ -99,7 +96,7 @@ func (client *RaiPoliciesClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiPolicy); err != nil { @@ -120,7 +117,7 @@ func (client *RaiPoliciesClient) createOrUpdateHandleResponse(resp *http.Respons // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -146,7 +143,7 @@ func (client *RaiPoliciesClient) BeginDelete(ctx context.Context, resourceGroupN // 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 2024-10-01 +// Generated from API version 2025-06-01 func (client *RaiPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, options *RaiPoliciesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "RaiPoliciesClient.BeginDelete" @@ -169,7 +166,7 @@ func (client *RaiPoliciesClient) deleteOperation(ctx context.Context, resourceGr } // deleteCreateRequest creates the Delete request. -func (client *RaiPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, options *RaiPoliciesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *RaiPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, _ *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") @@ -192,7 +189,7 @@ func (client *RaiPoliciesClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -201,7 +198,7 @@ func (client *RaiPoliciesClient) deleteCreateRequest(ctx context.Context, resour // 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 2024-10-01 +// Generated from API version 2025-06-01 // - 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 @@ -229,7 +226,7 @@ func (client *RaiPoliciesClient) Get(ctx context.Context, resourceGroupName stri } // getCreateRequest creates the Get request. -func (client *RaiPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, options *RaiPoliciesClientGetOptions) (*policy.Request, error) { +func (client *RaiPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, raiPolicyName string, _ *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") @@ -252,7 +249,7 @@ func (client *RaiPoliciesClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +266,7 @@ func (client *RaiPoliciesClient) getHandleResponse(resp *http.Response) (RaiPoli // NewListPager - Gets the content filters associated with the Azure OpenAI account. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - 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. @@ -297,7 +294,7 @@ func (client *RaiPoliciesClient) NewListPager(resourceGroupName string, accountN } // listCreateRequest creates the List request. -func (client *RaiPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *RaiPoliciesClientListOptions) (*policy.Request, error) { +func (client *RaiPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *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") @@ -316,7 +313,7 @@ func (client *RaiPoliciesClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client_example_test.go deleted file mode 100644 index 657042e7f6d2..000000000000 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client_example_test.go +++ /dev/null @@ -1,461 +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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListRaiPolicies.json -func ExampleRaiPoliciesClient_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.NewRaiPoliciesClient().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.RaiPolicyListResult = armcognitiveservices.RaiPolicyListResult{ - // Value: []*armcognitiveservices.RaiPolicy{ - // { - // Name: to.Ptr("raiPolicyName"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiPolicies/raiPolicyName"), - // Properties: &armcognitiveservices.RaiPolicyProperties{ - // BasePolicyName: to.Ptr("Microsoft.Default"), - // ContentFilters: []*armcognitiveservices.RaiPolicyContentFilter{ - // { - // Name: to.Ptr("Hate"), - // Blocking: to.Ptr(false), - // Enabled: to.Ptr(false), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Hate"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Sexual"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Sexual"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Selfharm"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Selfharm"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Violence"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Violence"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Jailbreak"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Protected Material Text"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Protected Material Code"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Profanity"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }}, - // Mode: to.Ptr(armcognitiveservices.RaiPolicyModeAsynchronousFilter), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiPolicy.json -func ExampleRaiPoliciesClient_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.NewRaiPoliciesClient().Get(ctx, "resourceGroupName", "accountName", "raiPolicyName", 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.RaiPolicy = armcognitiveservices.RaiPolicy{ - // Name: to.Ptr("raiPolicyName"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiPolicies/raiPolicyName"), - // Properties: &armcognitiveservices.RaiPolicyProperties{ - // BasePolicyName: to.Ptr("Microsoft.Default"), - // ContentFilters: []*armcognitiveservices.RaiPolicyContentFilter{ - // { - // Name: to.Ptr("Hate"), - // Blocking: to.Ptr(false), - // Enabled: to.Ptr(false), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Hate"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Sexual"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Sexual"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Selfharm"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Selfharm"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Violence"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Violence"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Jailbreak"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Protected Material Text"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Protected Material Code"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Profanity"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }}, - // Mode: to.Ptr(armcognitiveservices.RaiPolicyModeAsynchronousFilter), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutRaiPolicy.json -func ExampleRaiPoliciesClient_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.NewRaiPoliciesClient().CreateOrUpdate(ctx, "resourceGroupName", "accountName", "raiPolicyName", armcognitiveservices.RaiPolicy{ - Properties: &armcognitiveservices.RaiPolicyProperties{ - BasePolicyName: to.Ptr("Microsoft.Default"), - ContentFilters: []*armcognitiveservices.RaiPolicyContentFilter{ - { - Name: to.Ptr("Hate"), - Blocking: to.Ptr(false), - Enabled: to.Ptr(false), - SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - }, - { - Name: to.Ptr("Hate"), - Blocking: to.Ptr(true), - Enabled: to.Ptr(true), - SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - }, - { - Name: to.Ptr("Sexual"), - Blocking: to.Ptr(true), - Enabled: to.Ptr(true), - SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - }, - { - Name: to.Ptr("Sexual"), - Blocking: to.Ptr(true), - Enabled: to.Ptr(true), - SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - }, - { - Name: to.Ptr("Selfharm"), - Blocking: to.Ptr(true), - Enabled: to.Ptr(true), - SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - }, - { - Name: to.Ptr("Selfharm"), - Blocking: to.Ptr(true), - Enabled: to.Ptr(true), - SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - }, - { - Name: to.Ptr("Violence"), - Blocking: to.Ptr(true), - Enabled: to.Ptr(true), - SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - }, - { - Name: to.Ptr("Violence"), - Blocking: to.Ptr(true), - Enabled: to.Ptr(true), - SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - }, - { - Name: to.Ptr("Jailbreak"), - Blocking: to.Ptr(true), - Enabled: to.Ptr(true), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - }, - { - Name: to.Ptr("Protected Material Text"), - Blocking: to.Ptr(true), - Enabled: to.Ptr(true), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - }, - { - Name: to.Ptr("Protected Material Code"), - Blocking: to.Ptr(true), - Enabled: to.Ptr(true), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - }, - { - Name: to.Ptr("Profanity"), - Blocking: to.Ptr(true), - Enabled: to.Ptr(true), - Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - }}, - Mode: to.Ptr(armcognitiveservices.RaiPolicyModeAsynchronousFilter), - }, - }, 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.RaiPolicy = armcognitiveservices.RaiPolicy{ - // Name: to.Ptr("raiPolicyName"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiPolicies/raiPolicyName"), - // Properties: &armcognitiveservices.RaiPolicyProperties{ - // BasePolicyName: to.Ptr("Microsoft.Default"), - // ContentFilters: []*armcognitiveservices.RaiPolicyContentFilter{ - // { - // Name: to.Ptr("Hate"), - // Blocking: to.Ptr(false), - // Enabled: to.Ptr(false), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Hate"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Sexual"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Sexual"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Selfharm"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelHigh), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Selfharm"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Violence"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Violence"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // SeverityThreshold: to.Ptr(armcognitiveservices.ContentLevelMedium), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Jailbreak"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }, - // { - // Name: to.Ptr("Protected Material Text"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Protected Material Code"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourceCompletion), - // }, - // { - // Name: to.Ptr("Profanity"), - // Blocking: to.Ptr(true), - // Enabled: to.Ptr(true), - // Source: to.Ptr(armcognitiveservices.RaiPolicyContentSourcePrompt), - // }}, - // Mode: to.Ptr(armcognitiveservices.RaiPolicyModeAsynchronousFilter), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiPolicy.json -func ExampleRaiPoliciesClient_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.NewRaiPoliciesClient().BeginDelete(ctx, "resourceGroupName", "accountName", "raiPolicyName", 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/resourceskus_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go index bc5b832ca0f5..69807bca2636 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go @@ -1,6 +1,3 @@ -//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. @@ -45,7 +42,7 @@ func NewResourceSKUsClient(subscriptionID string, credential azcore.TokenCredent // NewListPager - Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - options - ResourceSKUsClientListOptions contains the optional parameters for the ResourceSKUsClient.NewListPager method. func (client *ResourceSKUsClient) NewListPager(options *ResourceSKUsClientListOptions) *runtime.Pager[ResourceSKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ResourceSKUsClientListResponse]{ @@ -71,7 +68,7 @@ func (client *ResourceSKUsClient) NewListPager(options *ResourceSKUsClientListOp } // listCreateRequest creates the List request. -func (client *ResourceSKUsClient) listCreateRequest(ctx context.Context, options *ResourceSKUsClientListOptions) (*policy.Request, error) { +func (client *ResourceSKUsClient) listCreateRequest(ctx context.Context, _ *ResourceSKUsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/skus" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -82,7 +79,7 @@ func (client *ResourceSKUsClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client_example_test.go deleted file mode 100644 index 6635171a1511..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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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/responses.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/responses.go index 2f41b58b7ec3..8e679084b854 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/responses.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/responses.go @@ -1,6 +1,3 @@ -//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. @@ -8,6 +5,51 @@ package armcognitiveservices +// AccountCapabilityHostsClientCreateOrUpdateResponse contains the response from method AccountCapabilityHostsClient.BeginCreateOrUpdate. +type AccountCapabilityHostsClientCreateOrUpdateResponse struct { + // Azure Resource Manager resource envelope. + CapabilityHost +} + +// AccountCapabilityHostsClientDeleteResponse contains the response from method AccountCapabilityHostsClient.BeginDelete. +type AccountCapabilityHostsClientDeleteResponse struct { + // placeholder for future response values +} + +// AccountCapabilityHostsClientGetResponse contains the response from method AccountCapabilityHostsClient.Get. +type AccountCapabilityHostsClientGetResponse struct { + // Azure Resource Manager resource envelope. + CapabilityHost +} + +// AccountConnectionsClientCreateResponse contains the response from method AccountConnectionsClient.Create. +type AccountConnectionsClientCreateResponse struct { + // Connection base resource schema. + ConnectionPropertiesV2BasicResource +} + +// AccountConnectionsClientDeleteResponse contains the response from method AccountConnectionsClient.Delete. +type AccountConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// AccountConnectionsClientGetResponse contains the response from method AccountConnectionsClient.Get. +type AccountConnectionsClientGetResponse struct { + // Connection base resource schema. + ConnectionPropertiesV2BasicResource +} + +// AccountConnectionsClientListResponse contains the response from method AccountConnectionsClient.NewListPager. +type AccountConnectionsClientListResponse struct { + ConnectionPropertiesV2BasicResourceArmPaginatedResult +} + +// AccountConnectionsClientUpdateResponse contains the response from method AccountConnectionsClient.Update. +type AccountConnectionsClientUpdateResponse struct { + // Connection base resource schema. + ConnectionPropertiesV2BasicResource +} + // 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. @@ -348,6 +390,83 @@ type PrivateLinkResourcesClientListResponse struct { PrivateLinkResourceListResult } +// ProjectCapabilityHostsClientCreateOrUpdateResponse contains the response from method ProjectCapabilityHostsClient.BeginCreateOrUpdate. +type ProjectCapabilityHostsClientCreateOrUpdateResponse struct { + // Azure Resource Manager resource envelope. + CapabilityHost +} + +// ProjectCapabilityHostsClientDeleteResponse contains the response from method ProjectCapabilityHostsClient.BeginDelete. +type ProjectCapabilityHostsClientDeleteResponse struct { + // placeholder for future response values +} + +// ProjectCapabilityHostsClientGetResponse contains the response from method ProjectCapabilityHostsClient.Get. +type ProjectCapabilityHostsClientGetResponse struct { + // Azure Resource Manager resource envelope. + CapabilityHost +} + +// ProjectConnectionsClientCreateResponse contains the response from method ProjectConnectionsClient.Create. +type ProjectConnectionsClientCreateResponse struct { + // Connection base resource schema. + ConnectionPropertiesV2BasicResource +} + +// ProjectConnectionsClientDeleteResponse contains the response from method ProjectConnectionsClient.Delete. +type ProjectConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ProjectConnectionsClientGetResponse contains the response from method ProjectConnectionsClient.Get. +type ProjectConnectionsClientGetResponse struct { + // Connection base resource schema. + ConnectionPropertiesV2BasicResource +} + +// ProjectConnectionsClientListResponse contains the response from method ProjectConnectionsClient.NewListPager. +type ProjectConnectionsClientListResponse struct { + ConnectionPropertiesV2BasicResourceArmPaginatedResult +} + +// ProjectConnectionsClientUpdateResponse contains the response from method ProjectConnectionsClient.Update. +type ProjectConnectionsClientUpdateResponse struct { + // Connection base resource schema. + ConnectionPropertiesV2BasicResource +} + +// ProjectsClientCreateResponse contains the response from method ProjectsClient.BeginCreate. +type ProjectsClientCreateResponse struct { + // Cognitive Services project is an Azure resource representing the provisioned account's project, it's type, location and + // SKU. + Project +} + +// ProjectsClientDeleteResponse contains the response from method ProjectsClient.BeginDelete. +type ProjectsClientDeleteResponse struct { + // placeholder for future response values +} + +// ProjectsClientGetResponse contains the response from method ProjectsClient.Get. +type ProjectsClientGetResponse struct { + // Cognitive Services project is an Azure resource representing the provisioned account's project, it's type, location and + // SKU. + Project +} + +// ProjectsClientListResponse contains the response from method ProjectsClient.NewListPager. +type ProjectsClientListResponse struct { + // The list of cognitive services projects operation response. + ProjectListResult +} + +// ProjectsClientUpdateResponse contains the response from method ProjectsClient.BeginUpdate. +type ProjectsClientUpdateResponse struct { + // Cognitive Services project is an Azure resource representing the provisioned account's project, it's type, location and + // SKU. + Project +} + // RaiBlocklistItemsClientBatchAddResponse contains the response from method RaiBlocklistItemsClient.BatchAdd. type RaiBlocklistItemsClientBatchAddResponse struct { // Cognitive Services RaiBlocklist. diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/time_rfc3339.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/time_rfc3339.go index 9024c258fe32..16dab5d92922 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/time_rfc3339.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/time_rfc3339.go @@ -1,6 +1,3 @@ -//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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go index efc7a4dbbe8a..39d128f4d074 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go @@ -1,6 +1,3 @@ -//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. @@ -45,7 +42,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListPager - Get usages for the requested subscription // -// Generated from API version 2024-10-01 +// Generated from API version 2025-06-01 // - location - Resource location. // - options - UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. func (client *UsagesClient) NewListPager(location string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { @@ -90,7 +87,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil 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 5e94b2140a95..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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-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), - // }}, - // } - } -}