diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md index 3fbae2b53f9c..68e90b2c3ce9 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md @@ -1,5 +1,93 @@ # Release History +## 4.0.0-beta.2 (2026-05-26) +### Breaking Changes + +- Function `*OutboundRulesClient.BeginPost` return value(s) have been changed from `(*runtime.Poller[OutboundRulesClientPostResponse], error)` to `(*runtime.Poller[*runtime.Pager[OutboundRulesClientPostResponse]], error)` +- `RoutingModeAccuracy` from enum `RoutingMode` has been removed +- Struct `CustomTopicConfig` has been removed +- Struct `RaiExternalSafetyProvider` has been removed +- Struct `RaiExternalSafetyProviderProperties` has been removed +- Field `Value` of struct `RaiExternalSafetyProviderClientCreateOrUpdateResponse` has been removed +- Field `CustomTopics` of struct `RaiPolicyProperties` has been removed + +### Features Added + +- New value `RoutingModeQuality` added to enum type `RoutingMode` +- New enum type `ComputeProvisioningState` with values `ComputeProvisioningStateAccepted`, `ComputeProvisioningStateCanceled`, `ComputeProvisioningStateDeleting`, `ComputeProvisioningStateDisabled`, `ComputeProvisioningStateFailed`, `ComputeProvisioningStateRestarting`, `ComputeProvisioningStateScaling`, `ComputeProvisioningStateStarting`, `ComputeProvisioningStateStopped`, `ComputeProvisioningStateStopping`, `ComputeProvisioningStateSucceeded` +- New enum type `ComputeType` with values `ComputeTypeCluster`, `ComputeTypeContainerInstance` +- New enum type `PolicyEvaluationOutcome` with values `PolicyEvaluationOutcomeCompliant`, `PolicyEvaluationOutcomeError`, `PolicyEvaluationOutcomeNonCompliant` +- New enum type `VMPriority` with values `VMPriorityLowPriority`, `VMPriorityRegular` +- New function `*AccountsClient.EvaluateDeploymentPolicies(ctx context.Context, resourceGroupName string, accountName string, body EvaluateDeploymentPoliciesRequest, options *AccountsClientEvaluateDeploymentPoliciesOptions) (AccountsClientEvaluateDeploymentPoliciesResponse, error)` +- New function `*ClientFactory.NewComputesClient() *ComputesClient` +- New function `*ClientFactory.NewManagedComputeCapacitiesClient() *ManagedComputeCapacitiesClient` +- New function `*ClientFactory.NewManagedComputeDeploymentsClient() *ManagedComputeDeploymentsClient` +- New function `*ClientFactory.NewManagedComputeUsagesOperationGroupClient() *ManagedComputeUsagesOperationGroupClient` +- New function `*ClientFactory.NewWorkbenchesClient() *WorkbenchesClient` +- New function `*ClusterComputeProperties.GetComputeProperties() *ComputeProperties` +- New function `*ComputeProperties.GetComputeProperties() *ComputeProperties` +- New function `NewComputesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ComputesClient, error)` +- New function `*ComputesClient.BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, computeName string, resource Compute, options *ComputesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ComputesClientCreateOrUpdateResponse], error)` +- New function `*ComputesClient.BeginDelete(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginDeleteOptions) (*runtime.Poller[ComputesClientDeleteResponse], error)` +- New function `*ComputesClient.Get(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientGetOptions) (ComputesClientGetResponse, error)` +- New function `*ComputesClient.NewListPager(resourceGroupName string, accountName string, options *ComputesClientListOptions) *runtime.Pager[ComputesClientListResponse]` +- New function `*ComputesClient.BeginRestart(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginRestartOptions) (*runtime.Poller[ComputesClientRestartResponse], error)` +- New function `*ComputesClient.BeginStart(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginStartOptions) (*runtime.Poller[ComputesClientStartResponse], error)` +- New function `*ComputesClient.BeginStop(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginStopOptions) (*runtime.Poller[ComputesClientStopResponse], error)` +- New function `*ComputesClient.BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, computeName string, properties Compute, options *ComputesClientBeginUpdateOptions) (*runtime.Poller[ComputesClientUpdateResponse], error)` +- New function `*ContainerInstanceComputeProperties.GetComputeProperties() *ComputeProperties` +- New function `NewManagedComputeCapacitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedComputeCapacitiesClient, error)` +- New function `*ManagedComputeCapacitiesClient.NewListPager(offer string, options *ManagedComputeCapacitiesClientListOptions) *runtime.Pager[ManagedComputeCapacitiesClientListResponse]` +- New function `NewManagedComputeDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedComputeDeploymentsClient, error)` +- New function `*ManagedComputeDeploymentsClient.BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, resource ManagedComputeDeployment, options *ManagedComputeDeploymentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedComputeDeploymentsClientCreateOrUpdateResponse], error)` +- New function `*ManagedComputeDeploymentsClient.BeginDelete(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *ManagedComputeDeploymentsClientBeginDeleteOptions) (*runtime.Poller[ManagedComputeDeploymentsClientDeleteResponse], error)` +- New function `*ManagedComputeDeploymentsClient.Get(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *ManagedComputeDeploymentsClientGetOptions) (ManagedComputeDeploymentsClientGetResponse, error)` +- New function `*ManagedComputeDeploymentsClient.NewListPager(resourceGroupName string, accountName string, options *ManagedComputeDeploymentsClientListOptions) *runtime.Pager[ManagedComputeDeploymentsClientListResponse]` +- New function `*ManagedComputeDeploymentsClient.BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, properties PatchResourceSKU, options *ManagedComputeDeploymentsClientBeginUpdateOptions) (*runtime.Poller[ManagedComputeDeploymentsClientUpdateResponse], error)` +- New function `NewManagedComputeUsagesOperationGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedComputeUsagesOperationGroupClient, error)` +- New function `*ManagedComputeUsagesOperationGroupClient.NewListPager(location string, options *ManagedComputeUsagesOperationGroupClientListOptions) *runtime.Pager[ManagedComputeUsagesOperationGroupClientListResponse]` +- New function `NewWorkbenchesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkbenchesClient, error)` +- New function `*WorkbenchesClient.BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, resource Workbench, options *WorkbenchesClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkbenchesClientCreateOrUpdateResponse], error)` +- New function `*WorkbenchesClient.BeginDelete(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginDeleteOptions) (*runtime.Poller[WorkbenchesClientDeleteResponse], error)` +- New function `*WorkbenchesClient.Get(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientGetOptions) (WorkbenchesClientGetResponse, error)` +- New function `*WorkbenchesClient.NewListPager(resourceGroupName string, accountName string, projectName string, options *WorkbenchesClientListOptions) *runtime.Pager[WorkbenchesClientListResponse]` +- New function `*WorkbenchesClient.BeginRestart(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginRestartOptions) (*runtime.Poller[WorkbenchesClientRestartResponse], error)` +- New function `*WorkbenchesClient.BeginStart(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginStartOptions) (*runtime.Poller[WorkbenchesClientStartResponse], error)` +- New function `*WorkbenchesClient.BeginStop(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginStopOptions) (*runtime.Poller[WorkbenchesClientStopResponse], error)` +- New function `*WorkbenchesClient.BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, properties Workbench, options *WorkbenchesClientBeginUpdateOptions) (*runtime.Poller[WorkbenchesClientUpdateResponse], error)` +- New struct `ClusterComputeProperties` +- New struct `Compute` +- New struct `ComputeListResult` +- New struct `ConnectivityEndpoints` +- New struct `ContainerInstanceComputeProperties` +- New struct `DeploymentPolicyEvaluationResult` +- New struct `DeploymentSizeCapacity` +- New struct `EvaluateDeploymentPoliciesDeployment` +- New struct `EvaluateDeploymentPoliciesDeploymentProperties` +- New struct `EvaluateDeploymentPoliciesRequest` +- New struct `EvaluateDeploymentPoliciesResponse` +- New struct `ManagedComputeCapacity` +- New struct `ManagedComputeCapacityListResult` +- New struct `ManagedComputeCapacityProperties` +- New struct `ManagedComputeDeployment` +- New struct `ManagedComputeDeploymentInfo` +- New struct `ManagedComputeDeploymentListResult` +- New struct `ManagedComputeDeploymentProperties` +- New struct `ManagedComputeDeploymentProvisioningDetails` +- New struct `ManagedComputeDeploymentRoutes` +- New struct `ManagedComputeUsage` +- New struct `ManagedComputeUsageListResult` +- New struct `PatchResourceSKU` +- New struct `PolicyAssignmentEvaluationDetails` +- New struct `PolicyExpressionEvaluationDetails` +- New struct `Pool` +- New struct `SSHSettings` +- New struct `Workbench` +- New struct `WorkbenchListResult` +- New struct `WorkbenchProperties` +- New anonymous field `RaiExternalSafetyProviderSchema` in struct `RaiExternalSafetyProviderClientCreateOrUpdateResponse` + + ## 4.0.0-beta.1 (2026-03-26) ### Breaking Changes diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountcapabilityhosts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountcapabilityhosts_client.go index 2e1b9e569b68..108d41b1c9f8 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountcapabilityhosts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountcapabilityhosts_client.go @@ -18,6 +18,8 @@ import ( // AccountCapabilityHostsClient contains the methods for the AccountCapabilityHosts group. // Don't use this type directly, use NewAccountCapabilityHostsClient() instead. +// +// Generated from API version 2026-03-15-preview type AccountCapabilityHostsClient struct { internal *arm.Client subscriptionID string @@ -43,8 +45,6 @@ func NewAccountCapabilityHostsClient(subscriptionID string, credential azcore.To // // Create or update account capabilityHost. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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 @@ -73,8 +73,6 @@ func (client *AccountCapabilityHostsClient) BeginCreateOrUpdate(ctx context.Cont // // Create or update account capabilityHost. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview 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" @@ -120,8 +118,8 @@ func (client *AccountCapabilityHostsClient) createOrUpdateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, capabilityHost); err != nil { @@ -134,8 +132,6 @@ func (client *AccountCapabilityHostsClient) createOrUpdateCreateRequest(ctx cont // // Delete account capabilityHost. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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 @@ -162,8 +158,6 @@ func (client *AccountCapabilityHostsClient) BeginDelete(ctx context.Context, res // // Delete account capabilityHost. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview 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" @@ -209,8 +203,8 @@ func (client *AccountCapabilityHostsClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } @@ -218,8 +212,6 @@ func (client *AccountCapabilityHostsClient) deleteCreateRequest(ctx context.Cont // // Get account capabilityHost. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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 @@ -271,8 +263,8 @@ func (client *AccountCapabilityHostsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -289,8 +281,6 @@ func (client *AccountCapabilityHostsClient) getHandleResponse(resp *http.Respons // NewListPager - List capabilityHost. // // List capabilityHost. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountCapabilityHostsClientListOptions contains the optional parameters for the AccountCapabilityHostsClient.NewListPager @@ -338,8 +328,8 @@ func (client *AccountCapabilityHostsClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountcapabilityhosts_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountcapabilityhosts_client_example_test.go index 562b7a41e9bd..cf5f33838e19 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountcapabilityhosts_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountcapabilityhosts_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/AccountCapabilityHost/createOrUpdate.json +// Generated from example definition: 2026-03-15-preview/AccountCapabilityHost/createOrUpdate.json func ExampleAccountCapabilityHostsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -34,13 +34,13 @@ func ExampleAccountCapabilityHostsClient_BeginCreateOrUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.AccountCapabilityHostsClientCreateOrUpdateResponse{ - // CapabilityHost: &armcognitiveservices.CapabilityHost{ + // CapabilityHost: armcognitiveservices.CapabilityHost{ // Name: to.Ptr("capabilityHostName"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/capabilityHosts"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/account-1/capabilityHosts/capabilityHostName"), @@ -57,7 +57,7 @@ func ExampleAccountCapabilityHostsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/AccountCapabilityHost/delete.json +// Generated from example definition: 2026-03-15-preview/AccountCapabilityHost/delete.json func ExampleAccountCapabilityHostsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -74,11 +74,11 @@ func ExampleAccountCapabilityHostsClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/AccountCapabilityHost/get.json +// Generated from example definition: 2026-03-15-preview/AccountCapabilityHost/get.json func ExampleAccountCapabilityHostsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -97,7 +97,7 @@ func ExampleAccountCapabilityHostsClient_Get() { _ = 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 = armcognitiveservices.AccountCapabilityHostsClientGetResponse{ - // CapabilityHost: &armcognitiveservices.CapabilityHost{ + // CapabilityHost: armcognitiveservices.CapabilityHost{ // Name: to.Ptr("capabilityHostName"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/capabilityHosts"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/account-1/capabilityHosts/capabilityHostName"), @@ -114,7 +114,7 @@ func ExampleAccountCapabilityHostsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/AccountCapabilityHost/list.json +// Generated from example definition: 2026-03-15-preview/AccountCapabilityHost/list.json func ExampleAccountCapabilityHostsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountconnections_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountconnections_client.go index 06c5cc26bd60..883760e02fc0 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountconnections_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountconnections_client.go @@ -19,6 +19,8 @@ import ( // AccountConnectionsClient contains the methods for the AccountConnections group. // Don't use this type directly, use NewAccountConnectionsClient() instead. +// +// Generated from API version 2026-03-15-preview type AccountConnectionsClient struct { internal *arm.Client subscriptionID string @@ -44,8 +46,6 @@ func NewAccountConnectionsClient(subscriptionID string, credential azcore.TokenC // // 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 2026-01-15-preview // - 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 @@ -98,8 +98,8 @@ func (client *AccountConnectionsClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, connection); err != nil { @@ -121,8 +121,6 @@ func (client *AccountConnectionsClient) createHandleResponse(resp *http.Response // // Delete Cognitive Services account connection by name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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 @@ -173,8 +171,8 @@ func (client *AccountConnectionsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } @@ -182,8 +180,6 @@ func (client *AccountConnectionsClient) deleteCreateRequest(ctx context.Context, // // Lists Cognitive Services account connection by name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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 @@ -234,8 +230,8 @@ func (client *AccountConnectionsClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -252,8 +248,6 @@ func (client *AccountConnectionsClient) getHandleResponse(resp *http.Response) ( // NewListPager - Lists all the available Cognitive Services account connections under the specified account. // // Lists all the available Cognitive Services account connections under the specified account. -// -// Generated from API version 2026-01-15-preview // - 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 @@ -301,7 +295,7 @@ func (client *AccountConnectionsClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") + reqQP.Set("api-version", version20260315Preview) if options != nil && options.Category != nil { reqQP.Set("category", *options.Category) } @@ -311,7 +305,7 @@ func (client *AccountConnectionsClient) listCreateRequest(ctx context.Context, r if options != nil && options.Target != nil { reqQP.Set("target", *options.Target) } - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -329,8 +323,6 @@ func (client *AccountConnectionsClient) listHandleResponse(resp *http.Response) // // Update Cognitive Services account connection under the specified account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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 @@ -383,8 +375,8 @@ func (client *AccountConnectionsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, connection); err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountconnections_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountconnections_client_example_test.go index 3ad64735772d..0ce42fa1ea46 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountconnections_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accountconnections_client_example_test.go @@ -13,7 +13,7 @@ import ( "time" ) -// Generated from example definition: 2026-01-15-preview/AccountConnection/create.json +// Generated from example definition: 2026-03-15-preview/AccountConnection/create.json func ExampleAccountConnectionsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExampleAccountConnectionsClient_Create() { _ = 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 = armcognitiveservices.AccountConnectionsClientCreateResponse{ - // ConnectionPropertiesV2BasicResource: &armcognitiveservices.ConnectionPropertiesV2BasicResource{ + // ConnectionPropertiesV2BasicResource: armcognitiveservices.ConnectionPropertiesV2BasicResource{ // Name: to.Ptr("connection-1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/connections"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup-1/providers/Microsoft.CognitiveServices/accounts/account-1/connections/connection-1"), @@ -53,7 +53,7 @@ func ExampleAccountConnectionsClient_Create() { // } } -// Generated from example definition: 2026-01-15-preview/AccountConnection/delete.json +// Generated from example definition: 2026-03-15-preview/AccountConnection/delete.json func ExampleAccountConnectionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -75,7 +75,7 @@ func ExampleAccountConnectionsClient_Delete() { // } } -// Generated from example definition: 2026-01-15-preview/AccountConnection/get.json +// Generated from example definition: 2026-03-15-preview/AccountConnection/get.json func ExampleAccountConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -94,7 +94,7 @@ func ExampleAccountConnectionsClient_Get() { _ = 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 = armcognitiveservices.AccountConnectionsClientGetResponse{ - // ConnectionPropertiesV2BasicResource: &armcognitiveservices.ConnectionPropertiesV2BasicResource{ + // ConnectionPropertiesV2BasicResource: armcognitiveservices.ConnectionPropertiesV2BasicResource{ // Name: to.Ptr("connection-1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/connections"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup-1/providers/Microsoft.CognitiveServices/accounts/account-1/connections/connection-1"), @@ -108,7 +108,7 @@ func ExampleAccountConnectionsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/AccountConnection/list.json +// Generated from example definition: 2026-03-15-preview/AccountConnection/list.json func ExampleAccountConnectionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -162,7 +162,7 @@ func ExampleAccountConnectionsClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/AccountConnection/update.json +// Generated from example definition: 2026-03-15-preview/AccountConnection/update.json func ExampleAccountConnectionsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -193,7 +193,7 @@ func ExampleAccountConnectionsClient_Update() { _ = 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 = armcognitiveservices.AccountConnectionsClientUpdateResponse{ - // ConnectionPropertiesV2BasicResource: &armcognitiveservices.ConnectionPropertiesV2BasicResource{ + // ConnectionPropertiesV2BasicResource: armcognitiveservices.ConnectionPropertiesV2BasicResource{ // Name: to.Ptr("connection-1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/connections"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup-1/providers/Microsoft.CognitiveServices/accounts/account-1/connections/connection-1"), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go index 169d5272601e..a20902b87ba1 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client.go @@ -18,6 +18,8 @@ import ( // AccountsClient contains the methods for the Accounts group. // Don't use this type directly, use NewAccountsClient() instead. +// +// Generated from API version 2026-03-15-preview type AccountsClient struct { internal *arm.Client subscriptionID string @@ -42,8 +44,6 @@ func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for // 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - account - The parameters to provide for the created account. @@ -68,8 +68,6 @@ func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for 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 2026-01-15-preview 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" @@ -111,8 +109,8 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, account); err != nil { @@ -123,8 +121,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. @@ -147,8 +143,6 @@ 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 2026-01-15-preview func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginDelete" @@ -190,15 +184,81 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + +// EvaluateDeploymentPolicies - Evaluate Azure Policy compliance for a set of hypothetical deployments without creating them. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - body - The content of the action request +// - options - AccountsClientEvaluateDeploymentPoliciesOptions contains the optional parameters for the AccountsClient.EvaluateDeploymentPolicies +// method. +func (client *AccountsClient) EvaluateDeploymentPolicies(ctx context.Context, resourceGroupName string, accountName string, body EvaluateDeploymentPoliciesRequest, options *AccountsClientEvaluateDeploymentPoliciesOptions) (AccountsClientEvaluateDeploymentPoliciesResponse, error) { + var err error + const operationName = "AccountsClient.EvaluateDeploymentPolicies" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.evaluateDeploymentPoliciesCreateRequest(ctx, resourceGroupName, accountName, body, options) + if err != nil { + return AccountsClientEvaluateDeploymentPoliciesResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientEvaluateDeploymentPoliciesResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientEvaluateDeploymentPoliciesResponse{}, err + } + resp, err := client.evaluateDeploymentPoliciesHandleResponse(httpResp) + return resp, err +} + +// evaluateDeploymentPoliciesCreateRequest creates the EvaluateDeploymentPolicies request. +func (client *AccountsClient) evaluateDeploymentPoliciesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, body EvaluateDeploymentPoliciesRequest, _ *AccountsClientEvaluateDeploymentPoliciesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/evaluateDeploymentPolicies" + 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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } return req, nil } +// evaluateDeploymentPoliciesHandleResponse handles the EvaluateDeploymentPolicies response. +func (client *AccountsClient) evaluateDeploymentPoliciesHandleResponse(resp *http.Response) (AccountsClientEvaluateDeploymentPoliciesResponse, error) { + result := AccountsClientEvaluateDeploymentPoliciesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EvaluateDeploymentPoliciesResponse); err != nil { + return AccountsClientEvaluateDeploymentPoliciesResponse{}, err + } + return result, nil +} + // Get - Returns a Cognitive Services account specified by the parameters. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. @@ -244,8 +304,8 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -260,8 +320,6 @@ 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 2026-01-15-preview // - options - AccountsClientListOptions contains the optional parameters for the AccountsClient.NewListPager method. func (client *AccountsClient) NewListPager(options *AccountsClientListOptions) *runtime.Pager[AccountsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[AccountsClientListResponse]{ @@ -298,8 +356,8 @@ func (client *AccountsClient) listCreateRequest(ctx context.Context, _ *Accounts return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -314,8 +372,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager // method. @@ -358,8 +414,8 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -375,8 +431,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListKeysOptions contains the optional parameters for the AccountsClient.ListKeys method. @@ -422,8 +476,8 @@ func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -438,8 +492,6 @@ func (client *AccountsClient) listKeysHandleResponse(resp *http.Response) (Accou } // NewListModelsPager - List available Models for the requested Cognitive Services account -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListModelsOptions contains the optional parameters for the AccountsClient.NewListModelsPager method. @@ -486,8 +538,8 @@ func (client *AccountsClient) listModelsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -503,8 +555,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListSKUsOptions contains the optional parameters for the AccountsClient.ListSKUs method. @@ -550,8 +600,8 @@ func (client *AccountsClient) listSKUsCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -567,8 +617,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - AccountsClientListUsagesOptions contains the optional parameters for the AccountsClient.ListUsages method. @@ -617,8 +665,8 @@ func (client *AccountsClient) listUsagesCreateRequest(ctx context.Context, resou if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -634,8 +682,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - parameters - regenerate key parameters. @@ -682,8 +728,8 @@ func (client *AccountsClient) regenerateKeyCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -703,8 +749,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - account - The parameters to provide for the created account. @@ -728,8 +772,6 @@ 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 2026-01-15-preview 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" @@ -771,8 +813,8 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []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 index 1b62dbbbbfd9..c620d9992430 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/accounts_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/CreateAccount.json +// Generated from example definition: 2026-03-15-preview/CreateAccount.json func ExampleAccountsClient_BeginCreate_createAccount() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -53,13 +53,13 @@ func ExampleAccountsClient_BeginCreate_createAccount() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.AccountsClientCreateResponse{ - // Account: &armcognitiveservices.Account{ + // Account: armcognitiveservices.Account{ // Name: to.Ptr("testCreate1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), // Etag: to.Ptr("W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\""), @@ -95,7 +95,7 @@ func ExampleAccountsClient_BeginCreate_createAccount() { // } } -// Generated from example definition: 2026-01-15-preview/CreateAccountMin.json +// Generated from example definition: 2026-03-15-preview/CreateAccountMin.json func ExampleAccountsClient_BeginCreate_createAccountMin() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -122,13 +122,13 @@ func ExampleAccountsClient_BeginCreate_createAccountMin() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.AccountsClientCreateResponse{ - // Account: &armcognitiveservices.Account{ + // Account: armcognitiveservices.Account{ // Name: to.Ptr("testCreate1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), // Etag: to.Ptr("W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\""), @@ -151,7 +151,7 @@ func ExampleAccountsClient_BeginCreate_createAccountMin() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteAccount.json +// Generated from example definition: 2026-03-15-preview/DeleteAccount.json func ExampleAccountsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -168,7 +168,7 @@ func ExampleAccountsClient_BeginDelete() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res @@ -177,7 +177,84 @@ func ExampleAccountsClient_BeginDelete() { // } } -// Generated from example definition: 2026-01-15-preview/GetAccount.json +// Generated from example definition: 2026-03-15-preview/EvaluateDeploymentPolicies.json +func ExampleAccountsClient_EvaluateDeploymentPolicies() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAccountsClient().EvaluateDeploymentPolicies(ctx, "resourceGroupName", "accountName", armcognitiveservices.EvaluateDeploymentPoliciesRequest{ + Deployments: []*armcognitiveservices.EvaluateDeploymentPoliciesDeployment{ + { + Name: to.Ptr("gpt4o-deployment"), + Properties: &armcognitiveservices.EvaluateDeploymentPoliciesDeploymentProperties{ + Model: &armcognitiveservices.DeploymentModel{ + Format: to.Ptr("OpenAI"), + Name: to.Ptr("gpt-4o"), + Version: to.Ptr("2024-11-20"), + }, + RaiPolicyName: to.Ptr("Microsoft.DefaultV2"), + }, + }, + { + Name: to.Ptr("ada-embedding"), + Properties: &armcognitiveservices.EvaluateDeploymentPoliciesDeploymentProperties{ + Model: &armcognitiveservices.DeploymentModel{ + Format: to.Ptr("OpenAI"), + Name: to.Ptr("text-embedding-ada-002"), + Version: to.Ptr("2"), + }, + }, + }, + }, + }, 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 = armcognitiveservices.AccountsClientEvaluateDeploymentPoliciesResponse{ + // EvaluateDeploymentPoliciesResponse: armcognitiveservices.EvaluateDeploymentPoliciesResponse{ + // Results: map[string]*armcognitiveservices.DeploymentPolicyEvaluationResult{ + // "gpt4o-deployment": &armcognitiveservices.DeploymentPolicyEvaluationResult{ + // EvaluationOutcome: to.Ptr(armcognitiveservices.PolicyEvaluationOutcomeCompliant), + // NonCompliantAssignments: []*armcognitiveservices.PolicyAssignmentEvaluationDetails{ + // }, + // }, + // "ada-embedding": &armcognitiveservices.DeploymentPolicyEvaluationResult{ + // EvaluationOutcome: to.Ptr(armcognitiveservices.PolicyEvaluationOutcomeNonCompliant), + // NonCompliantAssignments: []*armcognitiveservices.PolicyAssignmentEvaluationDetails{ + // { + // AssignmentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/deny-gpt-models"), + // PolicyDefinitionID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyDefinitions/deny-embedding-models"), + // EvaluationOutcome: to.Ptr(armcognitiveservices.PolicyEvaluationOutcomeNonCompliant), + // NonComplianceReason: to.Ptr("Model text-embedding-ada-002 is not allowed by policy."), + // Effect: to.Ptr("Deny"), + // ExpressionEvaluations: []*armcognitiveservices.PolicyExpressionEvaluationDetails{ + // { + // Expression: to.Ptr("Microsoft.CognitiveServices/accounts/deployments/model.name"), + // ExpressionKind: to.Ptr("Field"), + // Operator: to.Ptr("notIn"), + // Result: to.Ptr("True"), + // TargetValue: to.Ptr("[\"gpt-4o\",\"gpt-4\"]"), + // ExpressionValue: to.Ptr("text-embedding-ada-002"), + // }, + // }, + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/GetAccount.json func ExampleAccountsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -196,7 +273,7 @@ func ExampleAccountsClient_Get() { _ = 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 = armcognitiveservices.AccountsClientGetResponse{ - // Account: &armcognitiveservices.Account{ + // Account: armcognitiveservices.Account{ // Name: to.Ptr("myAccount"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), // Etag: to.Ptr("W/\"datetime'2017-04-10T04%3A42%3A19.7067387Z'\""), @@ -218,7 +295,7 @@ func ExampleAccountsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListAccountsBySubscription.json +// Generated from example definition: 2026-03-15-preview/ListAccountsBySubscription.json func ExampleAccountsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -312,7 +389,7 @@ func ExampleAccountsClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/ListAccountsByResourceGroup.json +// Generated from example definition: 2026-03-15-preview/ListAccountsByResourceGroup.json func ExampleAccountsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -379,7 +456,7 @@ func ExampleAccountsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: 2026-01-15-preview/ListKeys.json +// Generated from example definition: 2026-03-15-preview/ListKeys.json func ExampleAccountsClient_ListKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -398,14 +475,14 @@ func ExampleAccountsClient_ListKeys() { _ = 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 = armcognitiveservices.AccountsClientListKeysResponse{ - // APIKeys: &armcognitiveservices.APIKeys{ + // APIKeys: armcognitiveservices.APIKeys{ // Key1: to.Ptr("KEY1"), // Key2: to.Ptr("KEY2"), // }, // } } -// Generated from example definition: 2026-01-15-preview/ListAccountModels.json +// Generated from example definition: 2026-03-15-preview/ListAccountModels.json func ExampleAccountsClient_NewListModelsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -606,7 +683,7 @@ func ExampleAccountsClient_NewListModelsPager() { } } -// Generated from example definition: 2026-01-15-preview/ListSkus.json +// Generated from example definition: 2026-03-15-preview/ListSkus.json func ExampleAccountsClient_ListSKUs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -625,7 +702,7 @@ func ExampleAccountsClient_ListSKUs() { _ = 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 = armcognitiveservices.AccountsClientListSKUsResponse{ - // AccountSKUListResult: &armcognitiveservices.AccountSKUListResult{ + // AccountSKUListResult: armcognitiveservices.AccountSKUListResult{ // Value: []*armcognitiveservices.AccountSKU{ // { // ResourceType: to.Ptr("Microsoft.CognitiveServices/accounts"), @@ -646,7 +723,7 @@ func ExampleAccountsClient_ListSKUs() { // } } -// Generated from example definition: 2026-01-15-preview/GetUsages.json +// Generated from example definition: 2026-03-15-preview/GetUsages.json func ExampleAccountsClient_ListUsages_getUsages() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -665,7 +742,7 @@ func ExampleAccountsClient_ListUsages_getUsages() { _ = 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 = armcognitiveservices.AccountsClientListUsagesResponse{ - // UsageListResult: &armcognitiveservices.UsageListResult{ + // UsageListResult: armcognitiveservices.UsageListResult{ // Value: []*armcognitiveservices.Usage{ // { // Name: &armcognitiveservices.MetricName{ @@ -686,7 +763,7 @@ func ExampleAccountsClient_ListUsages_getUsages() { // } } -// Generated from example definition: 2026-01-15-preview/GetUsagesClassicScope.json +// Generated from example definition: 2026-03-15-preview/GetUsagesClassicScope.json func ExampleAccountsClient_ListUsages_getUsagesClassicScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -705,7 +782,7 @@ func ExampleAccountsClient_ListUsages_getUsagesClassicScope() { _ = 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 = armcognitiveservices.AccountsClientListUsagesResponse{ - // UsageListResult: &armcognitiveservices.UsageListResult{ + // UsageListResult: armcognitiveservices.UsageListResult{ // Value: []*armcognitiveservices.Usage{ // { // Name: &armcognitiveservices.MetricName{ @@ -725,7 +802,7 @@ func ExampleAccountsClient_ListUsages_getUsagesClassicScope() { // } } -// Generated from example definition: 2026-01-15-preview/GetUsagesDataZoneScope.json +// Generated from example definition: 2026-03-15-preview/GetUsagesDataZoneScope.json func ExampleAccountsClient_ListUsages_getUsagesDataZoneScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -744,7 +821,7 @@ func ExampleAccountsClient_ListUsages_getUsagesDataZoneScope() { _ = 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 = armcognitiveservices.AccountsClientListUsagesResponse{ - // UsageListResult: &armcognitiveservices.UsageListResult{ + // UsageListResult: armcognitiveservices.UsageListResult{ // Value: []*armcognitiveservices.Usage{ // { // Name: &armcognitiveservices.MetricName{ @@ -765,7 +842,7 @@ func ExampleAccountsClient_ListUsages_getUsagesDataZoneScope() { // } } -// Generated from example definition: 2026-01-15-preview/GetUsagesGlobalScope.json +// Generated from example definition: 2026-03-15-preview/GetUsagesGlobalScope.json func ExampleAccountsClient_ListUsages_getUsagesGlobalScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -784,7 +861,7 @@ func ExampleAccountsClient_ListUsages_getUsagesGlobalScope() { _ = 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 = armcognitiveservices.AccountsClientListUsagesResponse{ - // UsageListResult: &armcognitiveservices.UsageListResult{ + // UsageListResult: armcognitiveservices.UsageListResult{ // Value: []*armcognitiveservices.Usage{ // { // Name: &armcognitiveservices.MetricName{ @@ -805,7 +882,7 @@ func ExampleAccountsClient_ListUsages_getUsagesGlobalScope() { // } } -// Generated from example definition: 2026-01-15-preview/RegenerateKey.json +// Generated from example definition: 2026-03-15-preview/RegenerateKey.json func ExampleAccountsClient_RegenerateKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -826,14 +903,14 @@ func ExampleAccountsClient_RegenerateKey() { _ = 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 = armcognitiveservices.AccountsClientRegenerateKeyResponse{ - // APIKeys: &armcognitiveservices.APIKeys{ + // APIKeys: armcognitiveservices.APIKeys{ // Key1: to.Ptr("KEY1"), // Key2: to.Ptr("KEY2"), // }, // } } -// Generated from example definition: 2026-01-15-preview/UpdateAccount.json +// Generated from example definition: 2026-03-15-preview/UpdateAccount.json func ExampleAccountsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -855,13 +932,13 @@ func ExampleAccountsClient_BeginUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.AccountsClientUpdateResponse{ - // Account: &armcognitiveservices.Account{ + // Account: armcognitiveservices.Account{ // Name: to.Ptr("bingSearch"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), // Etag: to.Ptr("W/\"datetime'2017-04-10T07%3A46%3A21.5618831Z'\""), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentapplications_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentapplications_client.go index 0b49d258fc3f..fd986a4b4650 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentapplications_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentapplications_client.go @@ -19,6 +19,8 @@ import ( // AgentApplicationsClient contains the methods for the AgentApplications group. // Don't use this type directly, use NewAgentApplicationsClient() instead. +// +// Generated from API version 2026-03-15-preview type AgentApplicationsClient struct { internal *arm.Client subscriptionID string @@ -44,8 +46,6 @@ func NewAgentApplicationsClient(subscriptionID string, credential azcore.TokenCr // // Creates or updates an Agent Application (asynchronous). // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -74,8 +74,6 @@ func (client *AgentApplicationsClient) BeginCreateOrUpdate(ctx context.Context, // // Creates or updates an Agent Application (asynchronous). // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *AgentApplicationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, projectName string, name string, body AgentApplication, options *AgentApplicationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AgentApplicationsClient.BeginCreateOrUpdate" @@ -125,8 +123,8 @@ func (client *AgentApplicationsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -139,8 +137,6 @@ func (client *AgentApplicationsClient) createOrUpdateCreateRequest(ctx context.C // // Delete Agent Application. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -168,8 +164,6 @@ func (client *AgentApplicationsClient) BeginDelete(ctx context.Context, resource // // Delete Agent Application. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *AgentApplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, projectName string, name string, options *AgentApplicationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AgentApplicationsClient.BeginDelete" @@ -219,8 +213,8 @@ func (client *AgentApplicationsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } @@ -228,8 +222,6 @@ func (client *AgentApplicationsClient) deleteCreateRequest(ctx context.Context, // // Disables an Agent Application. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -285,8 +277,8 @@ func (client *AgentApplicationsClient) disableCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } @@ -294,8 +286,6 @@ func (client *AgentApplicationsClient) disableCreateRequest(ctx context.Context, // // Enables an Agent Application. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -351,8 +341,8 @@ func (client *AgentApplicationsClient) enableCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } @@ -360,8 +350,6 @@ func (client *AgentApplicationsClient) enableCreateRequest(ctx context.Context, // // Gets an Agent Application by name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -417,8 +405,8 @@ func (client *AgentApplicationsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -435,8 +423,6 @@ func (client *AgentApplicationsClient) getHandleResponse(resp *http.Response) (A // NewListPager - Lists Agent Applications in the project. // // Lists Agent Applications in the project. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -495,7 +481,7 @@ func (client *AgentApplicationsClient) listCreateRequest(ctx context.Context, re if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } - reqQP.Set("api-version", "2026-01-15-preview") + reqQP.Set("api-version", version20260315Preview) if options != nil && options.Count != nil { reqQP.Set("count", strconv.FormatInt(int64(*options.Count), 10)) } @@ -513,7 +499,7 @@ func (client *AgentApplicationsClient) listCreateRequest(ctx context.Context, re if options != nil && options.SearchText != nil { reqQP.Set("searchText", *options.SearchText) } - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -531,8 +517,6 @@ func (client *AgentApplicationsClient) listHandleResponse(resp *http.Response) ( // // Lists agents for an Agent Application. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -589,8 +573,8 @@ func (client *AgentApplicationsClient) listAgentsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentapplications_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentapplications_client_example_test.go index 4d58d1e0c322..1bee393d0bc9 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentapplications_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentapplications_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/AgentApplication/createOrUpdate.json +// Generated from example definition: 2026-03-15-preview/AgentApplication/createOrUpdate.json func ExampleAgentApplicationsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -38,13 +38,13 @@ func ExampleAgentApplicationsClient_BeginCreateOrUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.AgentApplicationsClientCreateOrUpdateResponse{ - // AgentApplication: &armcognitiveservices.AgentApplication{ + // AgentApplication: armcognitiveservices.AgentApplication{ // Name: to.Ptr("agent-app-1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/applications"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/my-cognitive-services-account/projects/my-project/applications/agent-app-1"), @@ -69,7 +69,7 @@ func ExampleAgentApplicationsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/AgentApplication/delete.json +// Generated from example definition: 2026-03-15-preview/AgentApplication/delete.json func ExampleAgentApplicationsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -86,11 +86,11 @@ func ExampleAgentApplicationsClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/AgentApplication/disable.json +// Generated from example definition: 2026-03-15-preview/AgentApplication/disable.json func ExampleAgentApplicationsClient_Disable() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -112,7 +112,7 @@ func ExampleAgentApplicationsClient_Disable() { // } } -// Generated from example definition: 2026-01-15-preview/AgentApplication/enable.json +// Generated from example definition: 2026-03-15-preview/AgentApplication/enable.json func ExampleAgentApplicationsClient_Enable() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -134,7 +134,7 @@ func ExampleAgentApplicationsClient_Enable() { // } } -// Generated from example definition: 2026-01-15-preview/AgentApplication/get.json +// Generated from example definition: 2026-03-15-preview/AgentApplication/get.json func ExampleAgentApplicationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -153,7 +153,7 @@ func ExampleAgentApplicationsClient_Get() { _ = 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 = armcognitiveservices.AgentApplicationsClientGetResponse{ - // AgentApplication: &armcognitiveservices.AgentApplication{ + // AgentApplication: armcognitiveservices.AgentApplication{ // Name: to.Ptr("agent-app-1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/applications"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/my-cognitive-services-account/projects/my-project/applications/agent-app-1"), @@ -177,7 +177,7 @@ func ExampleAgentApplicationsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/AgentApplication/list.json +// Generated from example definition: 2026-03-15-preview/AgentApplication/list.json func ExampleAgentApplicationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -239,7 +239,7 @@ func ExampleAgentApplicationsClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/AgentApplication/listAgents.json +// Generated from example definition: 2026-03-15-preview/AgentApplication/listAgents.json func ExampleAgentApplicationsClient_ListAgents() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -258,7 +258,7 @@ func ExampleAgentApplicationsClient_ListAgents() { _ = 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 = armcognitiveservices.AgentApplicationsClientListAgentsResponse{ - // AgentReferenceResourceArmPaginatedResult: &armcognitiveservices.AgentReferenceResourceArmPaginatedResult{ + // AgentReferenceResourceArmPaginatedResult: armcognitiveservices.AgentReferenceResourceArmPaginatedResult{ // NextLink: nil, // Value: []*armcognitiveservices.AgentReference{ // { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentdeployments_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentdeployments_client.go index e92e2e330085..8c60e5c725a7 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentdeployments_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentdeployments_client.go @@ -19,6 +19,8 @@ import ( // AgentDeploymentsClient contains the methods for the AgentDeployments group. // Don't use this type directly, use NewAgentDeploymentsClient() instead. +// +// Generated from API version 2026-03-15-preview type AgentDeploymentsClient struct { internal *arm.Client subscriptionID string @@ -44,8 +46,6 @@ func NewAgentDeploymentsClient(subscriptionID string, credential azcore.TokenCre // // Creates or updates an Agent Deployment (asynchronous). // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -75,8 +75,6 @@ func (client *AgentDeploymentsClient) BeginCreateOrUpdate(ctx context.Context, r // // Creates or updates an Agent Deployment (asynchronous). // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *AgentDeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, projectName string, appName string, deploymentName string, body AgentDeployment, options *AgentDeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AgentDeploymentsClient.BeginCreateOrUpdate" @@ -130,8 +128,8 @@ func (client *AgentDeploymentsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -144,8 +142,6 @@ func (client *AgentDeploymentsClient) createOrUpdateCreateRequest(ctx context.Co // // Delete Agent Deployment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -174,8 +170,6 @@ func (client *AgentDeploymentsClient) BeginDelete(ctx context.Context, resourceG // // Delete Agent Deployment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *AgentDeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, projectName string, appName string, deploymentName string, options *AgentDeploymentsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AgentDeploymentsClient.BeginDelete" @@ -229,8 +223,8 @@ func (client *AgentDeploymentsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } @@ -238,8 +232,6 @@ func (client *AgentDeploymentsClient) deleteCreateRequest(ctx context.Context, r // // Gets an Agent Deployment by name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -300,8 +292,8 @@ func (client *AgentDeploymentsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -318,8 +310,6 @@ func (client *AgentDeploymentsClient) getHandleResponse(resp *http.Response) (Ag // NewListPager - Lists Agent Deployments in the application. // // Lists Agent Deployments in the application. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -380,7 +370,7 @@ func (client *AgentDeploymentsClient) listCreateRequest(ctx context.Context, res if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } - reqQP.Set("api-version", "2026-01-15-preview") + reqQP.Set("api-version", version20260315Preview) if options != nil && options.Count != nil { reqQP.Set("count", strconv.FormatInt(int64(*options.Count), 10)) } @@ -395,7 +385,7 @@ func (client *AgentDeploymentsClient) listCreateRequest(ctx context.Context, res if options != nil && options.OrderByAsc != nil { reqQP.Set("orderByAsc", strconv.FormatBool(*options.OrderByAsc)) } - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -413,8 +403,6 @@ func (client *AgentDeploymentsClient) listHandleResponse(resp *http.Response) (A // // Starts an Agent Deployment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -474,8 +462,8 @@ func (client *AgentDeploymentsClient) startCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } @@ -483,8 +471,6 @@ func (client *AgentDeploymentsClient) startCreateRequest(ctx context.Context, re // // Stops an Agent Deployment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -544,7 +530,7 @@ func (client *AgentDeploymentsClient) stopCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentdeployments_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentdeployments_client_example_test.go index 246f6ff024dc..f7c951688781 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentdeployments_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/agentdeployments_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/AgentDeployment/createOrUpdate.json +// Generated from example definition: 2026-03-15-preview/AgentDeployment/createOrUpdate.json func ExampleAgentDeploymentsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -48,13 +48,13 @@ func ExampleAgentDeploymentsClient_BeginCreateOrUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.AgentDeploymentsClientCreateOrUpdateResponse{ - // AgentDeployment: &armcognitiveservices.AgentDeployment{ + // AgentDeployment: armcognitiveservices.AgentDeployment{ // Name: to.Ptr("deployment-1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/applications/agentDeployments"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/my-cognitive-services-account/projects/my-project/applications/agent-app-1/agentDeployments/deployment-1"), @@ -90,7 +90,7 @@ func ExampleAgentDeploymentsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/AgentDeployment/delete.json +// Generated from example definition: 2026-03-15-preview/AgentDeployment/delete.json func ExampleAgentDeploymentsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -107,11 +107,11 @@ func ExampleAgentDeploymentsClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/AgentDeployment/get.json +// Generated from example definition: 2026-03-15-preview/AgentDeployment/get.json func ExampleAgentDeploymentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -130,7 +130,7 @@ func ExampleAgentDeploymentsClient_Get() { _ = 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 = armcognitiveservices.AgentDeploymentsClientGetResponse{ - // AgentDeployment: &armcognitiveservices.AgentDeployment{ + // AgentDeployment: armcognitiveservices.AgentDeployment{ // Name: to.Ptr("deployment-1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/applications/agentDeployments"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/my-cognitive-services-account/projects/my-project/applications/agent-app-1/agentDeployments/deployment-1"), @@ -166,7 +166,7 @@ func ExampleAgentDeploymentsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/AgentDeployment/list.json +// Generated from example definition: 2026-03-15-preview/AgentDeployment/list.json func ExampleAgentDeploymentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -230,7 +230,7 @@ func ExampleAgentDeploymentsClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/AgentDeployment/start.json +// Generated from example definition: 2026-03-15-preview/AgentDeployment/start.json func ExampleAgentDeploymentsClient_Start() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -252,7 +252,7 @@ func ExampleAgentDeploymentsClient_Start() { // } } -// Generated from example definition: 2026-01-15-preview/AgentDeployment/stop.json +// Generated from example definition: 2026-03-15-preview/AgentDeployment/stop.json func ExampleAgentDeploymentsClient_Stop() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go index 4d01ef6d084e..f86424c802e7 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/client_factory.go @@ -96,6 +96,14 @@ func (c *ClientFactory) NewComputeOperationsClient() *ComputeOperationsClient { } } +// NewComputesClient creates a new instance of ComputesClient. +func (c *ClientFactory) NewComputesClient() *ComputesClient { + return &ComputesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewDefenderForAISettingsClient creates a new instance of DefenderForAISettingsClient. func (c *ClientFactory) NewDefenderForAISettingsClient() *DefenderForAISettingsClient { return &DefenderForAISettingsClient{ @@ -136,6 +144,30 @@ func (c *ClientFactory) NewLocationBasedModelCapacitiesClient() *LocationBasedMo } } +// NewManagedComputeCapacitiesClient creates a new instance of ManagedComputeCapacitiesClient. +func (c *ClientFactory) NewManagedComputeCapacitiesClient() *ManagedComputeCapacitiesClient { + return &ManagedComputeCapacitiesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewManagedComputeDeploymentsClient creates a new instance of ManagedComputeDeploymentsClient. +func (c *ClientFactory) NewManagedComputeDeploymentsClient() *ManagedComputeDeploymentsClient { + return &ManagedComputeDeploymentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewManagedComputeUsagesOperationGroupClient creates a new instance of ManagedComputeUsagesOperationGroupClient. +func (c *ClientFactory) NewManagedComputeUsagesOperationGroupClient() *ManagedComputeUsagesOperationGroupClient { + return &ManagedComputeUsagesOperationGroupClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewManagedNetworkProvisionsClient creates a new instance of ManagedNetworkProvisionsClient. func (c *ClientFactory) NewManagedNetworkProvisionsClient() *ManagedNetworkProvisionsClient { return &ManagedNetworkProvisionsClient{ @@ -350,3 +382,11 @@ func (c *ClientFactory) NewUsagesClient() *UsagesClient { internal: c.internal, } } + +// NewWorkbenchesClient creates a new instance of WorkbenchesClient. +func (c *ClientFactory) NewWorkbenchesClient() *WorkbenchesClient { + return &WorkbenchesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go index e9ec240138da..9142dda424b7 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client.go @@ -18,6 +18,8 @@ import ( // CommitmentPlansClient contains the methods for the CommitmentPlans group. // Don't use this type directly, use NewCommitmentPlansClient() instead. +// +// Generated from API version 2026-03-15-preview type CommitmentPlansClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account @@ -95,8 +95,8 @@ func (client *CommitmentPlansClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, commitmentPlan); err != nil { @@ -116,8 +116,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlanAssociationName - The name of the commitment plan association with the Cognitive Services Account @@ -143,8 +141,6 @@ 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 2026-01-15-preview 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" @@ -190,8 +186,8 @@ func (client *CommitmentPlansClient) createOrUpdateAssociationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, association); err != nil { @@ -202,8 +198,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlan - The parameters to provide for the created commitment plan. @@ -228,8 +222,6 @@ 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 2026-01-15-preview 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" @@ -271,8 +263,8 @@ func (client *CommitmentPlansClient) createOrUpdatePlanCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, commitmentPlan); err != nil { @@ -283,8 +275,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account @@ -309,8 +299,6 @@ 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 2026-01-15-preview 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" @@ -356,15 +344,13 @@ func (client *CommitmentPlansClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // BeginDeleteAssociation - Deletes the association of the Cognitive Services commitment plan. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlanAssociationName - The name of the commitment plan association with the Cognitive Services Account @@ -389,8 +375,6 @@ 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 2026-01-15-preview 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" @@ -436,15 +420,13 @@ func (client *CommitmentPlansClient) deleteAssociationCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - options - CommitmentPlansClientBeginDeletePlanOptions contains the optional parameters for the CommitmentPlansClient.BeginDeletePlan @@ -468,8 +450,6 @@ 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 2026-01-15-preview func (client *CommitmentPlansClient) deletePlan(ctx context.Context, resourceGroupName string, commitmentPlanName string, options *CommitmentPlansClientBeginDeletePlanOptions) (*http.Response, error) { var err error const operationName = "CommitmentPlansClient.BeginDeletePlan" @@ -511,15 +491,13 @@ func (client *CommitmentPlansClient) deletePlanCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account @@ -570,8 +548,8 @@ func (client *CommitmentPlansClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -587,8 +565,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlanAssociationName - The name of the commitment plan association with the Cognitive Services Account @@ -640,8 +616,8 @@ func (client *CommitmentPlansClient) getAssociationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -657,8 +633,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - options - CommitmentPlansClientGetPlanOptions contains the optional parameters for the CommitmentPlansClient.GetPlan method. @@ -704,8 +678,8 @@ func (client *CommitmentPlansClient) getPlanCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -720,8 +694,6 @@ func (client *CommitmentPlansClient) getPlanHandleResponse(resp *http.Response) } // NewListPager - Gets the commitmentPlans associated with the Cognitive Services account. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - CommitmentPlansClientListOptions contains the optional parameters for the CommitmentPlansClient.NewListPager @@ -769,8 +741,8 @@ func (client *CommitmentPlansClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -785,8 +757,6 @@ func (client *CommitmentPlansClient) listHandleResponse(resp *http.Response) (Co } // NewListAssociationsPager - Gets the associations of the Cognitive Services commitment plan. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - options - CommitmentPlansClientListAssociationsOptions contains the optional parameters for the CommitmentPlansClient.NewListAssociationsPager @@ -834,8 +804,8 @@ func (client *CommitmentPlansClient) listAssociationsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -850,8 +820,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CommitmentPlansClientListPlansByResourceGroupOptions contains the optional parameters for the CommitmentPlansClient.NewListPlansByResourceGroupPager // method. @@ -894,8 +862,8 @@ func (client *CommitmentPlansClient) listPlansByResourceGroupCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -910,8 +878,6 @@ func (client *CommitmentPlansClient) listPlansByResourceGroupHandleResponse(resp } // NewListPlansBySubscriptionPager - Returns all the resources of a particular type belonging to a subscription. -// -// Generated from API version 2026-01-15-preview // - options - CommitmentPlansClientListPlansBySubscriptionOptions contains the optional parameters for the CommitmentPlansClient.NewListPlansBySubscriptionPager // method. func (client *CommitmentPlansClient) NewListPlansBySubscriptionPager(options *CommitmentPlansClientListPlansBySubscriptionOptions) *runtime.Pager[CommitmentPlansClientListPlansBySubscriptionResponse] { @@ -949,8 +915,8 @@ func (client *CommitmentPlansClient) listPlansBySubscriptionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -966,8 +932,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - commitmentPlanName - The name of the commitmentPlan associated with the Cognitive Services Account // - commitmentPlan - The parameters to provide for the created commitment plan. @@ -992,8 +956,6 @@ 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 2026-01-15-preview 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" @@ -1035,8 +997,8 @@ func (client *CommitmentPlansClient) updatePlanCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []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 index 8e1216d044d3..4c47ee40cb75 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmentplans_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/PutCommitmentPlan.json +// Generated from example definition: 2026-03-15-preview/PutCommitmentPlan.json func ExampleCommitmentPlansClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -40,7 +40,7 @@ func ExampleCommitmentPlansClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.CommitmentPlansClientCreateOrUpdateResponse{ - // CommitmentPlan: &armcognitiveservices.CommitmentPlan{ + // 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"), @@ -56,7 +56,7 @@ func ExampleCommitmentPlansClient_CreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/CreateSharedCommitmentPlanAssociation.json +// Generated from example definition: 2026-03-15-preview/CreateSharedCommitmentPlanAssociation.json func ExampleCommitmentPlansClient_BeginCreateOrUpdateAssociation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,13 +77,13 @@ func ExampleCommitmentPlansClient_BeginCreateOrUpdateAssociation() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.CommitmentPlansClientCreateOrUpdateAssociationResponse{ - // CommitmentPlanAccountAssociation: &armcognitiveservices.CommitmentPlanAccountAssociation{ + // 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"), @@ -94,7 +94,7 @@ func ExampleCommitmentPlansClient_BeginCreateOrUpdateAssociation() { // } } -// Generated from example definition: 2026-01-15-preview/CreateSharedCommitmentPlan.json +// Generated from example definition: 2026-03-15-preview/CreateSharedCommitmentPlan.json func ExampleCommitmentPlansClient_BeginCreateOrUpdatePlan() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -125,13 +125,13 @@ func ExampleCommitmentPlansClient_BeginCreateOrUpdatePlan() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.CommitmentPlansClientCreateOrUpdatePlanResponse{ - // CommitmentPlan: &armcognitiveservices.CommitmentPlan{ + // CommitmentPlan: armcognitiveservices.CommitmentPlan{ // Name: to.Ptr("commitmentPlanName"), // Type: to.Ptr("Microsoft.CognitiveServices/commitmentPlans"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/commitmentPlans/commitmentPlanName"), @@ -153,7 +153,7 @@ func ExampleCommitmentPlansClient_BeginCreateOrUpdatePlan() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteCommitmentPlan.json +// Generated from example definition: 2026-03-15-preview/DeleteCommitmentPlan.json func ExampleCommitmentPlansClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -170,7 +170,7 @@ func ExampleCommitmentPlansClient_BeginDelete() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res @@ -179,7 +179,7 @@ func ExampleCommitmentPlansClient_BeginDelete() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteSharedCommitmentPlanAssociation.json +// Generated from example definition: 2026-03-15-preview/DeleteSharedCommitmentPlanAssociation.json func ExampleCommitmentPlansClient_BeginDeleteAssociation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -196,7 +196,7 @@ func ExampleCommitmentPlansClient_BeginDeleteAssociation() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res @@ -205,7 +205,7 @@ func ExampleCommitmentPlansClient_BeginDeleteAssociation() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteSharedCommitmentPlan.json +// Generated from example definition: 2026-03-15-preview/DeleteSharedCommitmentPlan.json func ExampleCommitmentPlansClient_BeginDeletePlan() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -222,7 +222,7 @@ func ExampleCommitmentPlansClient_BeginDeletePlan() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res @@ -231,7 +231,7 @@ func ExampleCommitmentPlansClient_BeginDeletePlan() { // } } -// Generated from example definition: 2026-01-15-preview/GetCommitmentPlan.json +// Generated from example definition: 2026-03-15-preview/GetCommitmentPlan.json func ExampleCommitmentPlansClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -250,7 +250,7 @@ func ExampleCommitmentPlansClient_Get() { _ = 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 = armcognitiveservices.CommitmentPlansClientGetResponse{ - // CommitmentPlan: &armcognitiveservices.CommitmentPlan{ + // 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"), @@ -266,7 +266,7 @@ func ExampleCommitmentPlansClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/GetSharedCommitmentPlanAssociation.json +// Generated from example definition: 2026-03-15-preview/GetSharedCommitmentPlanAssociation.json func ExampleCommitmentPlansClient_GetAssociation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -285,7 +285,7 @@ func ExampleCommitmentPlansClient_GetAssociation() { _ = 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 = armcognitiveservices.CommitmentPlansClientGetAssociationResponse{ - // CommitmentPlanAccountAssociation: &armcognitiveservices.CommitmentPlanAccountAssociation{ + // 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"), @@ -296,7 +296,7 @@ func ExampleCommitmentPlansClient_GetAssociation() { // } } -// Generated from example definition: 2026-01-15-preview/GetSharedCommitmentPlan.json +// Generated from example definition: 2026-03-15-preview/GetSharedCommitmentPlan.json func ExampleCommitmentPlansClient_GetPlan() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -315,7 +315,7 @@ func ExampleCommitmentPlansClient_GetPlan() { _ = 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 = armcognitiveservices.CommitmentPlansClientGetPlanResponse{ - // CommitmentPlan: &armcognitiveservices.CommitmentPlan{ + // CommitmentPlan: armcognitiveservices.CommitmentPlan{ // Name: to.Ptr("commitmentPlanName"), // Type: to.Ptr("Microsoft.CognitiveServices/commitmentPlans"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/commitmentPlans/commitmentPlanName"), @@ -337,7 +337,7 @@ func ExampleCommitmentPlansClient_GetPlan() { // } } -// Generated from example definition: 2026-01-15-preview/ListCommitmentPlans.json +// Generated from example definition: 2026-03-15-preview/ListCommitmentPlans.json func ExampleCommitmentPlansClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -381,7 +381,7 @@ func ExampleCommitmentPlansClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/ListSharedCommitmentPlanAssociations.json +// Generated from example definition: 2026-03-15-preview/ListSharedCommitmentPlanAssociations.json func ExampleCommitmentPlansClient_NewListAssociationsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -420,7 +420,7 @@ func ExampleCommitmentPlansClient_NewListAssociationsPager() { } } -// Generated from example definition: 2026-01-15-preview/ListSharedCommitmentPlansByResourceGroup.json +// Generated from example definition: 2026-03-15-preview/ListSharedCommitmentPlansByResourceGroup.json func ExampleCommitmentPlansClient_NewListPlansByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -470,7 +470,7 @@ func ExampleCommitmentPlansClient_NewListPlansByResourceGroupPager() { } } -// Generated from example definition: 2026-01-15-preview/ListSharedCommitmentPlansBySubscription.json +// Generated from example definition: 2026-03-15-preview/ListSharedCommitmentPlansBySubscription.json func ExampleCommitmentPlansClient_NewListPlansBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -520,7 +520,7 @@ func ExampleCommitmentPlansClient_NewListPlansBySubscriptionPager() { } } -// Generated from example definition: 2026-01-15-preview/UpdateSharedCommitmentPlan.json +// Generated from example definition: 2026-03-15-preview/UpdateSharedCommitmentPlan.json func ExampleCommitmentPlansClient_BeginUpdatePlan() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -541,13 +541,13 @@ func ExampleCommitmentPlansClient_BeginUpdatePlan() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.CommitmentPlansClientUpdatePlanResponse{ - // CommitmentPlan: &armcognitiveservices.CommitmentPlan{ + // CommitmentPlan: armcognitiveservices.CommitmentPlan{ // Name: to.Ptr("commitmentPlanName"), // Type: to.Ptr("Microsoft.CognitiveServices/commitmentPlans"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/commitmentPlans/commitmentPlanName"), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go index 01df074f006d..d3b2f80feee8 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client.go @@ -18,6 +18,8 @@ import ( // CommitmentTiersClient contains the methods for the CommitmentTiers group. // Don't use this type directly, use NewCommitmentTiersClient() instead. +// +// Generated from API version 2026-03-15-preview type CommitmentTiersClient struct { internal *arm.Client subscriptionID string @@ -40,8 +42,6 @@ func NewCommitmentTiersClient(subscriptionID string, credential azcore.TokenCred } // NewListPager - List Commitment Tiers. -// -// Generated from API version 2026-01-15-preview // - location - The location name. // - options - CommitmentTiersClientListOptions contains the optional parameters for the CommitmentTiersClient.NewListPager // method. @@ -84,8 +84,8 @@ func (client *CommitmentTiersClient) listCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client_example_test.go index a32e1b49bb3f..5a83aa6222c4 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/commitmenttiers_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ListCommitmentTiers.json +// Generated from example definition: 2026-03-15-preview/ListCommitmentTiers.json func ExampleCommitmentTiersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computeoperations_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computeoperations_client.go index 393fa6de1686..51858a021ec2 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computeoperations_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computeoperations_client.go @@ -18,6 +18,8 @@ import ( // ComputeOperationsClient contains the methods for the ComputeOperations group. // Don't use this type directly, use NewComputeOperationsClient() instead. +// +// Generated from API version 2026-03-15-preview type ComputeOperationsClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ func NewComputeOperationsClient(subscriptionID string, credential azcore.TokenCr // Get - Gets the status of a compute operation. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - location - The name of the Azure region. // - operationID - The ID of the compute operation. // - options - ComputeOperationsClientGetOptions contains the optional parameters for the ComputeOperationsClient.Get method. @@ -88,8 +88,8 @@ func (client *ComputeOperationsClient) getCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computeoperations_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computeoperations_client_example_test.go index d640891ee04e..3761a3dbec95 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computeoperations_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computeoperations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/GetComputeOperationStatus.json +// Generated from example definition: 2026-03-15-preview/GetComputeOperationStatus.json func ExampleComputeOperationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -30,7 +30,7 @@ func ExampleComputeOperationsClient_Get() { _ = 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 = armcognitiveservices.ComputeOperationsClientGetResponse{ - // ComputeOperationStatus: &armcognitiveservices.ComputeOperationStatus{ + // ComputeOperationStatus: armcognitiveservices.ComputeOperationStatus{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/eastus/computeOperations/00000000-0000-0000-0000-000000000000"), // Name: to.Ptr("00000000-0000-0000-0000-000000000000"), // Type: to.Ptr("Microsoft.CognitiveServices/locations/computeOperations"), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computes_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computes_client.go new file mode 100644 index 000000000000..9ade956349f8 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computes_client.go @@ -0,0 +1,646 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcognitiveservices + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ComputesClient contains the methods for the Computes group. +// Don't use this type directly, use NewComputesClient() instead. +// +// Generated from API version 2026-03-15-preview +type ComputesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewComputesClient creates a new instance of ComputesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewComputesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ComputesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ComputesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a compute associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - computeName - The name of the compute associated with the Cognitive Services Account. +// - resource - The compute properties. +// - options - ComputesClientBeginCreateOrUpdateOptions contains the optional parameters for the ComputesClient.BeginCreateOrUpdate +// method. +func (client *ComputesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, computeName string, resource Compute, options *ComputesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ComputesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, computeName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ComputesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ComputesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a compute associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ComputesClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, computeName string, resource Compute, options *ComputesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ComputesClient.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, computeName, resource, 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 *ComputesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, computeName string, resource Compute, _ *ComputesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}" + 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 computeName == "" { + return nil, errors.New("parameter computeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified compute associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - computeName - The name of the compute associated with the Cognitive Services Account. +// - options - ComputesClientBeginDeleteOptions contains the optional parameters for the ComputesClient.BeginDelete method. +func (client *ComputesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginDeleteOptions) (*runtime.Poller[ComputesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, computeName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ComputesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ComputesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the specified compute associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ComputesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ComputesClient.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, computeName, 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 *ComputesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, computeName string, _ *ComputesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}" + 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 computeName == "" { + return nil, errors.New("parameter computeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + +// Get - Gets the specified compute associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - computeName - The name of the compute associated with the Cognitive Services Account. +// - options - ComputesClientGetOptions contains the optional parameters for the ComputesClient.Get method. +func (client *ComputesClient) Get(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientGetOptions) (ComputesClientGetResponse, error) { + var err error + const operationName = "ComputesClient.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, computeName, options) + if err != nil { + return ComputesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ComputesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ComputesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ComputesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, computeName string, _ *ComputesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}" + 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 computeName == "" { + return nil, errors.New("parameter computeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ComputesClient) getHandleResponse(resp *http.Response) (ComputesClientGetResponse, error) { + result := ComputesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Compute); err != nil { + return ComputesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the computes associated with the Cognitive Services account. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - options - ComputesClientListOptions contains the optional parameters for the ComputesClient.NewListPager method. +func (client *ComputesClient) NewListPager(resourceGroupName string, accountName string, options *ComputesClientListOptions) *runtime.Pager[ComputesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ComputesClientListResponse]{ + More: func(page ComputesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ComputesClientListResponse) (ComputesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ComputesClient.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 ComputesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ComputesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *ComputesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes" + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ComputesClient) listHandleResponse(resp *http.Response) (ComputesClientListResponse, error) { + result := ComputesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ComputeListResult); err != nil { + return ComputesClientListResponse{}, err + } + return result, nil +} + +// BeginRestart - Restarts a running ContainerInstance compute resource. +// This is a long-running operation that returns 202 Accepted. +// Only applicable when computeType is ContainerInstance. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - computeName - The name of the compute associated with the Cognitive Services Account. +// - options - ComputesClientBeginRestartOptions contains the optional parameters for the ComputesClient.BeginRestart method. +func (client *ComputesClient) BeginRestart(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginRestartOptions) (*runtime.Poller[ComputesClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, accountName, computeName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ComputesClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ComputesClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Restart - Restarts a running ContainerInstance compute resource. +// This is a long-running operation that returns 202 Accepted. +// Only applicable when computeType is ContainerInstance. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ComputesClient) restart(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginRestartOptions) (*http.Response, error) { + var err error + const operationName = "ComputesClient.BeginRestart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restartCreateRequest(ctx, resourceGroupName, accountName, computeName, 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 +} + +// restartCreateRequest creates the Restart request. +func (client *ComputesClient) restartCreateRequest(ctx context.Context, resourceGroupName string, accountName string, computeName string, _ *ComputesClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}/restart" + 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 computeName == "" { + return nil, errors.New("parameter computeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + +// BeginStart - Starts a stopped ContainerInstance compute resource. +// This is a long-running operation that returns 202 Accepted. +// Only applicable when computeType is ContainerInstance. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - computeName - The name of the compute associated with the Cognitive Services Account. +// - options - ComputesClientBeginStartOptions contains the optional parameters for the ComputesClient.BeginStart method. +func (client *ComputesClient) BeginStart(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginStartOptions) (*runtime.Poller[ComputesClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, accountName, computeName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ComputesClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ComputesClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Start - Starts a stopped ContainerInstance compute resource. +// This is a long-running operation that returns 202 Accepted. +// Only applicable when computeType is ContainerInstance. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ComputesClient) start(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginStartOptions) (*http.Response, error) { + var err error + const operationName = "ComputesClient.BeginStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startCreateRequest(ctx, resourceGroupName, accountName, computeName, 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 +} + +// startCreateRequest creates the Start request. +func (client *ComputesClient) startCreateRequest(ctx context.Context, resourceGroupName string, accountName string, computeName string, _ *ComputesClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}/start" + 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 computeName == "" { + return nil, errors.New("parameter computeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + +// BeginStop - Stops a running ContainerInstance compute resource. +// This is a long-running operation that returns 202 Accepted. +// Only applicable when computeType is ContainerInstance. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - computeName - The name of the compute associated with the Cognitive Services Account. +// - options - ComputesClientBeginStopOptions contains the optional parameters for the ComputesClient.BeginStop method. +func (client *ComputesClient) BeginStop(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginStopOptions) (*runtime.Poller[ComputesClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, accountName, computeName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ComputesClientStopResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ComputesClientStopResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Stop - Stops a running ContainerInstance compute resource. +// This is a long-running operation that returns 202 Accepted. +// Only applicable when computeType is ContainerInstance. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ComputesClient) stop(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *ComputesClientBeginStopOptions) (*http.Response, error) { + var err error + const operationName = "ComputesClient.BeginStop" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.stopCreateRequest(ctx, resourceGroupName, accountName, computeName, 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 +} + +// stopCreateRequest creates the Stop request. +func (client *ComputesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, accountName string, computeName string, _ *ComputesClientBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}/stop" + 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 computeName == "" { + return nil, errors.New("parameter computeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + +// BeginUpdate - Updates a compute associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - computeName - The name of the compute associated with the Cognitive Services Account. +// - properties - The compute properties to update. +// - options - ComputesClientBeginUpdateOptions contains the optional parameters for the ComputesClient.BeginUpdate method. +func (client *ComputesClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, computeName string, properties Compute, options *ComputesClientBeginUpdateOptions) (*runtime.Poller[ComputesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, computeName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ComputesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ComputesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a compute associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ComputesClient) update(ctx context.Context, resourceGroupName string, accountName string, computeName string, properties Compute, options *ComputesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ComputesClient.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, computeName, properties, 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 *ComputesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, computeName string, properties Compute, _ *ComputesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}" + 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 computeName == "" { + return nil, errors.New("parameter computeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computes_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computes_client_example_test.go new file mode 100644 index 000000000000..ce2baeba8c47 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/computes_client_example_test.go @@ -0,0 +1,525 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcognitiveservices_test + +import ( + "context" + "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/v4" + "log" +) + +// Generated from example definition: 2026-03-15-preview/PutCompute.json +func ExampleComputesClient_BeginCreateOrUpdate_putCompute() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewComputesClient().BeginCreateOrUpdate(ctx, "rgcognitiveservices", "myAccount", "myCompute", armcognitiveservices.Compute{ + Properties: &armcognitiveservices.ClusterComputeProperties{ + ComputeType: to.Ptr(armcognitiveservices.ComputeTypeCluster), + Pools: []*armcognitiveservices.Pool{ + { + Name: to.Ptr("default"), + VMPriority: to.Ptr(armcognitiveservices.VMPriorityRegular), + InstanceType: to.Ptr("Standard_DS3_v2"), + NodeCount: to.Ptr[int32](2), + }, + }, + SubnetArmID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/default"), + }, + Location: to.Ptr("eastus"), + Identity: &armcognitiveservices.Identity{ + Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeNone), + }, + }, 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 poll 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 = armcognitiveservices.ComputesClientCreateOrUpdateResponse{ + // Compute: armcognitiveservices.Compute{ + // Properties: &armcognitiveservices.ClusterComputeProperties{ + // ComputeType: to.Ptr(armcognitiveservices.ComputeTypeCluster), + // Pools: []*armcognitiveservices.Pool{ + // { + // Name: to.Ptr("default"), + // VMPriority: to.Ptr(armcognitiveservices.VMPriorityRegular), + // InstanceType: to.Ptr("Standard_DS3_v2"), + // NodeCount: to.Ptr[int32](2), + // }, + // }, + // SubnetArmID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/default"), + // ProvisioningState: to.Ptr(armcognitiveservices.ComputeProvisioningStateAccepted), + // Errors: []*armcognitiveservices.ErrorDetail{ + // }, + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // }, + // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), + // Location: to.Ptr("eastus"), + // Identity: &armcognitiveservices.Identity{ + // Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeNone), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // UserAssignedIdentities: map[string]*armcognitiveservices.UserAssignedIdentity{ + // }, + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCompute"), + // Name: to.Ptr("myCompute"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/computes"), + // SystemData: &armcognitiveservices.SystemData{ + // CreatedBy: to.Ptr("xxx@microsoft.com"), + // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // LastModifiedBy: to.Ptr("xxx@microsoft.com"), + // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/PutContainerInstanceCompute.json +func ExampleComputesClient_BeginCreateOrUpdate_putContainerInstanceCompute() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewComputesClient().BeginCreateOrUpdate(ctx, "rgcognitiveservices", "myAccount", "myContainerInstance", armcognitiveservices.Compute{ + Properties: &armcognitiveservices.ContainerInstanceComputeProperties{ + ComputeType: to.Ptr(armcognitiveservices.ComputeTypeContainerInstance), + TargetClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster"), + ImageLink: to.Ptr("mcr.microsoft.com/azureml/curated/pytorch-gpu:latest"), + IdleTimeBeforeShutdown: to.Ptr("PT30M"), + SSHSettings: &armcognitiveservices.SSHSettings{ + SSHPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."), + AdminEnabled: to.Ptr(true), + }, + }, + Location: to.Ptr("eastus"), + Identity: &armcognitiveservices.Identity{ + Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armcognitiveservices.UserAssignedIdentity{ + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {}, + }, + }, + }, 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 poll 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 = armcognitiveservices.ComputesClientCreateOrUpdateResponse{ + // Compute: armcognitiveservices.Compute{ + // Properties: &armcognitiveservices.ContainerInstanceComputeProperties{ + // ComputeType: to.Ptr(armcognitiveservices.ComputeTypeContainerInstance), + // TargetClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster"), + // ImageLink: to.Ptr("mcr.microsoft.com/azureml/curated/pytorch-gpu:latest"), + // IdleTimeBeforeShutdown: to.Ptr("PT30M"), + // SSHSettings: &armcognitiveservices.SSHSettings{ + // SSHPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."), + // AdminEnabled: to.Ptr(true), + // }, + // ConnectivityEndpoints: &armcognitiveservices.ConnectivityEndpoints{ + // PublicIPAddress: to.Ptr("20.42.51.100"), + // SSHPort: to.Ptr[int32](50000), + // }, + // ProvisioningState: to.Ptr(armcognitiveservices.ComputeProvisioningStateAccepted), + // Errors: []*armcognitiveservices.ErrorDetail{ + // }, + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // }, + // Location: to.Ptr("eastus"), + // Identity: &armcognitiveservices.Identity{ + // Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeUserAssigned), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // UserAssignedIdentities: map[string]*armcognitiveservices.UserAssignedIdentity{ + // "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": &armcognitiveservices.UserAssignedIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000002"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myContainerInstance"), + // Name: to.Ptr("myContainerInstance"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/computes"), + // SystemData: &armcognitiveservices.SystemData{ + // CreatedBy: to.Ptr("xxx@microsoft.com"), + // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("xxx@microsoft.com"), + // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/DeleteCompute.json +func ExampleComputesClient_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("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewComputesClient().BeginDelete(ctx, "rgcognitiveservices", "myAccount", "myCompute", 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 poll the result: %v", err) + } +} + +// Generated from example definition: 2026-03-15-preview/GetCompute.json +func ExampleComputesClient_Get_getCompute() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewComputesClient().Get(ctx, "rgcognitiveservices", "myAccount", "myCompute", 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 = armcognitiveservices.ComputesClientGetResponse{ + // Compute: armcognitiveservices.Compute{ + // Properties: &armcognitiveservices.ClusterComputeProperties{ + // ComputeType: to.Ptr(armcognitiveservices.ComputeTypeCluster), + // Pools: []*armcognitiveservices.Pool{ + // { + // Name: to.Ptr("default"), + // VMPriority: to.Ptr(armcognitiveservices.VMPriorityRegular), + // InstanceType: to.Ptr("Standard_DS3_v2"), + // NodeCount: to.Ptr[int32](2), + // }, + // }, + // SubnetArmID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/default"), + // ProvisioningState: to.Ptr(armcognitiveservices.ComputeProvisioningStateSucceeded), + // Errors: []*armcognitiveservices.ErrorDetail{ + // }, + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // }, + // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), + // Location: to.Ptr("eastus"), + // Identity: &armcognitiveservices.Identity{ + // Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeNone), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // UserAssignedIdentities: map[string]*armcognitiveservices.UserAssignedIdentity{ + // }, + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCompute"), + // Name: to.Ptr("myCompute"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/computes"), + // SystemData: &armcognitiveservices.SystemData{ + // CreatedBy: to.Ptr("xxx@microsoft.com"), + // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // LastModifiedBy: to.Ptr("xxx@microsoft.com"), + // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/GetContainerInstanceCompute.json +func ExampleComputesClient_Get_getContainerInstanceCompute() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewComputesClient().Get(ctx, "rgcognitiveservices", "myAccount", "myContainerInstance", 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 = armcognitiveservices.ComputesClientGetResponse{ + // Compute: armcognitiveservices.Compute{ + // Properties: &armcognitiveservices.ContainerInstanceComputeProperties{ + // ComputeType: to.Ptr(armcognitiveservices.ComputeTypeContainerInstance), + // TargetClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster"), + // ImageLink: to.Ptr("mcr.microsoft.com/azureml/curated/pytorch-gpu:latest"), + // IdleTimeBeforeShutdown: to.Ptr("PT30M"), + // SSHSettings: &armcognitiveservices.SSHSettings{ + // SSHPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."), + // AdminEnabled: to.Ptr(true), + // }, + // ConnectivityEndpoints: &armcognitiveservices.ConnectivityEndpoints{ + // PublicIPAddress: to.Ptr("20.42.51.100"), + // SSHPort: to.Ptr[int32](50000), + // }, + // ProvisioningState: to.Ptr(armcognitiveservices.ComputeProvisioningStateSucceeded), + // Errors: []*armcognitiveservices.ErrorDetail{ + // }, + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // }, + // Location: to.Ptr("eastus"), + // Identity: &armcognitiveservices.Identity{ + // Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeUserAssigned), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // UserAssignedIdentities: map[string]*armcognitiveservices.UserAssignedIdentity{ + // "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": &armcognitiveservices.UserAssignedIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000002"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myContainerInstance"), + // Name: to.Ptr("myContainerInstance"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/computes"), + // SystemData: &armcognitiveservices.SystemData{ + // CreatedBy: to.Ptr("xxx@microsoft.com"), + // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("xxx@microsoft.com"), + // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/ListComputes.json +func ExampleComputesClient_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("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewComputesClient().NewListPager("rgcognitiveservices", "myAccount", 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 = armcognitiveservices.ComputesClientListResponse{ + // ComputeListResult: armcognitiveservices.ComputeListResult{ + // Value: []*armcognitiveservices.Compute{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCompute"), + // Name: to.Ptr("myCompute"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/computes"), + // Properties: &armcognitiveservices.ClusterComputeProperties{ + // ComputeType: to.Ptr(armcognitiveservices.ComputeTypeCluster), + // Pools: []*armcognitiveservices.Pool{ + // { + // Name: to.Ptr("default"), + // VMPriority: to.Ptr(armcognitiveservices.VMPriorityRegular), + // InstanceType: to.Ptr("Standard_DS3_v2"), + // NodeCount: to.Ptr[int32](2), + // }, + // }, + // SubnetArmID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/default"), + // ProvisioningState: to.Ptr(armcognitiveservices.ComputeProvisioningStateSucceeded), + // Errors: []*armcognitiveservices.ErrorDetail{ + // }, + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // }, + // SystemData: &armcognitiveservices.SystemData{ + // CreatedBy: to.Ptr("xxx@microsoft.com"), + // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // LastModifiedBy: to.Ptr("xxx@microsoft.com"), + // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2026-03-15-preview/RestartContainerInstanceCompute.json +func ExampleComputesClient_BeginRestart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewComputesClient().BeginRestart(ctx, "rgcognitiveservices", "myAccount", "myContainerInstance", 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 poll the result: %v", err) + } +} + +// Generated from example definition: 2026-03-15-preview/StartContainerInstanceCompute.json +func ExampleComputesClient_BeginStart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewComputesClient().BeginStart(ctx, "rgcognitiveservices", "myAccount", "myContainerInstance", 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 poll the result: %v", err) + } +} + +// Generated from example definition: 2026-03-15-preview/StopContainerInstanceCompute.json +func ExampleComputesClient_BeginStop() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewComputesClient().BeginStop(ctx, "rgcognitiveservices", "myAccount", "myContainerInstance", 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 poll the result: %v", err) + } +} + +// Generated from example definition: 2026-03-15-preview/UpdateCompute.json +func ExampleComputesClient_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("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewComputesClient().BeginUpdate(ctx, "rgcognitiveservices", "myAccount", "myCompute", armcognitiveservices.Compute{ + Properties: &armcognitiveservices.ClusterComputeProperties{ + ComputeType: to.Ptr(armcognitiveservices.ComputeTypeCluster), + Pools: []*armcognitiveservices.Pool{ + { + Name: to.Ptr("default"), + VMPriority: to.Ptr(armcognitiveservices.VMPriorityRegular), + InstanceType: to.Ptr("Standard_DS3_v2"), + NodeCount: to.Ptr[int32](4), + }, + }, + }, + }, 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 poll 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 = armcognitiveservices.ComputesClientUpdateResponse{ + // Compute: armcognitiveservices.Compute{ + // Properties: &armcognitiveservices.ClusterComputeProperties{ + // ComputeType: to.Ptr(armcognitiveservices.ComputeTypeCluster), + // Pools: []*armcognitiveservices.Pool{ + // { + // Name: to.Ptr("default"), + // VMPriority: to.Ptr(armcognitiveservices.VMPriorityRegular), + // InstanceType: to.Ptr("Standard_DS3_v2"), + // NodeCount: to.Ptr[int32](4), + // }, + // }, + // SubnetArmID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/default"), + // ProvisioningState: to.Ptr(armcognitiveservices.ComputeProvisioningStateAccepted), + // Errors: []*armcognitiveservices.ErrorDetail{ + // }, + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // }, + // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), + // Location: to.Ptr("eastus"), + // Identity: &armcognitiveservices.Identity{ + // Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeNone), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // UserAssignedIdentities: map[string]*armcognitiveservices.UserAssignedIdentity{ + // }, + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCompute"), + // Name: to.Ptr("myCompute"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/computes"), + // SystemData: &armcognitiveservices.SystemData{ + // CreatedBy: to.Ptr("xxx@microsoft.com"), + // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // LastModifiedBy: to.Ptr("xxx@microsoft.com"), + // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T11:39:39.795Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go index 63037766e3f1..91f92d160f4d 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/constants.go @@ -4,6 +4,10 @@ package armcognitiveservices +const ( + version20260315Preview string = "2026-03-15-preview" +) + // AbusePenaltyAction - The action of AbusePenalty. type AbusePenaltyAction string @@ -301,6 +305,69 @@ func PossibleComputeOperationStatusTypeValues() []ComputeOperationStatusType { } } +// ComputeProvisioningState - The provisioning state of a compute resource. +type ComputeProvisioningState string + +const ( + // ComputeProvisioningStateAccepted - The resource provisioning request has been accepted. + ComputeProvisioningStateAccepted ComputeProvisioningState = "Accepted" + // ComputeProvisioningStateCanceled - The resource provisioning was canceled. + ComputeProvisioningStateCanceled ComputeProvisioningState = "Canceled" + // ComputeProvisioningStateDeleting - The resource is being deleted. + ComputeProvisioningStateDeleting ComputeProvisioningState = "Deleting" + // ComputeProvisioningStateDisabled - The resource is disabled. + ComputeProvisioningStateDisabled ComputeProvisioningState = "Disabled" + // ComputeProvisioningStateFailed - The resource provisioning has failed. + ComputeProvisioningStateFailed ComputeProvisioningState = "Failed" + // ComputeProvisioningStateRestarting - The compute resource is restarting. + ComputeProvisioningStateRestarting ComputeProvisioningState = "Restarting" + // ComputeProvisioningStateScaling - The resource is scaling. + ComputeProvisioningStateScaling ComputeProvisioningState = "Scaling" + // ComputeProvisioningStateStarting - The compute resource is starting. + ComputeProvisioningStateStarting ComputeProvisioningState = "Starting" + // ComputeProvisioningStateStopped - The compute resource is stopped. + ComputeProvisioningStateStopped ComputeProvisioningState = "Stopped" + // ComputeProvisioningStateStopping - The compute resource is stopping. + ComputeProvisioningStateStopping ComputeProvisioningState = "Stopping" + // ComputeProvisioningStateSucceeded - The resource has been fully provisioned. + ComputeProvisioningStateSucceeded ComputeProvisioningState = "Succeeded" +) + +// PossibleComputeProvisioningStateValues returns the possible values for the ComputeProvisioningState const type. +func PossibleComputeProvisioningStateValues() []ComputeProvisioningState { + return []ComputeProvisioningState{ + ComputeProvisioningStateAccepted, + ComputeProvisioningStateCanceled, + ComputeProvisioningStateDeleting, + ComputeProvisioningStateDisabled, + ComputeProvisioningStateFailed, + ComputeProvisioningStateRestarting, + ComputeProvisioningStateScaling, + ComputeProvisioningStateStarting, + ComputeProvisioningStateStopped, + ComputeProvisioningStateStopping, + ComputeProvisioningStateSucceeded, + } +} + +// ComputeType - The type of compute resource. +type ComputeType string + +const ( + // ComputeTypeCluster - Cluster (AKS-backed) compute type. + ComputeTypeCluster ComputeType = "Cluster" + // ComputeTypeContainerInstance - Container Instance compute type. + ComputeTypeContainerInstance ComputeType = "ContainerInstance" +) + +// PossibleComputeTypeValues returns the possible values for the ComputeType const type. +func PossibleComputeTypeValues() []ComputeType { + return []ComputeType{ + ComputeTypeCluster, + ComputeTypeContainerInstance, + } +} + // ConnectionAuthType - Authentication type of the connection target type ConnectionAuthType string @@ -1189,6 +1256,27 @@ func PossibleOriginValues() []Origin { } } +// PolicyEvaluationOutcome - The outcome of a policy evaluation. +type PolicyEvaluationOutcome string + +const ( + // PolicyEvaluationOutcomeCompliant - The deployment is compliant with all policies. + PolicyEvaluationOutcomeCompliant PolicyEvaluationOutcome = "Compliant" + // PolicyEvaluationOutcomeError - An error occurred during evaluation. + PolicyEvaluationOutcomeError PolicyEvaluationOutcome = "Error" + // PolicyEvaluationOutcomeNonCompliant - The deployment violates one or more policies. + PolicyEvaluationOutcomeNonCompliant PolicyEvaluationOutcome = "NonCompliant" +) + +// PossiblePolicyEvaluationOutcomeValues returns the possible values for the PolicyEvaluationOutcome const type. +func PossiblePolicyEvaluationOutcomeValues() []PolicyEvaluationOutcome { + return []PolicyEvaluationOutcome{ + PolicyEvaluationOutcomeCompliant, + PolicyEvaluationOutcomeError, + PolicyEvaluationOutcomeNonCompliant, + } +} + // PrivateEndpointConnectionProvisioningState - The current provisioning state. type PrivateEndpointConnectionProvisioningState string @@ -1471,24 +1559,24 @@ func PossibleRoutingMethodsValues() []RoutingMethods { } } -// RoutingMode - The routing mode that determines how requests are distributed across models. +// RoutingMode - The model-router routing mode that determines how requests are distributed across models. type RoutingMode string const ( - // RoutingModeAccuracy - Route requests to maximize accuracy regardless of cost. - RoutingModeAccuracy RoutingMode = "accuracy" - // RoutingModeBalanced - Balance cost and accuracy when routing requests across models. + // RoutingModeBalanced - Balance cost and quality when routing requests across models. RoutingModeBalanced RoutingMode = "balanced" // RoutingModeCost - Route requests to minimize cost while meeting performance requirements. RoutingModeCost RoutingMode = "cost" + // RoutingModeQuality - Route requests to maximize quality regardless of cost. + RoutingModeQuality RoutingMode = "quality" ) // PossibleRoutingModeValues returns the possible values for the RoutingMode const type. func PossibleRoutingModeValues() []RoutingMode { return []RoutingMode{ - RoutingModeAccuracy, RoutingModeBalanced, RoutingModeCost, + RoutingModeQuality, } } @@ -1702,3 +1790,21 @@ func PossibleUpgradeAvailabilityStatusValues() []UpgradeAvailabilityStatus { UpgradeAvailabilityStatusNotAvailable, } } + +// VMPriority - VM priority for a compute pool. +type VMPriority string + +const ( + // VMPriorityLowPriority - Low-priority VM. + VMPriorityLowPriority VMPriority = "LowPriority" + // VMPriorityRegular - Regular VM priority. + VMPriorityRegular VMPriority = "Regular" +) + +// PossibleVMPriorityValues returns the possible values for the VMPriority const type. +func PossibleVMPriorityValues() []VMPriority { + return []VMPriority{ + VMPriorityLowPriority, + VMPriorityRegular, + } +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client.go index 64552b3862c6..ed396c92a844 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client.go @@ -18,6 +18,8 @@ import ( // DefenderForAISettingsClient contains the methods for the DefenderForAISettings group. // Don't use this type directly, use NewDefenderForAISettingsClient() instead. +// +// Generated from API version 2026-03-15-preview type DefenderForAISettingsClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - 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. @@ -95,8 +95,8 @@ func (client *DefenderForAISettingsClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, defenderForAISettings); err != nil { @@ -116,8 +116,6 @@ 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 2026-01-15-preview // - 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. @@ -169,8 +167,8 @@ func (client *DefenderForAISettingsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -185,8 +183,6 @@ func (client *DefenderForAISettingsClient) getHandleResponse(resp *http.Response } // NewListPager - Lists the Defender for AI settings. -// -// Generated from API version 2026-01-15-preview // - 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 @@ -234,8 +230,8 @@ func (client *DefenderForAISettingsClient) listCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -251,8 +247,6 @@ 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 2026-01-15-preview // - 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. @@ -305,8 +299,8 @@ func (client *DefenderForAISettingsClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []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 index 55cb2c2ba8f3..fba668e0536e 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/defenderforaisettings_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/PutDefenderForAISetting.json +// Generated from example definition: 2026-03-15-preview/PutDefenderForAISetting.json func ExampleDefenderForAISettingsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -35,7 +35,7 @@ func ExampleDefenderForAISettingsClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.DefenderForAISettingsClientCreateOrUpdateResponse{ - // DefenderForAISetting: &armcognitiveservices.DefenderForAISetting{ + // DefenderForAISetting: armcognitiveservices.DefenderForAISetting{ // Name: to.Ptr("Default"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/defenderForAISettings"), // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), @@ -55,7 +55,7 @@ func ExampleDefenderForAISettingsClient_CreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/GetDefenderForAISetting.json +// Generated from example definition: 2026-03-15-preview/GetDefenderForAISetting.json func ExampleDefenderForAISettingsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -74,7 +74,7 @@ func ExampleDefenderForAISettingsClient_Get() { _ = 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 = armcognitiveservices.DefenderForAISettingsClientGetResponse{ - // DefenderForAISetting: &armcognitiveservices.DefenderForAISetting{ + // DefenderForAISetting: armcognitiveservices.DefenderForAISetting{ // Name: to.Ptr("Default"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/defenderForAISettings"), // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), @@ -94,7 +94,7 @@ func ExampleDefenderForAISettingsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListDefenderForAISetting.json +// Generated from example definition: 2026-03-15-preview/ListDefenderForAISetting.json func ExampleDefenderForAISettingsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -142,7 +142,7 @@ func ExampleDefenderForAISettingsClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/UpdateDefenderForAISetting.json +// Generated from example definition: 2026-03-15-preview/UpdateDefenderForAISetting.json func ExampleDefenderForAISettingsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -165,7 +165,7 @@ func ExampleDefenderForAISettingsClient_Update() { _ = 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 = armcognitiveservices.DefenderForAISettingsClientUpdateResponse{ - // DefenderForAISetting: &armcognitiveservices.DefenderForAISetting{ + // DefenderForAISetting: armcognitiveservices.DefenderForAISetting{ // Name: to.Ptr("Default"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/defenderForAISettings"), // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go index 6abe066f37f9..917dfbff99b7 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client.go @@ -18,6 +18,8 @@ import ( // DeletedAccountsClient contains the methods for the DeletedAccounts group. // Don't use this type directly, use NewDeletedAccountsClient() instead. +// +// Generated from API version 2026-03-15-preview type DeletedAccountsClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - location - The location name. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. @@ -93,8 +93,8 @@ func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -109,8 +109,6 @@ 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 2026-01-15-preview // - options - DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.NewListPager // method. func (client *DeletedAccountsClient) NewListPager(options *DeletedAccountsClientListOptions) *runtime.Pager[DeletedAccountsClientListResponse] { @@ -148,8 +146,8 @@ func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, _ *D return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -165,8 +163,6 @@ 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 2026-01-15-preview // - location - The location name. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. @@ -191,8 +187,6 @@ 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 2026-01-15-preview 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" @@ -238,7 +232,7 @@ func (client *DeletedAccountsClient) purgeCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client_example_test.go index 232029d4f312..eb6e5c6a5508 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deletedaccounts_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/GetDeletedAccount.json +// Generated from example definition: 2026-03-15-preview/GetDeletedAccount.json func ExampleDeletedAccountsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -30,7 +30,7 @@ func ExampleDeletedAccountsClient_Get() { _ = 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 = armcognitiveservices.DeletedAccountsClientGetResponse{ - // Account: &armcognitiveservices.Account{ + // Account: armcognitiveservices.Account{ // Name: to.Ptr("myAccount"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts"), // Etag: to.Ptr("W/\"datetime'2017-04-10T04%3A42%3A19.7067387Z'\""), @@ -52,7 +52,7 @@ func ExampleDeletedAccountsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListDeletedAccountsBySubscription.json +// Generated from example definition: 2026-03-15-preview/ListDeletedAccountsBySubscription.json func ExampleDeletedAccountsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -146,7 +146,7 @@ func ExampleDeletedAccountsClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/PurgeDeletedAccount.json +// Generated from example definition: 2026-03-15-preview/PurgeDeletedAccount.json func ExampleDeletedAccountsClient_BeginPurge() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -163,7 +163,7 @@ func ExampleDeletedAccountsClient_BeginPurge() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go index e9196891974d..656ce3578624 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client.go @@ -18,6 +18,8 @@ import ( // DeploymentsClient contains the methods for the Deployments group. // Don't use this type directly, use NewDeploymentsClient() instead. +// +// Generated from API version 2026-03-15-preview type DeploymentsClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -68,8 +68,6 @@ 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 2026-01-15-preview 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" @@ -115,8 +113,8 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, deployment); err != nil { @@ -127,8 +125,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -152,8 +148,6 @@ 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 2026-01-15-preview 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" @@ -199,15 +193,13 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -258,8 +250,8 @@ func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -274,8 +266,6 @@ func (client *DeploymentsClient) getHandleResponse(resp *http.Response) (Deploym } // NewListPager - Gets the deployments associated with the Cognitive Services account. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - DeploymentsClientListOptions contains the optional parameters for the DeploymentsClient.NewListPager method. @@ -322,8 +312,8 @@ func (client *DeploymentsClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -338,8 +328,6 @@ func (client *DeploymentsClient) listHandleResponse(resp *http.Response) (Deploy } // NewListSKUsPager - Lists the specified deployments skus associated with the Cognitive Services account. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -392,8 +380,8 @@ func (client *DeploymentsClient) listSKUsCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -413,8 +401,6 @@ func (client *DeploymentsClient) listSKUsHandleResponse(resp *http.Response) (De // Only Standard, DataZoneStandard, and GlobalStandard SKUs support this operation. Inference requests to the paused deployment // endpoint will receive HTTP 423 (Locked). This operation is idempotent. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -465,8 +451,8 @@ func (client *DeploymentsClient) pauseCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -485,8 +471,6 @@ func (client *DeploymentsClient) pauseHandleResponse(resp *http.Response) (Deplo // Resumes inferencing on a previously paused deployment by setting the deploymentState to 'Running' (see #/definitions/DeploymentProperties/properties/deploymentState). // This operation is idempotent and can be safely called on already running deployments. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -537,8 +521,8 @@ func (client *DeploymentsClient) resumeCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -554,8 +538,6 @@ func (client *DeploymentsClient) resumeHandleResponse(resp *http.Response) (Depl // BeginUpdate - Update specified deployments associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - deploymentName - The name of the deployment associated with the Cognitive Services Account @@ -580,8 +562,6 @@ 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 2026-01-15-preview 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" @@ -627,8 +607,8 @@ func (client *DeploymentsClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []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 index d9cc618c925e..d13d498aba9d 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/deployments_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/PutDeployment.json +// Generated from example definition: 2026-03-15-preview/PutDeployment.json func ExampleDeploymentsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -43,13 +43,13 @@ func ExampleDeploymentsClient_BeginCreateOrUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.DeploymentsClientCreateOrUpdateResponse{ - // Deployment: &armcognitiveservices.Deployment{ + // 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"), @@ -71,7 +71,7 @@ func ExampleDeploymentsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteDeployment.json +// Generated from example definition: 2026-03-15-preview/DeleteDeployment.json func ExampleDeploymentsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -88,7 +88,7 @@ func ExampleDeploymentsClient_BeginDelete() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res @@ -97,7 +97,7 @@ func ExampleDeploymentsClient_BeginDelete() { // } } -// Generated from example definition: 2026-01-15-preview/GetDeployment.json +// Generated from example definition: 2026-03-15-preview/GetDeployment.json func ExampleDeploymentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -116,7 +116,7 @@ func ExampleDeploymentsClient_Get() { _ = 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 = armcognitiveservices.DeploymentsClientGetResponse{ - // Deployment: &armcognitiveservices.Deployment{ + // 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"), @@ -138,7 +138,7 @@ func ExampleDeploymentsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListDeployments.json +// Generated from example definition: 2026-03-15-preview/ListDeployments.json func ExampleDeploymentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -188,7 +188,7 @@ func ExampleDeploymentsClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/ListDeploymentSkus.json +// Generated from example definition: 2026-03-15-preview/ListDeploymentSkus.json func ExampleDeploymentsClient_NewListSKUsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -236,7 +236,7 @@ func ExampleDeploymentsClient_NewListSKUsPager() { } } -// Generated from example definition: 2026-01-15-preview/PauseDeployment.json +// Generated from example definition: 2026-03-15-preview/PauseDeployment.json func ExampleDeploymentsClient_Pause() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -255,7 +255,7 @@ func ExampleDeploymentsClient_Pause() { _ = 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 = armcognitiveservices.DeploymentsClientPauseResponse{ - // Deployment: &armcognitiveservices.Deployment{ + // 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"), @@ -276,7 +276,7 @@ func ExampleDeploymentsClient_Pause() { // } } -// Generated from example definition: 2026-01-15-preview/ResumeDeployment.json +// Generated from example definition: 2026-03-15-preview/ResumeDeployment.json func ExampleDeploymentsClient_Resume() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -295,7 +295,7 @@ func ExampleDeploymentsClient_Resume() { _ = 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 = armcognitiveservices.DeploymentsClientResumeResponse{ - // Deployment: &armcognitiveservices.Deployment{ + // 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"), @@ -316,7 +316,7 @@ func ExampleDeploymentsClient_Resume() { // } } -// Generated from example definition: 2026-01-15-preview/UpdateDeployment.json +// Generated from example definition: 2026-03-15-preview/UpdateDeployment.json func ExampleDeploymentsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -338,13 +338,13 @@ func ExampleDeploymentsClient_BeginUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.DeploymentsClientUpdateResponse{ - // Deployment: &armcognitiveservices.Deployment{ + // 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"), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client.go index c84a36ff17f1..29804b4d23ab 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client.go @@ -18,6 +18,8 @@ import ( // EncryptionScopesClient contains the methods for the EncryptionScopes group. // Don't use this type directly, use NewEncryptionScopesClient() instead. +// +// Generated from API version 2026-03-15-preview type EncryptionScopesClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - encryptionScopeName - The name of the encryptionScope associated with the Cognitive Services Account @@ -95,8 +95,8 @@ func (client *EncryptionScopesClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, encryptionScope); err != nil { @@ -116,8 +116,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - encryptionScopeName - The name of the encryptionScope associated with the Cognitive Services Account @@ -142,8 +140,6 @@ 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 2026-01-15-preview 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" @@ -189,15 +185,13 @@ func (client *EncryptionScopesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets the specified EncryptionScope associated with the Cognitive Services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - encryptionScopeName - The name of the encryptionScope associated with the Cognitive Services Account @@ -248,8 +242,8 @@ func (client *EncryptionScopesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -264,8 +258,6 @@ func (client *EncryptionScopesClient) getHandleResponse(resp *http.Response) (En } // NewListPager - Gets the content filters associated with the Azure OpenAI account. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - EncryptionScopesClientListOptions contains the optional parameters for the EncryptionScopesClient.NewListPager @@ -313,8 +305,8 @@ func (client *EncryptionScopesClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 index 3d99c613ee71..6502f4915d79 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/encryptionscopes_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/PutEncryptionScope.json +// Generated from example definition: 2026-03-15-preview/PutEncryptionScope.json func ExampleEncryptionScopesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -42,7 +42,7 @@ func ExampleEncryptionScopesClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.EncryptionScopesClientCreateOrUpdateResponse{ - // EncryptionScope: &armcognitiveservices.EncryptionScope{ + // EncryptionScope: armcognitiveservices.EncryptionScope{ // Name: to.Ptr("encryptionScopeName"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/encryptionScopes"), // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), @@ -70,7 +70,7 @@ func ExampleEncryptionScopesClient_CreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteEncryptionScope.json +// Generated from example definition: 2026-03-15-preview/DeleteEncryptionScope.json func ExampleEncryptionScopesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -87,11 +87,11 @@ func ExampleEncryptionScopesClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/GetEncryptionScope.json +// Generated from example definition: 2026-03-15-preview/GetEncryptionScope.json func ExampleEncryptionScopesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -110,7 +110,7 @@ func ExampleEncryptionScopesClient_Get() { _ = 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 = armcognitiveservices.EncryptionScopesClientGetResponse{ - // EncryptionScope: &armcognitiveservices.EncryptionScope{ + // EncryptionScope: armcognitiveservices.EncryptionScope{ // Name: to.Ptr("encryptionScopeName"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/encryptionScopes"), // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), @@ -138,7 +138,7 @@ func ExampleEncryptionScopesClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListEncryptionScopes.json +// Generated from example definition: 2026-03-15-preview/ListEncryptionScopes.json func ExampleEncryptionScopesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountcapabilityhosts_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountcapabilityhosts_server.go index 8ec4e70065a3..dd64a0a2be00 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountcapabilityhosts_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountcapabilityhosts_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AccountCapabilityHostsServer is a fake server for instances of the armcognitiveservices.AccountCapabilityHostsClient type. @@ -70,9 +71,7 @@ func (a *AccountCapabilityHostsServerTransport) Do(req *http.Request) (*http.Res } func (a *AccountCapabilityHostsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -94,10 +93,7 @@ func (a *AccountCapabilityHostsServerTransport) dispatchToMethodFake(req *http.R } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -149,7 +145,7 @@ func (a *AccountCapabilityHostsServerTransport) dispatchBeginCreateOrUpdate(req return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.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)} } @@ -197,7 +193,7 @@ func (a *AccountCapabilityHostsServerTransport) dispatchBeginDelete(req *http.Re return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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)} } @@ -235,7 +231,7 @@ func (a *AccountCapabilityHostsServerTransport) dispatchGet(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -276,7 +272,7 @@ func (a *AccountCapabilityHostsServerTransport) dispatchNewListPager(req *http.R if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountconnections_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountconnections_server.go index fe423af36b6c..49537931bddb 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountconnections_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accountconnections_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" "strconv" ) @@ -71,9 +72,7 @@ func (a *AccountConnectionsServerTransport) Do(req *http.Request) (*http.Respons } func (a *AccountConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -97,10 +96,7 @@ func (a *AccountConnectionsServerTransport) dispatchToMethodFake(req *http.Reque } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -142,7 +138,7 @@ func (a *AccountConnectionsServerTransport) dispatchCreate(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -179,7 +175,7 @@ func (a *AccountConnectionsServerTransport) dispatchDelete(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.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) @@ -216,7 +212,7 @@ func (a *AccountConnectionsServerTransport) dispatchGet(req *http.Request) (*htt return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -247,21 +243,9 @@ func (a *AccountConnectionsServerTransport) dispatchNewListPager(req *http.Reque 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) + targetParam := getOptional(qp.Get("target")) + categoryParam := getOptional(qp.Get("category")) + includeAllParam, err := parseOptional(qp.Get("includeAll"), strconv.ParseBool) if err != nil { return nil, err } @@ -284,7 +268,7 @@ func (a *AccountConnectionsServerTransport) dispatchNewListPager(req *http.Reque if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -325,7 +309,7 @@ func (a *AccountConnectionsServerTransport) dispatchUpdate(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accounts_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accounts_server.go index 92b5cd1f1ac3..f43bbdd03da9 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accounts_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/accounts_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AccountsServer is a fake server for instances of the armcognitiveservices.AccountsClient type. @@ -28,6 +29,10 @@ type AccountsServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, options *armcognitiveservices.AccountsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcognitiveservices.AccountsClientDeleteResponse], errResp azfake.ErrorResponder) + // EvaluateDeploymentPolicies is the fake for method AccountsClient.EvaluateDeploymentPolicies + // HTTP status codes to indicate success: http.StatusOK + EvaluateDeploymentPolicies func(ctx context.Context, resourceGroupName string, accountName string, body armcognitiveservices.EvaluateDeploymentPoliciesRequest, options *armcognitiveservices.AccountsClientEvaluateDeploymentPoliciesOptions) (resp azfake.Responder[armcognitiveservices.AccountsClientEvaluateDeploymentPoliciesResponse], errResp azfake.ErrorResponder) + // Get is the fake for method AccountsClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, accountName string, options *armcognitiveservices.AccountsClientGetOptions) (resp azfake.Responder[armcognitiveservices.AccountsClientGetResponse], errResp azfake.ErrorResponder) @@ -104,9 +109,7 @@ func (a *AccountsServerTransport) Do(req *http.Request) (*http.Response, error) } func (a *AccountsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -119,6 +122,8 @@ func (a *AccountsServerTransport) dispatchToMethodFake(req *http.Request, method res.resp, res.err = a.dispatchBeginCreate(req) case "AccountsClient.BeginDelete": res.resp, res.err = a.dispatchBeginDelete(req) + case "AccountsClient.EvaluateDeploymentPolicies": + res.resp, res.err = a.dispatchEvaluateDeploymentPolicies(req) case "AccountsClient.Get": res.resp, res.err = a.dispatchGet(req) case "AccountsClient.NewListPager": @@ -142,10 +147,7 @@ func (a *AccountsServerTransport) dispatchToMethodFake(req *http.Request, method } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -193,7 +195,7 @@ func (a *AccountsServerTransport) dispatchBeginCreate(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { a.beginCreate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} } @@ -237,7 +239,7 @@ func (a *AccountsServerTransport) dispatchBeginDelete(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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)} } @@ -248,6 +250,43 @@ func (a *AccountsServerTransport) dispatchBeginDelete(req *http.Request) (*http. return resp, nil } +func (a *AccountsServerTransport) dispatchEvaluateDeploymentPolicies(req *http.Request) (*http.Response, error) { + if a.srv.EvaluateDeploymentPolicies == nil { + return nil, &nonRetriableError{errors.New("fake for method EvaluateDeploymentPolicies 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~%@]+)/evaluateDeploymentPolicies` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.EvaluateDeploymentPoliciesRequest](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 + } + respr, errRespr := a.srv.EvaluateDeploymentPolicies(req.Context(), resourceGroupNameParam, accountNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.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).EvaluateDeploymentPoliciesResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (a *AccountsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if a.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} @@ -271,7 +310,7 @@ func (a *AccountsServerTransport) dispatchGet(req *http.Request) (*http.Response return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).Account, req) @@ -304,7 +343,7 @@ func (a *AccountsServerTransport) dispatchNewListPager(req *http.Request) (*http if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -341,7 +380,7 @@ func (a *AccountsServerTransport) dispatchNewListByResourceGroupPager(req *http. if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -374,7 +413,7 @@ func (a *AccountsServerTransport) dispatchListKeys(req *http.Request) (*http.Res return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).APIKeys, req) @@ -415,7 +454,7 @@ func (a *AccountsServerTransport) dispatchNewListModelsPager(req *http.Request) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListModelsPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -448,7 +487,7 @@ func (a *AccountsServerTransport) dispatchListSKUs(req *http.Request) (*http.Res return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).AccountSKUListResult, req) @@ -477,11 +516,7 @@ func (a *AccountsServerTransport) dispatchListUsages(req *http.Request) (*http.R if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) + filterParam := getOptional(qp.Get("$filter")) var options *armcognitiveservices.AccountsClientListUsagesOptions if filterParam != nil { options = &armcognitiveservices.AccountsClientListUsagesOptions{ @@ -493,7 +528,7 @@ func (a *AccountsServerTransport) dispatchListUsages(req *http.Request) (*http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).UsageListResult, req) @@ -530,7 +565,7 @@ func (a *AccountsServerTransport) dispatchRegenerateKey(req *http.Request) (*htt return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).APIKeys, req) @@ -577,7 +612,7 @@ func (a *AccountsServerTransport) dispatchBeginUpdate(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { a.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/agentapplications_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/agentapplications_server.go index 4f51937bdfae..71e11e4a5dea 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/agentapplications_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/agentapplications_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" "strconv" ) @@ -83,9 +84,7 @@ func (a *AgentApplicationsServerTransport) Do(req *http.Request) (*http.Response } func (a *AgentApplicationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -113,10 +112,7 @@ func (a *AgentApplicationsServerTransport) dispatchToMethodFake(req *http.Reques } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -172,7 +168,7 @@ func (a *AgentApplicationsServerTransport) dispatchBeginCreateOrUpdate(req *http return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.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)} } @@ -224,7 +220,7 @@ func (a *AgentApplicationsServerTransport) dispatchBeginDelete(req *http.Request return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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)} } @@ -266,7 +262,7 @@ func (a *AgentApplicationsServerTransport) dispatchDisable(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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.NewResponse(respContent, req, nil) @@ -307,7 +303,7 @@ func (a *AgentApplicationsServerTransport) dispatchEnable(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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.NewResponse(respContent, req, nil) @@ -348,7 +344,7 @@ func (a *AgentApplicationsServerTransport) dispatchGet(req *http.Request) (*http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).AgentApplication, req) @@ -383,11 +379,7 @@ func (a *AgentApplicationsServerTransport) dispatchNewListPager(req *http.Reques if err != nil { return nil, err } - countUnescaped, err := url.QueryUnescape(qp.Get("count")) - if err != nil { - return nil, err - } - countParam, err := parseOptional(countUnescaped, func(v string) (int32, error) { + countParam, err := parseOptional(qp.Get("count"), func(v string) (int32, error) { p, parseErr := strconv.ParseInt(v, 10, 32) if parseErr != nil { return 0, parseErr @@ -397,11 +389,7 @@ func (a *AgentApplicationsServerTransport) dispatchNewListPager(req *http.Reques if err != nil { return nil, err } - skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) - if err != nil { - return nil, err - } - skipParam, err := parseOptional(skipUnescaped, func(v string) (int32, error) { + skipParam, err := parseOptional(qp.Get("$skip"), func(v string) (int32, error) { p, parseErr := strconv.ParseInt(v, 10, 32) if parseErr != nil { return 0, parseErr @@ -411,45 +399,20 @@ func (a *AgentApplicationsServerTransport) dispatchNewListPager(req *http.Reques if err != nil { return nil, err } - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - namesEscaped := qp["names"] - namesParam := make([]string, len(namesEscaped)) - for i, v := range namesEscaped { - u, unescapeErr := url.QueryUnescape(v) - if unescapeErr != nil { - return nil, unescapeErr - } - namesParam[i] = u - } - searchTextUnescaped, err := url.QueryUnescape(qp.Get("searchText")) - if err != nil { - return nil, err - } - searchTextParam := getOptional(searchTextUnescaped) - orderByUnescaped, err := url.QueryUnescape(qp.Get("orderBy")) - if err != nil { - return nil, err - } - orderByParam := getOptional(orderByUnescaped) - orderByAscUnescaped, err := url.QueryUnescape(qp.Get("orderByAsc")) - if err != nil { - return nil, err - } - orderByAscParam, err := parseOptional(orderByAscUnescaped, strconv.ParseBool) + skipTokenParam := getOptional(qp.Get("$skipToken")) + searchTextParam := getOptional(qp.Get("searchText")) + orderByParam := getOptional(qp.Get("orderBy")) + orderByAscParam, err := parseOptional(qp.Get("orderByAsc"), strconv.ParseBool) if err != nil { return nil, err } var options *armcognitiveservices.AgentApplicationsClientListOptions - if countParam != nil || skipParam != nil || skipTokenParam != nil || len(namesParam) > 0 || searchTextParam != nil || orderByParam != nil || orderByAscParam != nil { + if countParam != nil || skipParam != nil || skipTokenParam != nil || len(qp["names"]) > 0 || searchTextParam != nil || orderByParam != nil || orderByAscParam != nil { options = &armcognitiveservices.AgentApplicationsClientListOptions{ Count: countParam, Skip: skipParam, SkipToken: skipTokenParam, - Names: namesParam, + Names: qp["names"], SearchText: searchTextParam, OrderBy: orderByParam, OrderByAsc: orderByAscParam, @@ -466,7 +429,7 @@ func (a *AgentApplicationsServerTransport) dispatchNewListPager(req *http.Reques if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -507,7 +470,7 @@ func (a *AgentApplicationsServerTransport) dispatchListAgents(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).AgentReferenceResourceArmPaginatedResult, req) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/agentdeployments_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/agentdeployments_server.go index 88aa541c724d..8ecccde06ef5 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/agentdeployments_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/agentdeployments_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" "strconv" ) @@ -79,9 +80,7 @@ func (a *AgentDeploymentsServerTransport) Do(req *http.Request) (*http.Response, } func (a *AgentDeploymentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -107,10 +106,7 @@ func (a *AgentDeploymentsServerTransport) dispatchToMethodFake(req *http.Request } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -170,7 +166,7 @@ func (a *AgentDeploymentsServerTransport) dispatchBeginCreateOrUpdate(req *http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.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)} } @@ -226,7 +222,7 @@ func (a *AgentDeploymentsServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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)} } @@ -272,7 +268,7 @@ func (a *AgentDeploymentsServerTransport) dispatchGet(req *http.Request) (*http. return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).AgentDeployment, req) @@ -311,11 +307,7 @@ func (a *AgentDeploymentsServerTransport) dispatchNewListPager(req *http.Request if err != nil { return nil, err } - countUnescaped, err := url.QueryUnescape(qp.Get("count")) - if err != nil { - return nil, err - } - countParam, err := parseOptional(countUnescaped, func(v string) (int32, error) { + countParam, err := parseOptional(qp.Get("count"), func(v string) (int32, error) { p, parseErr := strconv.ParseInt(v, 10, 32) if parseErr != nil { return 0, parseErr @@ -325,39 +317,18 @@ func (a *AgentDeploymentsServerTransport) dispatchNewListPager(req *http.Request if err != nil { return nil, err } - skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) - if err != nil { - return nil, err - } - skipTokenParam := getOptional(skipTokenUnescaped) - namesEscaped := qp["names"] - namesParam := make([]string, len(namesEscaped)) - for i, v := range namesEscaped { - u, unescapeErr := url.QueryUnescape(v) - if unescapeErr != nil { - return nil, unescapeErr - } - namesParam[i] = u - } - orderByUnescaped, err := url.QueryUnescape(qp.Get("orderBy")) - if err != nil { - return nil, err - } - orderByParam := getOptional(orderByUnescaped) - orderByAscUnescaped, err := url.QueryUnescape(qp.Get("orderByAsc")) - if err != nil { - return nil, err - } - orderByAscParam, err := parseOptional(orderByAscUnescaped, strconv.ParseBool) + skipTokenParam := getOptional(qp.Get("$skipToken")) + orderByParam := getOptional(qp.Get("orderBy")) + orderByAscParam, err := parseOptional(qp.Get("orderByAsc"), strconv.ParseBool) if err != nil { return nil, err } var options *armcognitiveservices.AgentDeploymentsClientListOptions - if countParam != nil || skipTokenParam != nil || len(namesParam) > 0 || orderByParam != nil || orderByAscParam != nil { + if countParam != nil || skipTokenParam != nil || len(qp["names"]) > 0 || orderByParam != nil || orderByAscParam != nil { options = &armcognitiveservices.AgentDeploymentsClientListOptions{ Count: countParam, SkipToken: skipTokenParam, - Names: namesParam, + Names: qp["names"], OrderBy: orderByParam, OrderByAsc: orderByAscParam, } @@ -373,7 +344,7 @@ func (a *AgentDeploymentsServerTransport) dispatchNewListPager(req *http.Request if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -418,7 +389,7 @@ func (a *AgentDeploymentsServerTransport) dispatchStart(req *http.Request) (*htt return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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.NewResponse(respContent, req, nil) @@ -463,7 +434,7 @@ func (a *AgentDeploymentsServerTransport) dispatchStop(req *http.Request) (*http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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.NewResponse(respContent, req, nil) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmentplans_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmentplans_server.go index f43b1f640d90..eb1817c60834 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmentplans_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmentplans_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // CommitmentPlansServer is a fake server for instances of the armcognitiveservices.CommitmentPlansClient type. @@ -124,9 +125,7 @@ func (c *CommitmentPlansServerTransport) Do(req *http.Request) (*http.Response, } func (c *CommitmentPlansServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -168,10 +167,7 @@ func (c *CommitmentPlansServerTransport) dispatchToMethodFake(req *http.Request, } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -213,7 +209,7 @@ func (c *CommitmentPlansServerTransport) dispatchCreateOrUpdate(req *http.Reques return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CommitmentPlan, req) @@ -264,7 +260,7 @@ func (c *CommitmentPlansServerTransport) dispatchBeginCreateOrUpdateAssociation( return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { c.beginCreateOrUpdateAssociation.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -312,7 +308,7 @@ func (c *CommitmentPlansServerTransport) dispatchBeginCreateOrUpdatePlan(req *ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { c.beginCreateOrUpdatePlan.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -360,7 +356,7 @@ func (c *CommitmentPlansServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -408,7 +404,7 @@ func (c *CommitmentPlansServerTransport) dispatchBeginDeleteAssociation(req *htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDeleteAssociation.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -452,7 +448,7 @@ func (c *CommitmentPlansServerTransport) dispatchBeginDeletePlan(req *http.Reque return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDeletePlan.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -490,7 +486,7 @@ func (c *CommitmentPlansServerTransport) dispatchGet(req *http.Request) (*http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).CommitmentPlan, req) @@ -527,7 +523,7 @@ func (c *CommitmentPlansServerTransport) dispatchGetAssociation(req *http.Reques return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).CommitmentPlanAccountAssociation, req) @@ -560,7 +556,7 @@ func (c *CommitmentPlansServerTransport) dispatchGetPlan(req *http.Request) (*ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).CommitmentPlan, req) @@ -601,7 +597,7 @@ func (c *CommitmentPlansServerTransport) dispatchNewListPager(req *http.Request) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -642,7 +638,7 @@ func (c *CommitmentPlansServerTransport) dispatchNewListAssociationsPager(req *h if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListAssociationsPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -679,7 +675,7 @@ func (c *CommitmentPlansServerTransport) dispatchNewListPlansByResourceGroupPage if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListPlansByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -712,7 +708,7 @@ func (c *CommitmentPlansServerTransport) dispatchNewListPlansBySubscriptionPager if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListPlansBySubscriptionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -759,7 +755,7 @@ func (c *CommitmentPlansServerTransport) dispatchBeginUpdatePlan(req *http.Reque return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { c.beginUpdatePlan.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmenttiers_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmenttiers_server.go index 54e5ae518cad..9562556e8000 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmenttiers_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/commitmenttiers_server.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // CommitmentTiersServer is a fake server for instances of the armcognitiveservices.CommitmentTiersClient type. @@ -53,9 +54,7 @@ func (c *CommitmentTiersServerTransport) Do(req *http.Request) (*http.Response, } func (c *CommitmentTiersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -71,10 +70,7 @@ func (c *CommitmentTiersServerTransport) dispatchToMethodFake(req *http.Request, } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -112,7 +108,7 @@ func (c *CommitmentTiersServerTransport) dispatchNewListPager(req *http.Request) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/computeoperations_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/computeoperations_server.go index b8bad8cbc287..37a4fb5c4dcf 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/computeoperations_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/computeoperations_server.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ComputeOperationsServer is a fake server for instances of the armcognitiveservices.ComputeOperationsClient type. @@ -49,9 +50,7 @@ func (c *ComputeOperationsServerTransport) Do(req *http.Request) (*http.Response } func (c *ComputeOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -67,10 +66,7 @@ func (c *ComputeOperationsServerTransport) dispatchToMethodFake(req *http.Reques } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -104,7 +100,7 @@ func (c *ComputeOperationsServerTransport) dispatchGet(req *http.Request) (*http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).ComputeOperationStatus, req) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/computes_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/computes_server.go new file mode 100644 index 000000000000..cefd68c963b9 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/computes_server.go @@ -0,0 +1,517 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/v4" + "net/http" + "net/url" + "regexp" + "slices" +) + +// ComputesServer is a fake server for instances of the armcognitiveservices.ComputesClient type. +type ComputesServer struct { + // BeginCreateOrUpdate is the fake for method ComputesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, computeName string, resource armcognitiveservices.Compute, options *armcognitiveservices.ComputesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcognitiveservices.ComputesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ComputesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *armcognitiveservices.ComputesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcognitiveservices.ComputesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ComputesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *armcognitiveservices.ComputesClientGetOptions) (resp azfake.Responder[armcognitiveservices.ComputesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ComputesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, accountName string, options *armcognitiveservices.ComputesClientListOptions) (resp azfake.PagerResponder[armcognitiveservices.ComputesClientListResponse]) + + // BeginRestart is the fake for method ComputesClient.BeginRestart + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginRestart func(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *armcognitiveservices.ComputesClientBeginRestartOptions) (resp azfake.PollerResponder[armcognitiveservices.ComputesClientRestartResponse], errResp azfake.ErrorResponder) + + // BeginStart is the fake for method ComputesClient.BeginStart + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginStart func(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *armcognitiveservices.ComputesClientBeginStartOptions) (resp azfake.PollerResponder[armcognitiveservices.ComputesClientStartResponse], errResp azfake.ErrorResponder) + + // BeginStop is the fake for method ComputesClient.BeginStop + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginStop func(ctx context.Context, resourceGroupName string, accountName string, computeName string, options *armcognitiveservices.ComputesClientBeginStopOptions) (resp azfake.PollerResponder[armcognitiveservices.ComputesClientStopResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method ComputesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, accountName string, computeName string, properties armcognitiveservices.Compute, options *armcognitiveservices.ComputesClientBeginUpdateOptions) (resp azfake.PollerResponder[armcognitiveservices.ComputesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewComputesServerTransport creates a new instance of ComputesServerTransport with the provided implementation. +// The returned ComputesServerTransport instance is connected to an instance of armcognitiveservices.ComputesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewComputesServerTransport(srv *ComputesServer) *ComputesServerTransport { + return &ComputesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcognitiveservices.ComputesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcognitiveservices.ComputesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcognitiveservices.ComputesClientListResponse]](), + beginRestart: newTracker[azfake.PollerResponder[armcognitiveservices.ComputesClientRestartResponse]](), + beginStart: newTracker[azfake.PollerResponder[armcognitiveservices.ComputesClientStartResponse]](), + beginStop: newTracker[azfake.PollerResponder[armcognitiveservices.ComputesClientStopResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armcognitiveservices.ComputesClientUpdateResponse]](), + } +} + +// ComputesServerTransport connects instances of armcognitiveservices.ComputesClient to instances of ComputesServer. +// Don't use this type directly, use NewComputesServerTransport instead. +type ComputesServerTransport struct { + srv *ComputesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcognitiveservices.ComputesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcognitiveservices.ComputesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armcognitiveservices.ComputesClientListResponse]] + beginRestart *tracker[azfake.PollerResponder[armcognitiveservices.ComputesClientRestartResponse]] + beginStart *tracker[azfake.PollerResponder[armcognitiveservices.ComputesClientStartResponse]] + beginStop *tracker[azfake.PollerResponder[armcognitiveservices.ComputesClientStopResponse]] + beginUpdate *tracker[azfake.PollerResponder[armcognitiveservices.ComputesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ComputesServerTransport. +func (c *ComputesServerTransport) 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 c.dispatchToMethodFake(req, method) +} + +func (c *ComputesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if computesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = computesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ComputesClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "ComputesClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "ComputesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ComputesClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + case "ComputesClient.BeginRestart": + res.resp, res.err = c.dispatchBeginRestart(req) + case "ComputesClient.BeginStart": + res.resp, res.err = c.dispatchBeginStart(req) + case "ComputesClient.BeginStop": + res.resp, res.err = c.dispatchBeginStop(req) + case "ComputesClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (c *ComputesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := c.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~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.Compute](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 + } + computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, accountNameParam, computeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.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) { + c.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (c *ComputesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.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~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, computeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.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) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *ComputesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.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~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, computeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.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).Compute, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ComputesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := c.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~%@]+)/computes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + resp := c.srv.NewListPager(resourceGroupNameParam, accountNameParam, nil) + newListPager = &resp + c.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcognitiveservices.ComputesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + c.newListPager.remove(req) + } + return resp, nil +} + +func (c *ComputesServerTransport) dispatchBeginRestart(req *http.Request) (*http.Response, error) { + if c.srv.BeginRestart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRestart not implemented")} + } + beginRestart := c.beginRestart.get(req) + if beginRestart == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restart` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginRestart(req.Context(), resourceGroupNameParam, accountNameParam, computeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRestart = &respr + c.beginRestart.add(req, beginRestart) + } + + resp, err := server.PollerResponderNext(beginRestart, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginRestart.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(beginRestart) { + c.beginRestart.remove(req) + } + + return resp, nil +} + +func (c *ComputesServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { + if c.srv.BeginStart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} + } + beginStart := c.beginStart.get(req) + if beginStart == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginStart(req.Context(), resourceGroupNameParam, accountNameParam, computeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginStart = &respr + c.beginStart.add(req, beginStart) + } + + resp, err := server.PollerResponderNext(beginStart, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginStart.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(beginStart) { + c.beginStart.remove(req) + } + + return resp, nil +} + +func (c *ComputesServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { + if c.srv.BeginStop == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} + } + beginStop := c.beginStop.get(req) + if beginStop == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginStop(req.Context(), resourceGroupNameParam, accountNameParam, computeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginStop = &respr + c.beginStop.add(req, beginStop) + } + + resp, err := server.PollerResponderNext(beginStop, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginStop.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(beginStop) { + c.beginStop.remove(req) + } + + return resp, nil +} + +func (c *ComputesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := c.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~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.Compute](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 + } + computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, accountNameParam, computeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.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) { + c.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ComputesServerTransport +var computesServerTransportInterceptor 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 b601cbbcc2ec..5c3006dd79af 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/defenderforaisettings_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/defenderforaisettings_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // DefenderForAISettingsServer is a fake server for instances of the armcognitiveservices.DefenderForAISettingsClient type. @@ -66,9 +67,7 @@ func (d *DefenderForAISettingsServerTransport) Do(req *http.Request) (*http.Resp } func (d *DefenderForAISettingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -90,10 +89,7 @@ func (d *DefenderForAISettingsServerTransport) dispatchToMethodFake(req *http.Re } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -135,7 +131,7 @@ func (d *DefenderForAISettingsServerTransport) dispatchCreateOrUpdate(req *http. return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DefenderForAISetting, req) @@ -172,7 +168,7 @@ func (d *DefenderForAISettingsServerTransport) dispatchGet(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).DefenderForAISetting, req) @@ -213,7 +209,7 @@ func (d *DefenderForAISettingsServerTransport) dispatchNewListPager(req *http.Re if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -254,7 +250,7 @@ func (d *DefenderForAISettingsServerTransport) dispatchUpdate(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).DefenderForAISetting, req) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deletedaccounts_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deletedaccounts_server.go index 2532bab6961c..b0e6b24c8477 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deletedaccounts_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deletedaccounts_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // DeletedAccountsServer is a fake server for instances of the armcognitiveservices.DeletedAccountsClient type. @@ -64,9 +65,7 @@ func (d *DeletedAccountsServerTransport) Do(req *http.Request) (*http.Response, } func (d *DeletedAccountsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -86,10 +85,7 @@ func (d *DeletedAccountsServerTransport) dispatchToMethodFake(req *http.Request, } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -127,7 +123,7 @@ func (d *DeletedAccountsServerTransport) dispatchGet(req *http.Request) (*http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).Account, req) @@ -160,7 +156,7 @@ func (d *DeletedAccountsServerTransport) dispatchNewListPager(req *http.Request) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -207,7 +203,7 @@ func (d *DeletedAccountsServerTransport) dispatchBeginPurge(req *http.Request) ( return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginPurge.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deployments_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deployments_server.go index 542243f84367..640be4f0655b 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deployments_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/deployments_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // DeploymentsServer is a fake server for instances of the armcognitiveservices.DeploymentsClient type. @@ -90,9 +91,7 @@ func (d *DeploymentsServerTransport) Do(req *http.Request) (*http.Response, erro } func (d *DeploymentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -122,10 +121,7 @@ func (d *DeploymentsServerTransport) dispatchToMethodFake(req *http.Request, met } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -177,7 +173,7 @@ func (d *DeploymentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Reque return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { d.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -225,7 +221,7 @@ func (d *DeploymentsServerTransport) dispatchBeginDelete(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -263,7 +259,7 @@ func (d *DeploymentsServerTransport) dispatchGet(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).Deployment, req) @@ -304,7 +300,7 @@ func (d *DeploymentsServerTransport) dispatchNewListPager(req *http.Request) (*h if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -349,7 +345,7 @@ func (d *DeploymentsServerTransport) dispatchNewListSKUsPager(req *http.Request) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListSKUsPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -386,7 +382,7 @@ func (d *DeploymentsServerTransport) dispatchPause(req *http.Request) (*http.Res return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).Deployment, req) @@ -423,7 +419,7 @@ func (d *DeploymentsServerTransport) dispatchResume(req *http.Request) (*http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).Deployment, req) @@ -474,7 +470,7 @@ func (d *DeploymentsServerTransport) dispatchBeginUpdate(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { d.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/encryptionscopes_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/encryptionscopes_server.go index 086f35293fb9..cb229b9df6fb 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/encryptionscopes_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/encryptionscopes_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // EncryptionScopesServer is a fake server for instances of the armcognitiveservices.EncryptionScopesClient type. @@ -68,9 +69,7 @@ func (e *EncryptionScopesServerTransport) Do(req *http.Request) (*http.Response, } func (e *EncryptionScopesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -92,10 +91,7 @@ func (e *EncryptionScopesServerTransport) dispatchToMethodFake(req *http.Request } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -137,7 +133,7 @@ func (e *EncryptionScopesServerTransport) dispatchCreateOrUpdate(req *http.Reque return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EncryptionScope, req) @@ -184,7 +180,7 @@ func (e *EncryptionScopesServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -222,7 +218,7 @@ func (e *EncryptionScopesServerTransport) dispatchGet(req *http.Request) (*http. return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).EncryptionScope, req) @@ -263,7 +259,7 @@ func (e *EncryptionScopesServerTransport) dispatchNewListPager(req *http.Request if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { e.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/internal.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/internal.go index 7727bdfcd180..504fffe54caa 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/internal.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/internal.go @@ -24,15 +24,6 @@ func (nonRetriableError) NonRetriable() { // marker method } -func contains[T comparable](s []T, v T) bool { - for _, vv := range s { - if vv == v { - return true - } - } - return false -} - func getOptional[T any](v T) *T { if reflect.ValueOf(v).IsZero() { return nil @@ -56,7 +47,7 @@ func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) if err != nil { return nil, err } - return &t, err + return &t, nil } func newTracker[T any]() *tracker[T] { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/locationbasedmodelcapacities_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/locationbasedmodelcapacities_server.go index cf5136bf30d7..495623a000a9 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/locationbasedmodelcapacities_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/locationbasedmodelcapacities_server.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // LocationBasedModelCapacitiesServer is a fake server for instances of the armcognitiveservices.LocationBasedModelCapacitiesClient type. @@ -53,9 +54,7 @@ func (l *LocationBasedModelCapacitiesServerTransport) Do(req *http.Request) (*ht } func (l *LocationBasedModelCapacitiesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -71,10 +70,7 @@ func (l *LocationBasedModelCapacitiesServerTransport) dispatchToMethodFake(req * } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -102,19 +98,7 @@ func (l *LocationBasedModelCapacitiesServerTransport) dispatchNewListPager(req * if err != nil { return nil, err } - modelFormatParam, err := url.QueryUnescape(qp.Get("modelFormat")) - if err != nil { - return nil, err - } - modelNameParam, err := url.QueryUnescape(qp.Get("modelName")) - if err != nil { - return nil, err - } - modelVersionParam, err := url.QueryUnescape(qp.Get("modelVersion")) - if err != nil { - return nil, err - } - resp := l.srv.NewListPager(locationParam, modelFormatParam, modelNameParam, modelVersionParam, nil) + resp := l.srv.NewListPager(locationParam, qp.Get("modelFormat"), qp.Get("modelName"), qp.Get("modelVersion"), nil) newListPager = &resp l.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcognitiveservices.LocationBasedModelCapacitiesClientListResponse, createLink func() string) { @@ -125,7 +109,7 @@ func (l *LocationBasedModelCapacitiesServerTransport) dispatchNewListPager(req * if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { l.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managedcomputecapacities_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managedcomputecapacities_server.go new file mode 100644 index 000000000000..90f531827d6e --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managedcomputecapacities_server.go @@ -0,0 +1,130 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "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/v4" + "net/http" + "regexp" + "slices" +) + +// ManagedComputeCapacitiesServer is a fake server for instances of the armcognitiveservices.ManagedComputeCapacitiesClient type. +type ManagedComputeCapacitiesServer struct { + // NewListPager is the fake for method ManagedComputeCapacitiesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(offer string, options *armcognitiveservices.ManagedComputeCapacitiesClientListOptions) (resp azfake.PagerResponder[armcognitiveservices.ManagedComputeCapacitiesClientListResponse]) +} + +// NewManagedComputeCapacitiesServerTransport creates a new instance of ManagedComputeCapacitiesServerTransport with the provided implementation. +// The returned ManagedComputeCapacitiesServerTransport instance is connected to an instance of armcognitiveservices.ManagedComputeCapacitiesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewManagedComputeCapacitiesServerTransport(srv *ManagedComputeCapacitiesServer) *ManagedComputeCapacitiesServerTransport { + return &ManagedComputeCapacitiesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcognitiveservices.ManagedComputeCapacitiesClientListResponse]](), + } +} + +// ManagedComputeCapacitiesServerTransport connects instances of armcognitiveservices.ManagedComputeCapacitiesClient to instances of ManagedComputeCapacitiesServer. +// Don't use this type directly, use NewManagedComputeCapacitiesServerTransport instead. +type ManagedComputeCapacitiesServerTransport struct { + srv *ManagedComputeCapacitiesServer + newListPager *tracker[azfake.PagerResponder[armcognitiveservices.ManagedComputeCapacitiesClientListResponse]] +} + +// Do implements the policy.Transporter interface for ManagedComputeCapacitiesServerTransport. +func (m *ManagedComputeCapacitiesServerTransport) 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 m.dispatchToMethodFake(req, method) +} + +func (m *ManagedComputeCapacitiesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if managedComputeCapacitiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = managedComputeCapacitiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ManagedComputeCapacitiesClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (m *ManagedComputeCapacitiesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := m.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/managedComputeCapacities` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + acceleratorTypeParam := getOptional(qp.Get("acceleratorType")) + deploymentIDParam := getOptional(qp.Get("deploymentId")) + var options *armcognitiveservices.ManagedComputeCapacitiesClientListOptions + if acceleratorTypeParam != nil || deploymentIDParam != nil { + options = &armcognitiveservices.ManagedComputeCapacitiesClientListOptions{ + AcceleratorType: acceleratorTypeParam, + DeploymentID: deploymentIDParam, + } + } + resp := m.srv.NewListPager(qp.Get("offer"), options) + newListPager = &resp + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcognitiveservices.ManagedComputeCapacitiesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + m.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ManagedComputeCapacitiesServerTransport +var managedComputeCapacitiesServerTransportInterceptor 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/managedcomputedeployments_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managedcomputedeployments_server.go new file mode 100644 index 000000000000..49e256050f2e --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managedcomputedeployments_server.go @@ -0,0 +1,349 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/v4" + "net/http" + "net/url" + "regexp" + "slices" +) + +// ManagedComputeDeploymentsServer is a fake server for instances of the armcognitiveservices.ManagedComputeDeploymentsClient type. +type ManagedComputeDeploymentsServer struct { + // BeginCreateOrUpdate is the fake for method ManagedComputeDeploymentsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, resource armcognitiveservices.ManagedComputeDeployment, options *armcognitiveservices.ManagedComputeDeploymentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcognitiveservices.ManagedComputeDeploymentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ManagedComputeDeploymentsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *armcognitiveservices.ManagedComputeDeploymentsClientBeginDeleteOptions) (resp azfake.PollerResponder[armcognitiveservices.ManagedComputeDeploymentsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ManagedComputeDeploymentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *armcognitiveservices.ManagedComputeDeploymentsClientGetOptions) (resp azfake.Responder[armcognitiveservices.ManagedComputeDeploymentsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ManagedComputeDeploymentsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, accountName string, options *armcognitiveservices.ManagedComputeDeploymentsClientListOptions) (resp azfake.PagerResponder[armcognitiveservices.ManagedComputeDeploymentsClientListResponse]) + + // BeginUpdate is the fake for method ManagedComputeDeploymentsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, properties armcognitiveservices.PatchResourceSKU, options *armcognitiveservices.ManagedComputeDeploymentsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcognitiveservices.ManagedComputeDeploymentsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewManagedComputeDeploymentsServerTransport creates a new instance of ManagedComputeDeploymentsServerTransport with the provided implementation. +// The returned ManagedComputeDeploymentsServerTransport instance is connected to an instance of armcognitiveservices.ManagedComputeDeploymentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewManagedComputeDeploymentsServerTransport(srv *ManagedComputeDeploymentsServer) *ManagedComputeDeploymentsServerTransport { + return &ManagedComputeDeploymentsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcognitiveservices.ManagedComputeDeploymentsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcognitiveservices.ManagedComputeDeploymentsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcognitiveservices.ManagedComputeDeploymentsClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armcognitiveservices.ManagedComputeDeploymentsClientUpdateResponse]](), + } +} + +// ManagedComputeDeploymentsServerTransport connects instances of armcognitiveservices.ManagedComputeDeploymentsClient to instances of ManagedComputeDeploymentsServer. +// Don't use this type directly, use NewManagedComputeDeploymentsServerTransport instead. +type ManagedComputeDeploymentsServerTransport struct { + srv *ManagedComputeDeploymentsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcognitiveservices.ManagedComputeDeploymentsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcognitiveservices.ManagedComputeDeploymentsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armcognitiveservices.ManagedComputeDeploymentsClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[armcognitiveservices.ManagedComputeDeploymentsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ManagedComputeDeploymentsServerTransport. +func (m *ManagedComputeDeploymentsServerTransport) 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 m.dispatchToMethodFake(req, method) +} + +func (m *ManagedComputeDeploymentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if managedComputeDeploymentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = managedComputeDeploymentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ManagedComputeDeploymentsClient.BeginCreateOrUpdate": + res.resp, res.err = m.dispatchBeginCreateOrUpdate(req) + case "ManagedComputeDeploymentsClient.BeginDelete": + res.resp, res.err = m.dispatchBeginDelete(req) + case "ManagedComputeDeploymentsClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "ManagedComputeDeploymentsClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + case "ManagedComputeDeploymentsClient.BeginUpdate": + res.resp, res.err = m.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (m *ManagedComputeDeploymentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if m.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := m.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~%@]+)/managedComputeDeployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.ManagedComputeDeployment](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 + } + deploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, accountNameParam, deploymentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + m.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + m.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) { + m.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (m *ManagedComputeDeploymentsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if m.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := m.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~%@]+)/managedComputeDeployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + deploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, deploymentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + m.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.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) { + m.beginDelete.remove(req) + } + + return resp, nil +} + +func (m *ManagedComputeDeploymentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.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~%@]+)/managedComputeDeployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + deploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, deploymentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.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).ManagedComputeDeployment, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *ManagedComputeDeploymentsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := m.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~%@]+)/managedComputeDeployments` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + resp := m.srv.NewListPager(resourceGroupNameParam, accountNameParam, nil) + newListPager = &resp + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcognitiveservices.ManagedComputeDeploymentsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + m.newListPager.remove(req) + } + return resp, nil +} + +func (m *ManagedComputeDeploymentsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if m.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := m.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~%@]+)/managedComputeDeployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.PatchResourceSKU](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 + } + deploymentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginUpdate(req.Context(), resourceGroupNameParam, accountNameParam, deploymentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + m.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.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) { + m.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ManagedComputeDeploymentsServerTransport +var managedComputeDeploymentsServerTransportInterceptor 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/managedcomputeusagesoperationgroup_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managedcomputeusagesoperationgroup_server.go new file mode 100644 index 000000000000..b495f8cfe43c --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managedcomputeusagesoperationgroup_server.go @@ -0,0 +1,125 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "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/v4" + "net/http" + "net/url" + "regexp" + "slices" +) + +// ManagedComputeUsagesOperationGroupServer is a fake server for instances of the armcognitiveservices.ManagedComputeUsagesOperationGroupClient type. +type ManagedComputeUsagesOperationGroupServer struct { + // NewListPager is the fake for method ManagedComputeUsagesOperationGroupClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(location string, options *armcognitiveservices.ManagedComputeUsagesOperationGroupClientListOptions) (resp azfake.PagerResponder[armcognitiveservices.ManagedComputeUsagesOperationGroupClientListResponse]) +} + +// NewManagedComputeUsagesOperationGroupServerTransport creates a new instance of ManagedComputeUsagesOperationGroupServerTransport with the provided implementation. +// The returned ManagedComputeUsagesOperationGroupServerTransport instance is connected to an instance of armcognitiveservices.ManagedComputeUsagesOperationGroupClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewManagedComputeUsagesOperationGroupServerTransport(srv *ManagedComputeUsagesOperationGroupServer) *ManagedComputeUsagesOperationGroupServerTransport { + return &ManagedComputeUsagesOperationGroupServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcognitiveservices.ManagedComputeUsagesOperationGroupClientListResponse]](), + } +} + +// ManagedComputeUsagesOperationGroupServerTransport connects instances of armcognitiveservices.ManagedComputeUsagesOperationGroupClient to instances of ManagedComputeUsagesOperationGroupServer. +// Don't use this type directly, use NewManagedComputeUsagesOperationGroupServerTransport instead. +type ManagedComputeUsagesOperationGroupServerTransport struct { + srv *ManagedComputeUsagesOperationGroupServer + newListPager *tracker[azfake.PagerResponder[armcognitiveservices.ManagedComputeUsagesOperationGroupClientListResponse]] +} + +// Do implements the policy.Transporter interface for ManagedComputeUsagesOperationGroupServerTransport. +func (m *ManagedComputeUsagesOperationGroupServerTransport) 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 m.dispatchToMethodFake(req, method) +} + +func (m *ManagedComputeUsagesOperationGroupServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if managedComputeUsagesOperationGroupServerTransportInterceptor != nil { + res.resp, res.err, intercepted = managedComputeUsagesOperationGroupServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ManagedComputeUsagesOperationGroupClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (m *ManagedComputeUsagesOperationGroupServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := m.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CognitiveServices/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedComputeUsages` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListPager(locationParam, nil) + newListPager = &resp + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcognitiveservices.ManagedComputeUsagesOperationGroupClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + m.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ManagedComputeUsagesOperationGroupServerTransport +var managedComputeUsagesOperationGroupServerTransportInterceptor 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/managednetworkprovisions_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managednetworkprovisions_server.go index 612c139f8ddd..8df5bc5eafae 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managednetworkprovisions_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managednetworkprovisions_server.go @@ -16,6 +16,7 @@ import ( "net/url" "reflect" "regexp" + "slices" ) // ManagedNetworkProvisionsServer is a fake server for instances of the armcognitiveservices.ManagedNetworkProvisionsClient type. @@ -54,9 +55,7 @@ func (m *ManagedNetworkProvisionsServerTransport) Do(req *http.Request) (*http.R } func (m *ManagedNetworkProvisionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -72,10 +71,7 @@ func (m *ManagedNetworkProvisionsServerTransport) dispatchToMethodFake(req *http } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -133,7 +129,7 @@ func (m *ManagedNetworkProvisionsServerTransport) dispatchBeginProvisionManagedN return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { m.beginProvisionManagedNetwork.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managednetworksettings_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managednetworksettings_server.go index f2f9c146f26e..42c84a7e6a8e 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managednetworksettings_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/managednetworksettings_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ManagedNetworkSettingsServer is a fake server for instances of the armcognitiveservices.ManagedNetworkSettingsClient type. @@ -76,9 +77,7 @@ func (m *ManagedNetworkSettingsServerTransport) Do(req *http.Request) (*http.Res } func (m *ManagedNetworkSettingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -102,10 +101,7 @@ func (m *ManagedNetworkSettingsServerTransport) dispatchToMethodFake(req *http.R } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -153,7 +149,7 @@ func (m *ManagedNetworkSettingsServerTransport) dispatchBeginDelete(req *http.Re return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { m.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -191,7 +187,7 @@ func (m *ManagedNetworkSettingsServerTransport) dispatchGet(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).ManagedNetworkSettingsPropertiesBasicResource, req) @@ -232,7 +228,7 @@ func (m *ManagedNetworkSettingsServerTransport) dispatchNewListPager(req *http.R if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { m.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -283,7 +279,7 @@ func (m *ManagedNetworkSettingsServerTransport) dispatchBeginPatch(req *http.Req return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { m.beginPatch.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -335,7 +331,7 @@ func (m *ManagedNetworkSettingsServerTransport) dispatchBeginPut(req *http.Reque return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { m.beginPut.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/management_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/management_server.go index 9b8043d5400b..07f9e798d850 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/management_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/management_server.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ManagementServer is a fake server for instances of the armcognitiveservices.ManagementClient type. @@ -57,9 +58,7 @@ func (m *ManagementServerTransport) Do(req *http.Request) (*http.Response, error } func (m *ManagementServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -79,10 +78,7 @@ func (m *ManagementServerTransport) dispatchToMethodFake(req *http.Request, meth } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -112,7 +108,7 @@ func (m *ManagementServerTransport) dispatchCalculateModelCapacity(req *http.Req return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).CalculateModelCapacityResult, req) @@ -141,7 +137,7 @@ func (m *ManagementServerTransport) dispatchCheckDomainAvailability(req *http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).DomainAvailability, req) @@ -174,7 +170,7 @@ func (m *ManagementServerTransport) dispatchCheckSKUAvailability(req *http.Reque return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).SKUAvailabilityListResult, req) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/modelcapacities_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/modelcapacities_server.go index 4a99825697ca..9273663f044f 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/modelcapacities_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/modelcapacities_server.go @@ -13,8 +13,8 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices/v4" "net/http" - "net/url" "regexp" + "slices" ) // ModelCapacitiesServer is a fake server for instances of the armcognitiveservices.ModelCapacitiesClient type. @@ -53,9 +53,7 @@ func (m *ModelCapacitiesServerTransport) Do(req *http.Request) (*http.Response, } func (m *ModelCapacitiesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -71,10 +69,7 @@ func (m *ModelCapacitiesServerTransport) dispatchToMethodFake(req *http.Request, } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -98,19 +93,7 @@ func (m *ModelCapacitiesServerTransport) dispatchNewListPager(req *http.Request) return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - modelFormatParam, err := url.QueryUnescape(qp.Get("modelFormat")) - if err != nil { - return nil, err - } - modelNameParam, err := url.QueryUnescape(qp.Get("modelName")) - if err != nil { - return nil, err - } - modelVersionParam, err := url.QueryUnescape(qp.Get("modelVersion")) - if err != nil { - return nil, err - } - resp := m.srv.NewListPager(modelFormatParam, modelNameParam, modelVersionParam, nil) + resp := m.srv.NewListPager(qp.Get("modelFormat"), qp.Get("modelName"), qp.Get("modelVersion"), nil) newListPager = &resp m.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcognitiveservices.ModelCapacitiesClientListResponse, createLink func() string) { @@ -121,7 +104,7 @@ func (m *ModelCapacitiesServerTransport) dispatchNewListPager(req *http.Request) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { m.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/models_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/models_server.go index 19df304ce140..94b17ec31d52 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/models_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/models_server.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ModelsServer is a fake server for instances of the armcognitiveservices.ModelsClient type. @@ -53,9 +54,7 @@ func (m *ModelsServerTransport) Do(req *http.Request) (*http.Response, error) { } func (m *ModelsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -71,10 +70,7 @@ func (m *ModelsServerTransport) dispatchToMethodFake(req *http.Request, method s } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -112,7 +108,7 @@ func (m *ModelsServerTransport) dispatchNewListPager(req *http.Request) (*http.R if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { m.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/networksecurityperimeterconfigurations_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/networksecurityperimeterconfigurations_server.go index f7ef762d3f1c..95559d052eec 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/networksecurityperimeterconfigurations_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/networksecurityperimeterconfigurations_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // NetworkSecurityPerimeterConfigurationsServer is a fake server for instances of the armcognitiveservices.NetworkSecurityPerimeterConfigurationsClient type. @@ -64,9 +65,7 @@ func (n *NetworkSecurityPerimeterConfigurationsServerTransport) Do(req *http.Req } func (n *NetworkSecurityPerimeterConfigurationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -86,10 +85,7 @@ func (n *NetworkSecurityPerimeterConfigurationsServerTransport) dispatchToMethod } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -127,7 +123,7 @@ func (n *NetworkSecurityPerimeterConfigurationsServerTransport) dispatchGet(req return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).NetworkSecurityPerimeterConfiguration, req) @@ -168,7 +164,7 @@ func (n *NetworkSecurityPerimeterConfigurationsServerTransport) dispatchNewListP if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { n.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -215,7 +211,7 @@ func (n *NetworkSecurityPerimeterConfigurationsServerTransport) dispatchBeginRec return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { n.beginReconcile.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/operations_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/operations_server.go index 68497b9585aa..4f8680e17fcc 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/operations_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/operations_server.go @@ -13,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices/v4" "net/http" + "slices" ) // OperationsServer is a fake server for instances of the armcognitiveservices.OperationsClient type. @@ -51,9 +52,7 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -69,10 +68,7 @@ func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, meth } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -100,7 +96,7 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { o.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/outboundrule_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/outboundrule_server.go index 50aa566ebd06..8939bf6b982b 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/outboundrule_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/outboundrule_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // OutboundRuleServer is a fake server for instances of the armcognitiveservices.OutboundRuleClient type. @@ -70,9 +71,7 @@ func (o *OutboundRuleServerTransport) Do(req *http.Request) (*http.Response, err } func (o *OutboundRuleServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -94,10 +93,7 @@ func (o *OutboundRuleServerTransport) dispatchToMethodFake(req *http.Request, me } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -153,7 +149,7 @@ func (o *OutboundRuleServerTransport) dispatchBeginCreateOrUpdate(req *http.Requ return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { o.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -205,7 +201,7 @@ func (o *OutboundRuleServerTransport) dispatchBeginDelete(req *http.Request) (*h return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { o.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -247,7 +243,7 @@ func (o *OutboundRuleServerTransport) dispatchGet(req *http.Request) (*http.Resp return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).OutboundRuleBasicResource, req) @@ -292,7 +288,7 @@ func (o *OutboundRuleServerTransport) dispatchNewListPager(req *http.Request) (* if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { o.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/outboundrules_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/outboundrules_server.go index cc1d83e7a116..96c6619ce1c7 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/outboundrules_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/outboundrules_server.go @@ -15,13 +15,14 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // OutboundRulesServer is a fake server for instances of the armcognitiveservices.OutboundRulesClient type. type OutboundRulesServer struct { // BeginPost is the fake for method OutboundRulesClient.BeginPost // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginPost func(ctx context.Context, resourceGroupName string, accountName string, managedNetworkName string, body armcognitiveservices.ManagedNetworkSettingsBasicResource, options *armcognitiveservices.OutboundRulesClientBeginPostOptions) (resp azfake.PollerResponder[armcognitiveservices.OutboundRulesClientPostResponse], errResp azfake.ErrorResponder) + BeginPost func(ctx context.Context, resourceGroupName string, accountName string, managedNetworkName string, body armcognitiveservices.ManagedNetworkSettingsBasicResource, options *armcognitiveservices.OutboundRulesClientBeginPostOptions) (resp azfake.PollerResponder[azfake.PagerResponder[armcognitiveservices.OutboundRulesClientPostResponse]], errResp azfake.ErrorResponder) } // NewOutboundRulesServerTransport creates a new instance of OutboundRulesServerTransport with the provided implementation. @@ -30,7 +31,7 @@ type OutboundRulesServer struct { func NewOutboundRulesServerTransport(srv *OutboundRulesServer) *OutboundRulesServerTransport { return &OutboundRulesServerTransport{ srv: srv, - beginPost: newTracker[azfake.PollerResponder[armcognitiveservices.OutboundRulesClientPostResponse]](), + beginPost: newTracker[azfake.PollerResponder[azfake.PagerResponder[armcognitiveservices.OutboundRulesClientPostResponse]]](), } } @@ -38,7 +39,7 @@ func NewOutboundRulesServerTransport(srv *OutboundRulesServer) *OutboundRulesSer // Don't use this type directly, use NewOutboundRulesServerTransport instead. type OutboundRulesServerTransport struct { srv *OutboundRulesServer - beginPost *tracker[azfake.PollerResponder[armcognitiveservices.OutboundRulesClientPostResponse]] + beginPost *tracker[azfake.PollerResponder[azfake.PagerResponder[armcognitiveservices.OutboundRulesClientPostResponse]]] } // Do implements the policy.Transporter interface for OutboundRulesServerTransport. @@ -53,9 +54,7 @@ func (o *OutboundRulesServerTransport) Do(req *http.Request) (*http.Response, er } func (o *OutboundRulesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -71,10 +70,7 @@ func (o *OutboundRulesServerTransport) dispatchToMethodFake(req *http.Request, m } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -126,7 +122,7 @@ func (o *OutboundRulesServerTransport) dispatchBeginPost(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { o.beginPost.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privateendpointconnections_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privateendpointconnections_server.go index 6cedc0374d9e..b457b50338c8 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privateendpointconnections_server.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // PrivateEndpointConnectionsServer is a fake server for instances of the armcognitiveservices.PrivateEndpointConnectionsClient type. @@ -67,9 +68,7 @@ func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http } func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -91,10 +90,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *ht } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -146,7 +142,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate( return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { p.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -194,7 +190,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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)} } @@ -232,7 +228,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).PrivateEndpointConnection, req) @@ -265,7 +261,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchList(req *http.Reque return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).PrivateEndpointConnectionListResult, req) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privatelinkresources_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privatelinkresources_server.go index c7ae29e271a7..e3bcc3e086fb 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/privatelinkresources_server.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // PrivateLinkResourcesServer is a fake server for instances of the armcognitiveservices.PrivateLinkResourcesClient type. @@ -49,9 +50,7 @@ func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Respo } func (p *PrivateLinkResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -67,10 +66,7 @@ func (p *PrivateLinkResourcesServerTransport) dispatchToMethodFake(req *http.Req } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -104,7 +100,7 @@ func (p *PrivateLinkResourcesServerTransport) dispatchList(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).PrivateLinkResourceListResult, req) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectcapabilityhosts_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectcapabilityhosts_server.go index b4b0dfdafc7e..a91fb9029d7a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectcapabilityhosts_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectcapabilityhosts_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ProjectCapabilityHostsServer is a fake server for instances of the armcognitiveservices.ProjectCapabilityHostsClient type. @@ -70,9 +71,7 @@ func (p *ProjectCapabilityHostsServerTransport) Do(req *http.Request) (*http.Res } func (p *ProjectCapabilityHostsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -94,10 +93,7 @@ func (p *ProjectCapabilityHostsServerTransport) dispatchToMethodFake(req *http.R } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -153,7 +149,7 @@ func (p *ProjectCapabilityHostsServerTransport) dispatchBeginCreateOrUpdate(req return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.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)} } @@ -205,7 +201,7 @@ func (p *ProjectCapabilityHostsServerTransport) dispatchBeginDelete(req *http.Re return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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)} } @@ -247,7 +243,7 @@ func (p *ProjectCapabilityHostsServerTransport) dispatchGet(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).ProjectCapabilityHost, req) @@ -292,7 +288,7 @@ func (p *ProjectCapabilityHostsServerTransport) dispatchNewListPager(req *http.R if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectconnections_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectconnections_server.go index a9dd57df0e7c..a477eaa2549b 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectconnections_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projectconnections_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" "strconv" ) @@ -71,9 +72,7 @@ func (p *ProjectConnectionsServerTransport) Do(req *http.Request) (*http.Respons } func (p *ProjectConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -97,10 +96,7 @@ func (p *ProjectConnectionsServerTransport) dispatchToMethodFake(req *http.Reque } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -146,7 +142,7 @@ func (p *ProjectConnectionsServerTransport) dispatchCreate(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -187,7 +183,7 @@ func (p *ProjectConnectionsServerTransport) dispatchDelete(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.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) @@ -228,7 +224,7 @@ func (p *ProjectConnectionsServerTransport) dispatchGet(req *http.Request) (*htt return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -263,21 +259,9 @@ func (p *ProjectConnectionsServerTransport) dispatchNewListPager(req *http.Reque 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) + targetParam := getOptional(qp.Get("target")) + categoryParam := getOptional(qp.Get("category")) + includeAllParam, err := parseOptional(qp.Get("includeAll"), strconv.ParseBool) if err != nil { return nil, err } @@ -300,7 +284,7 @@ func (p *ProjectConnectionsServerTransport) dispatchNewListPager(req *http.Reque if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -345,7 +329,7 @@ func (p *ProjectConnectionsServerTransport) dispatchUpdate(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projects_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projects_server.go index e5bbcfbeaae0..c32014d2b1ad 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projects_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/projects_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ProjectsServer is a fake server for instances of the armcognitiveservices.ProjectsClient type. @@ -76,9 +77,7 @@ func (p *ProjectsServerTransport) Do(req *http.Request) (*http.Response, error) } func (p *ProjectsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -102,10 +101,7 @@ func (p *ProjectsServerTransport) dispatchToMethodFake(req *http.Request, method } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -157,7 +153,7 @@ func (p *ProjectsServerTransport) dispatchBeginCreate(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.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)} } @@ -205,7 +201,7 @@ func (p *ProjectsServerTransport) dispatchBeginDelete(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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)} } @@ -243,7 +239,7 @@ func (p *ProjectsServerTransport) dispatchGet(req *http.Request) (*http.Response return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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) @@ -284,7 +280,7 @@ func (p *ProjectsServerTransport) dispatchNewListPager(req *http.Request) (*http if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.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)} } @@ -335,7 +331,7 @@ func (p *ProjectsServerTransport) dispatchBeginUpdate(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.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)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/quotatiers_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/quotatiers_server.go index da7f1d426241..0b89b3134b8c 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/quotatiers_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/quotatiers_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // QuotaTiersServer is a fake server for instances of the armcognitiveservices.QuotaTiersClient type. @@ -66,9 +67,7 @@ func (q *QuotaTiersServerTransport) Do(req *http.Request) (*http.Response, error } func (q *QuotaTiersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -90,10 +89,7 @@ func (q *QuotaTiersServerTransport) dispatchToMethodFake(req *http.Request, meth } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -127,7 +123,7 @@ func (q *QuotaTiersServerTransport) dispatchCreateOrUpdate(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).QuotaTier, req) @@ -156,7 +152,7 @@ func (q *QuotaTiersServerTransport) dispatchGet(req *http.Request) (*http.Respon return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).QuotaTier, req) @@ -189,7 +185,7 @@ func (q *QuotaTiersServerTransport) dispatchNewListBySubscriptionPager(req *http if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { q.newListBySubscriptionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -222,7 +218,7 @@ func (q *QuotaTiersServerTransport) dispatchUpdate(req *http.Request) (*http.Res return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).QuotaTier, req) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklistitems_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklistitems_server.go index 590610926960..fc6bdd0a4bc2 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklistitems_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklistitems_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // RaiBlocklistItemsServer is a fake server for instances of the armcognitiveservices.RaiBlocklistItemsClient type. @@ -76,9 +77,7 @@ func (r *RaiBlocklistItemsServerTransport) Do(req *http.Request) (*http.Response } func (r *RaiBlocklistItemsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -104,10 +103,7 @@ func (r *RaiBlocklistItemsServerTransport) dispatchToMethodFake(req *http.Reques } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -149,7 +145,7 @@ func (r *RaiBlocklistItemsServerTransport) dispatchBatchAdd(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).RaiBlocklist, req) @@ -190,7 +186,7 @@ func (r *RaiBlocklistItemsServerTransport) dispatchBatchDelete(req *http.Request return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -235,7 +231,7 @@ func (r *RaiBlocklistItemsServerTransport) dispatchCreateOrUpdate(req *http.Requ return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RaiBlocklistItem, req) @@ -286,7 +282,7 @@ func (r *RaiBlocklistItemsServerTransport) dispatchBeginDelete(req *http.Request return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -328,7 +324,7 @@ func (r *RaiBlocklistItemsServerTransport) dispatchGet(req *http.Request) (*http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).RaiBlocklistItem, req) @@ -373,7 +369,7 @@ func (r *RaiBlocklistItemsServerTransport) dispatchNewListPager(req *http.Reques if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { r.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklists_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklists_server.go index 47e9f62d1d3c..8eb4496497ec 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklists_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiblocklists_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // RaiBlocklistsServer is a fake server for instances of the armcognitiveservices.RaiBlocklistsClient type. @@ -68,9 +69,7 @@ func (r *RaiBlocklistsServerTransport) Do(req *http.Request) (*http.Response, er } func (r *RaiBlocklistsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -92,10 +91,7 @@ func (r *RaiBlocklistsServerTransport) dispatchToMethodFake(req *http.Request, m } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -137,7 +133,7 @@ func (r *RaiBlocklistsServerTransport) dispatchCreateOrUpdate(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RaiBlocklist, req) @@ -184,7 +180,7 @@ func (r *RaiBlocklistsServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -222,7 +218,7 @@ func (r *RaiBlocklistsServerTransport) dispatchGet(req *http.Request) (*http.Res return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).RaiBlocklist, req) @@ -263,7 +259,7 @@ func (r *RaiBlocklistsServerTransport) dispatchNewListPager(req *http.Request) ( if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { r.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raicontentfilters_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raicontentfilters_server.go index 26619ea92615..5f017bb7e81b 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raicontentfilters_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raicontentfilters_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // RaiContentFiltersServer is a fake server for instances of the armcognitiveservices.RaiContentFiltersClient type. @@ -58,9 +59,7 @@ func (r *RaiContentFiltersServerTransport) Do(req *http.Request) (*http.Response } func (r *RaiContentFiltersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -78,10 +77,7 @@ func (r *RaiContentFiltersServerTransport) dispatchToMethodFake(req *http.Reques } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -115,7 +111,7 @@ func (r *RaiContentFiltersServerTransport) dispatchGet(req *http.Request) (*http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).RaiContentFilter, req) @@ -152,7 +148,7 @@ func (r *RaiContentFiltersServerTransport) dispatchNewListPager(req *http.Reques if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { r.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiexternalsafetyprovider_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiexternalsafetyprovider_server.go index 3c45526547f9..247afc1f1f64 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiexternalsafetyprovider_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiexternalsafetyprovider_server.go @@ -15,14 +15,13 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // RaiExternalSafetyProviderServer is a fake server for instances of the armcognitiveservices.RaiExternalSafetyProviderClient type. type RaiExternalSafetyProviderServer struct { // CreateOrUpdate is the fake for method RaiExternalSafetyProviderClient.CreateOrUpdate - // HTTP status codes to indicate success: - // - http.StatusOK (returns armcognitiveservices.RaiExternalSafetyProviderSchema) - // - http.StatusCreated (returns armcognitiveservices.RaiExternalSafetyProvider) + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated CreateOrUpdate func(ctx context.Context, safetyProviderName string, safetyProvider armcognitiveservices.RaiExternalSafetyProviderSchema, options *armcognitiveservices.RaiExternalSafetyProviderClientCreateOrUpdateOptions) (resp azfake.Responder[armcognitiveservices.RaiExternalSafetyProviderClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method RaiExternalSafetyProviderClient.BeginDelete @@ -63,9 +62,7 @@ func (r *RaiExternalSafetyProviderServerTransport) Do(req *http.Request) (*http. } func (r *RaiExternalSafetyProviderServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -85,10 +82,7 @@ func (r *RaiExternalSafetyProviderServerTransport) dispatchToMethodFake(req *htt } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -122,10 +116,10 @@ func (r *RaiExternalSafetyProviderServerTransport) dispatchCreateOrUpdate(req *h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Value, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RaiExternalSafetyProviderSchema, req) if err != nil { return nil, err } @@ -161,7 +155,7 @@ func (r *RaiExternalSafetyProviderServerTransport) dispatchBeginDelete(req *http return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -191,7 +185,7 @@ func (r *RaiExternalSafetyProviderServerTransport) dispatchGet(req *http.Request return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).RaiExternalSafetyProviderSchema, req) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiexternalsafetyproviders_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiexternalsafetyproviders_server.go index 1b4c2420d8c8..7034abfd11f1 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiexternalsafetyproviders_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raiexternalsafetyproviders_server.go @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices/v4" "net/http" "regexp" + "slices" ) // RaiExternalSafetyProvidersServer is a fake server for instances of the armcognitiveservices.RaiExternalSafetyProvidersClient type. @@ -52,9 +53,7 @@ func (r *RaiExternalSafetyProvidersServerTransport) Do(req *http.Request) (*http } func (r *RaiExternalSafetyProvidersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -70,10 +69,7 @@ func (r *RaiExternalSafetyProvidersServerTransport) dispatchToMethodFake(req *ht } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -107,7 +103,7 @@ func (r *RaiExternalSafetyProvidersServerTransport) dispatchNewListPager(req *ht if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { r.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raipolicies_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raipolicies_server.go index 7ac196ac96d1..3611559cb8cc 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raipolicies_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raipolicies_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // RaiPoliciesServer is a fake server for instances of the armcognitiveservices.RaiPoliciesClient type. @@ -68,9 +69,7 @@ func (r *RaiPoliciesServerTransport) Do(req *http.Request) (*http.Response, erro } func (r *RaiPoliciesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -92,10 +91,7 @@ func (r *RaiPoliciesServerTransport) dispatchToMethodFake(req *http.Request, met } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -137,7 +133,7 @@ func (r *RaiPoliciesServerTransport) dispatchCreateOrUpdate(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RaiPolicy, req) @@ -184,7 +180,7 @@ func (r *RaiPoliciesServerTransport) dispatchBeginDelete(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -222,7 +218,7 @@ func (r *RaiPoliciesServerTransport) dispatchGet(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).RaiPolicy, req) @@ -263,7 +259,7 @@ func (r *RaiPoliciesServerTransport) dispatchNewListPager(req *http.Request) (*h if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { r.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raitoollabels_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raitoollabels_server.go index c6a7d4bb91ad..8f6a3d65cb01 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raitoollabels_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raitoollabels_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // RaiToolLabelsServer is a fake server for instances of the armcognitiveservices.RaiToolLabelsClient type. @@ -68,9 +69,7 @@ func (r *RaiToolLabelsServerTransport) Do(req *http.Request) (*http.Response, er } func (r *RaiToolLabelsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -92,10 +91,7 @@ func (r *RaiToolLabelsServerTransport) dispatchToMethodFake(req *http.Request, m } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -137,7 +133,7 @@ func (r *RaiToolLabelsServerTransport) dispatchCreateOrUpdate(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RaiToolLabel, req) @@ -184,7 +180,7 @@ func (r *RaiToolLabelsServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -222,7 +218,7 @@ func (r *RaiToolLabelsServerTransport) dispatchGet(req *http.Request) (*http.Res return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).RaiToolLabel, req) @@ -263,7 +259,7 @@ func (r *RaiToolLabelsServerTransport) dispatchNewListPager(req *http.Request) ( if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { r.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raitopics_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raitopics_server.go index 18bd50e657dd..a1f670db845e 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raitopics_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/raitopics_server.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // RaiTopicsServer is a fake server for instances of the armcognitiveservices.RaiTopicsClient type. @@ -68,9 +69,7 @@ func (r *RaiTopicsServerTransport) Do(req *http.Request) (*http.Response, error) } func (r *RaiTopicsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -92,10 +91,7 @@ func (r *RaiTopicsServerTransport) dispatchToMethodFake(req *http.Request, metho } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -137,7 +133,7 @@ func (r *RaiTopicsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RaiTopic, req) @@ -184,7 +180,7 @@ func (r *RaiTopicsServerTransport) dispatchBeginDelete(req *http.Request) (*http return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.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.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -222,7 +218,7 @@ func (r *RaiTopicsServerTransport) dispatchGet(req *http.Request) (*http.Respons return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).RaiTopic, req) @@ -263,7 +259,7 @@ func (r *RaiTopicsServerTransport) dispatchNewListPager(req *http.Request) (*htt if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { r.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/resourceskus_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/resourceskus_server.go index 523d2a201fb8..78eb2276a947 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/resourceskus_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/resourceskus_server.go @@ -14,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices/v4" "net/http" "regexp" + "slices" ) // ResourceSKUsServer is a fake server for instances of the armcognitiveservices.ResourceSKUsClient type. @@ -52,9 +53,7 @@ func (r *ResourceSKUsServerTransport) Do(req *http.Request) (*http.Response, err } func (r *ResourceSKUsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -70,10 +69,7 @@ func (r *ResourceSKUsServerTransport) dispatchToMethodFake(req *http.Request, me } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -107,7 +103,7 @@ func (r *ResourceSKUsServerTransport) dispatchNewListPager(req *http.Request) (* if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { r.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/server_factory.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/server_factory.go index b338d967b3ee..215f4eddc813 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/server_factory.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/server_factory.go @@ -39,6 +39,9 @@ type ServerFactory struct { // ComputeOperationsServer contains the fakes for client ComputeOperationsClient ComputeOperationsServer ComputeOperationsServer + // ComputesServer contains the fakes for client ComputesClient + ComputesServer ComputesServer + // DefenderForAISettingsServer contains the fakes for client DefenderForAISettingsClient DefenderForAISettingsServer DefenderForAISettingsServer @@ -54,6 +57,15 @@ type ServerFactory struct { // LocationBasedModelCapacitiesServer contains the fakes for client LocationBasedModelCapacitiesClient LocationBasedModelCapacitiesServer LocationBasedModelCapacitiesServer + // ManagedComputeCapacitiesServer contains the fakes for client ManagedComputeCapacitiesClient + ManagedComputeCapacitiesServer ManagedComputeCapacitiesServer + + // ManagedComputeDeploymentsServer contains the fakes for client ManagedComputeDeploymentsClient + ManagedComputeDeploymentsServer ManagedComputeDeploymentsServer + + // ManagedComputeUsagesOperationGroupServer contains the fakes for client ManagedComputeUsagesOperationGroupClient + ManagedComputeUsagesOperationGroupServer ManagedComputeUsagesOperationGroupServer + // ManagedNetworkProvisionsServer contains the fakes for client ManagedNetworkProvisionsClient ManagedNetworkProvisionsServer ManagedNetworkProvisionsServer @@ -134,6 +146,9 @@ type ServerFactory struct { // UsagesServer contains the fakes for client UsagesClient UsagesServer UsagesServer + + // WorkbenchesServer contains the fakes for client WorkbenchesClient + WorkbenchesServer WorkbenchesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -158,11 +173,15 @@ type ServerFactoryTransport struct { trCommitmentPlansServer *CommitmentPlansServerTransport trCommitmentTiersServer *CommitmentTiersServerTransport trComputeOperationsServer *ComputeOperationsServerTransport + trComputesServer *ComputesServerTransport trDefenderForAISettingsServer *DefenderForAISettingsServerTransport trDeletedAccountsServer *DeletedAccountsServerTransport trDeploymentsServer *DeploymentsServerTransport trEncryptionScopesServer *EncryptionScopesServerTransport trLocationBasedModelCapacitiesServer *LocationBasedModelCapacitiesServerTransport + trManagedComputeCapacitiesServer *ManagedComputeCapacitiesServerTransport + trManagedComputeDeploymentsServer *ManagedComputeDeploymentsServerTransport + trManagedComputeUsagesOperationGroupServer *ManagedComputeUsagesOperationGroupServerTransport trManagedNetworkProvisionsServer *ManagedNetworkProvisionsServerTransport trManagedNetworkSettingsServer *ManagedNetworkSettingsServerTransport trManagementServer *ManagementServerTransport @@ -190,6 +209,7 @@ type ServerFactoryTransport struct { trSubscriptionRaiPolicyServer *SubscriptionRaiPolicyServerTransport trTestRaiExternalSafetyProviderServer *TestRaiExternalSafetyProviderServerTransport trUsagesServer *UsagesServerTransport + trWorkbenchesServer *WorkbenchesServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -243,6 +263,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewComputeOperationsServerTransport(&s.srv.ComputeOperationsServer) }) resp, err = s.trComputeOperationsServer.Do(req) + case "ComputesClient": + initServer(&s.trMu, &s.trComputesServer, func() *ComputesServerTransport { return NewComputesServerTransport(&s.srv.ComputesServer) }) + resp, err = s.trComputesServer.Do(req) case "DefenderForAISettingsClient": initServer(&s.trMu, &s.trDefenderForAISettingsServer, func() *DefenderForAISettingsServerTransport { return NewDefenderForAISettingsServerTransport(&s.srv.DefenderForAISettingsServer) @@ -266,6 +289,21 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewLocationBasedModelCapacitiesServerTransport(&s.srv.LocationBasedModelCapacitiesServer) }) resp, err = s.trLocationBasedModelCapacitiesServer.Do(req) + case "ManagedComputeCapacitiesClient": + initServer(&s.trMu, &s.trManagedComputeCapacitiesServer, func() *ManagedComputeCapacitiesServerTransport { + return NewManagedComputeCapacitiesServerTransport(&s.srv.ManagedComputeCapacitiesServer) + }) + resp, err = s.trManagedComputeCapacitiesServer.Do(req) + case "ManagedComputeDeploymentsClient": + initServer(&s.trMu, &s.trManagedComputeDeploymentsServer, func() *ManagedComputeDeploymentsServerTransport { + return NewManagedComputeDeploymentsServerTransport(&s.srv.ManagedComputeDeploymentsServer) + }) + resp, err = s.trManagedComputeDeploymentsServer.Do(req) + case "ManagedComputeUsagesOperationGroupClient": + initServer(&s.trMu, &s.trManagedComputeUsagesOperationGroupServer, func() *ManagedComputeUsagesOperationGroupServerTransport { + return NewManagedComputeUsagesOperationGroupServerTransport(&s.srv.ManagedComputeUsagesOperationGroupServer) + }) + resp, err = s.trManagedComputeUsagesOperationGroupServer.Do(req) case "ManagedNetworkProvisionsClient": initServer(&s.trMu, &s.trManagedNetworkProvisionsServer, func() *ManagedNetworkProvisionsServerTransport { return NewManagedNetworkProvisionsServerTransport(&s.srv.ManagedNetworkProvisionsServer) @@ -381,6 +419,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "UsagesClient": initServer(&s.trMu, &s.trUsagesServer, func() *UsagesServerTransport { return NewUsagesServerTransport(&s.srv.UsagesServer) }) resp, err = s.trUsagesServer.Do(req) + case "WorkbenchesClient": + initServer(&s.trMu, &s.trWorkbenchesServer, func() *WorkbenchesServerTransport { return NewWorkbenchesServerTransport(&s.srv.WorkbenchesServer) }) + resp, err = s.trWorkbenchesServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/subscriptionraipolicy_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/subscriptionraipolicy_server.go index f9f55a3b8d7c..3a814164eaeb 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/subscriptionraipolicy_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/subscriptionraipolicy_server.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // SubscriptionRaiPolicyServer is a fake server for instances of the armcognitiveservices.SubscriptionRaiPolicyClient type. @@ -61,9 +62,7 @@ func (s *SubscriptionRaiPolicyServerTransport) Do(req *http.Request) (*http.Resp } func (s *SubscriptionRaiPolicyServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -83,10 +82,7 @@ func (s *SubscriptionRaiPolicyServerTransport) dispatchToMethodFake(req *http.Re } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -120,7 +116,7 @@ func (s *SubscriptionRaiPolicyServerTransport) dispatchCreateOrUpdate(req *http. return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RaiPolicy, req) @@ -159,7 +155,7 @@ func (s *SubscriptionRaiPolicyServerTransport) dispatchBeginDelete(req *http.Req return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -189,7 +185,7 @@ func (s *SubscriptionRaiPolicyServerTransport) dispatchGet(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.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).RaiPolicy, req) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/testraiexternalsafetyprovider_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/testraiexternalsafetyprovider_server.go index d777858f73cd..d78c075a1393 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/testraiexternalsafetyprovider_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/testraiexternalsafetyprovider_server.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // TestRaiExternalSafetyProviderServer is a fake server for instances of the armcognitiveservices.TestRaiExternalSafetyProviderClient type. @@ -49,9 +50,7 @@ func (t *TestRaiExternalSafetyProviderServerTransport) Do(req *http.Request) (*h } func (t *TestRaiExternalSafetyProviderServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -67,10 +66,7 @@ func (t *TestRaiExternalSafetyProviderServerTransport) dispatchToMethodFake(req } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -112,7 +108,7 @@ func (t *TestRaiExternalSafetyProviderServerTransport) dispatchCreateOrUpdate(re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RaiExternalSafetyProviderSchema, req) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/usages_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/usages_server.go index 891347334f47..63d312b5e47d 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/usages_server.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/usages_server.go @@ -15,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // UsagesServer is a fake server for instances of the armcognitiveservices.UsagesClient type. @@ -53,9 +54,7 @@ func (u *UsagesServerTransport) Do(req *http.Request) (*http.Response, error) { } func (u *UsagesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - resultChan := make(chan result) - defer close(resultChan) - + resultChan := make(chan result, 1) go func() { var intercepted bool var res result @@ -71,10 +70,7 @@ func (u *UsagesServerTransport) dispatchToMethodFake(req *http.Request, method s } } - select { - case resultChan <- res: - case <-req.Context().Done(): - } + resultChan <- res }() select { @@ -102,11 +98,7 @@ func (u *UsagesServerTransport) dispatchNewListPager(req *http.Request) (*http.R if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) + filterParam := getOptional(qp.Get("$filter")) var options *armcognitiveservices.UsagesClientListOptions if filterParam != nil { options = &armcognitiveservices.UsagesClientListOptions{ @@ -124,7 +116,7 @@ func (u *UsagesServerTransport) dispatchNewListPager(req *http.Request) (*http.R if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { u.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/workbenches_server.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/workbenches_server.go new file mode 100644 index 000000000000..f4f2a2b394ae --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/fake/workbenches_server.go @@ -0,0 +1,549 @@ +// 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) Go Code Generator. DO NOT EDIT. + +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/v4" + "net/http" + "net/url" + "regexp" + "slices" +) + +// WorkbenchesServer is a fake server for instances of the armcognitiveservices.WorkbenchesClient type. +type WorkbenchesServer struct { + // BeginCreateOrUpdate is the fake for method WorkbenchesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, resource armcognitiveservices.Workbench, options *armcognitiveservices.WorkbenchesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcognitiveservices.WorkbenchesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method WorkbenchesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *armcognitiveservices.WorkbenchesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcognitiveservices.WorkbenchesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method WorkbenchesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *armcognitiveservices.WorkbenchesClientGetOptions) (resp azfake.Responder[armcognitiveservices.WorkbenchesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method WorkbenchesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, accountName string, projectName string, options *armcognitiveservices.WorkbenchesClientListOptions) (resp azfake.PagerResponder[armcognitiveservices.WorkbenchesClientListResponse]) + + // BeginRestart is the fake for method WorkbenchesClient.BeginRestart + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginRestart func(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *armcognitiveservices.WorkbenchesClientBeginRestartOptions) (resp azfake.PollerResponder[armcognitiveservices.WorkbenchesClientRestartResponse], errResp azfake.ErrorResponder) + + // BeginStart is the fake for method WorkbenchesClient.BeginStart + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginStart func(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *armcognitiveservices.WorkbenchesClientBeginStartOptions) (resp azfake.PollerResponder[armcognitiveservices.WorkbenchesClientStartResponse], errResp azfake.ErrorResponder) + + // BeginStop is the fake for method WorkbenchesClient.BeginStop + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginStop func(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *armcognitiveservices.WorkbenchesClientBeginStopOptions) (resp azfake.PollerResponder[armcognitiveservices.WorkbenchesClientStopResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method WorkbenchesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, properties armcognitiveservices.Workbench, options *armcognitiveservices.WorkbenchesClientBeginUpdateOptions) (resp azfake.PollerResponder[armcognitiveservices.WorkbenchesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewWorkbenchesServerTransport creates a new instance of WorkbenchesServerTransport with the provided implementation. +// The returned WorkbenchesServerTransport instance is connected to an instance of armcognitiveservices.WorkbenchesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewWorkbenchesServerTransport(srv *WorkbenchesServer) *WorkbenchesServerTransport { + return &WorkbenchesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcognitiveservices.WorkbenchesClientListResponse]](), + beginRestart: newTracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientRestartResponse]](), + beginStart: newTracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientStartResponse]](), + beginStop: newTracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientStopResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientUpdateResponse]](), + } +} + +// WorkbenchesServerTransport connects instances of armcognitiveservices.WorkbenchesClient to instances of WorkbenchesServer. +// Don't use this type directly, use NewWorkbenchesServerTransport instead. +type WorkbenchesServerTransport struct { + srv *WorkbenchesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armcognitiveservices.WorkbenchesClientListResponse]] + beginRestart *tracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientRestartResponse]] + beginStart *tracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientStartResponse]] + beginStop *tracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientStopResponse]] + beginUpdate *tracker[azfake.PollerResponder[armcognitiveservices.WorkbenchesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for WorkbenchesServerTransport. +func (w *WorkbenchesServerTransport) 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 w.dispatchToMethodFake(req, method) +} + +func (w *WorkbenchesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if workbenchesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = workbenchesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "WorkbenchesClient.BeginCreateOrUpdate": + res.resp, res.err = w.dispatchBeginCreateOrUpdate(req) + case "WorkbenchesClient.BeginDelete": + res.resp, res.err = w.dispatchBeginDelete(req) + case "WorkbenchesClient.Get": + res.resp, res.err = w.dispatchGet(req) + case "WorkbenchesClient.NewListPager": + res.resp, res.err = w.dispatchNewListPager(req) + case "WorkbenchesClient.BeginRestart": + res.resp, res.err = w.dispatchBeginRestart(req) + case "WorkbenchesClient.BeginStart": + res.resp, res.err = w.dispatchBeginStart(req) + case "WorkbenchesClient.BeginStop": + res.resp, res.err = w.dispatchBeginStop(req) + case "WorkbenchesClient.BeginUpdate": + res.resp, res.err = w.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (w *WorkbenchesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if w.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := w.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~%@]+)/workbenches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.Workbench](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 + } + workbenchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workbenchName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, workbenchNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + w.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + w.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) { + w.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (w *WorkbenchesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if w.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := w.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~%@]+)/workbenches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 6 { + 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 + } + workbenchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workbenchName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, workbenchNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + w.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + w.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) { + w.beginDelete.remove(req) + } + + return resp, nil +} + +func (w *WorkbenchesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if w.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~%@]+)/workbenches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 6 { + 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 + } + workbenchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workbenchName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, workbenchNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.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).Workbench, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WorkbenchesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if w.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := w.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~%@]+)/workbenches` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + resp := w.srv.NewListPager(resourceGroupNameParam, accountNameParam, projectNameParam, nil) + newListPager = &resp + w.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcognitiveservices.WorkbenchesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + w.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + w.newListPager.remove(req) + } + return resp, nil +} + +func (w *WorkbenchesServerTransport) dispatchBeginRestart(req *http.Request) (*http.Response, error) { + if w.srv.BeginRestart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRestart not implemented")} + } + beginRestart := w.beginRestart.get(req) + if beginRestart == 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~%@]+)/workbenches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restart` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 6 { + 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 + } + workbenchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workbenchName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginRestart(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, workbenchNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRestart = &respr + w.beginRestart.add(req, beginRestart) + } + + resp, err := server.PollerResponderNext(beginRestart, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + w.beginRestart.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(beginRestart) { + w.beginRestart.remove(req) + } + + return resp, nil +} + +func (w *WorkbenchesServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { + if w.srv.BeginStart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} + } + beginStart := w.beginStart.get(req) + if beginStart == 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~%@]+)/workbenches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 6 { + 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 + } + workbenchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workbenchName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginStart(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, workbenchNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginStart = &respr + w.beginStart.add(req, beginStart) + } + + resp, err := server.PollerResponderNext(beginStart, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + w.beginStart.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(beginStart) { + w.beginStart.remove(req) + } + + return resp, nil +} + +func (w *WorkbenchesServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { + if w.srv.BeginStop == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} + } + beginStop := w.beginStop.get(req) + if beginStop == 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~%@]+)/workbenches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 6 { + 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 + } + workbenchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workbenchName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginStop(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, workbenchNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginStop = &respr + w.beginStop.add(req, beginStop) + } + + resp, err := server.PollerResponderNext(beginStop, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + w.beginStop.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(beginStop) { + w.beginStop.remove(req) + } + + return resp, nil +} + +func (w *WorkbenchesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if w.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := w.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~%@]+)/workbenches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcognitiveservices.Workbench](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 + } + workbenchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workbenchName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginUpdate(req.Context(), resourceGroupNameParam, accountNameParam, projectNameParam, workbenchNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + w.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + w.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) { + w.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to WorkbenchesServerTransport +var workbenchesServerTransportInterceptor 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 0780b62204f2..649f959acd9f 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod @@ -3,19 +3,19 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/a go 1.25.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.7.0 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // 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.49.0 // indirect - golang.org/x/net v0.52.0 // indirect - golang.org/x/sys v0.42.0 // indirect - golang.org/x/text v0.35.0 // indirect + golang.org/x/crypto v0.50.0 // indirect + golang.org/x/net v0.53.0 // indirect + golang.org/x/sys v0.43.0 // indirect + golang.org/x/text v0.36.0 // indirect ) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum index 39dc1cef1d34..8811f5b1cf99 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum @@ -1,11 +1,11 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 h1:fou+2+WFTib47nS+nz/ozhEBnvU96bKHy6LjRsY4E28= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0/go.mod h1:t76Ruy8AHvUAC8GfMWJMa0ElSbuIcO03NLpynfbgsPA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 h1:jHb/wfvRikGdxMXYV3QG/SzUOPYN9KEUUuC0Yd0/vC0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1/go.mod h1:pzBXCYn05zvYIrwLgtK8Ap8QcjRg+0i76tMQdWN6wOk= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 h1:Hk5QBxZQC1jb2Fwj6mpzme37xbCDdNTxU7O9eb5+LB4= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1/go.mod h1:IYus9qsFobWIc2YVwe/WPjcnyCkPKtnHAqUYeebc8z0= 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.11.2 h1:9iefClla7iYpfYWdzPCRDozdmndjTm8DXdpCzPajMgA= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2/go.mod h1:XtLgD3ZD34DAaVIIAyG3objl5DynM3CQ/vMcbBNJZGI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0/go.mod h1:7dCRMLwisfRH3dBupKeNCioWYUZ4SS09Z14H+7i8ZoY= 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.7.0 h1:4iB+IesclUXdP0ICgAabvq2FYLXrJWKx1fJQ+GxSo3Y= @@ -26,14 +26,14 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= -golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= -golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= -golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= +golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= +golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= +golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= +golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= -golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/interfaces.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/interfaces.go index b4b8632d044a..cc369100f7c6 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/interfaces.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/interfaces.go @@ -23,6 +23,15 @@ type ApplicationAuthorizationPolicyClassification interface { GetApplicationAuthorizationPolicy() *ApplicationAuthorizationPolicy } +// ComputePropertiesClassification provides polymorphic access to related types. +// Call the interface's GetComputeProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ClusterComputeProperties, *ComputeProperties, *ContainerInstanceComputeProperties +type ComputePropertiesClassification interface { + // GetComputeProperties returns the ComputeProperties content of the underlying type. + GetComputeProperties() *ComputeProperties +} + // 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: diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client.go index 74c2947d8fbd..8f41045518a0 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client.go @@ -18,6 +18,8 @@ import ( // LocationBasedModelCapacitiesClient contains the methods for the LocationBasedModelCapacities group. // Don't use this type directly, use NewLocationBasedModelCapacitiesClient() instead. +// +// Generated from API version 2026-03-15-preview type LocationBasedModelCapacitiesClient struct { internal *arm.Client subscriptionID string @@ -40,8 +42,6 @@ func NewLocationBasedModelCapacitiesClient(subscriptionID string, credential azc } // NewListPager - List Location Based ModelCapacities. -// -// Generated from API version 2026-01-15-preview // - location - The location name. // - modelFormat - The format of the Model // - modelName - The name of the Model @@ -87,11 +87,11 @@ func (client *LocationBasedModelCapacitiesClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") + reqQP.Set("api-version", version20260315Preview) reqQP.Set("modelFormat", modelFormat) reqQP.Set("modelName", modelName) reqQP.Set("modelVersion", modelVersion) - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client_example_test.go index 60ffa26ec604..0fb5160ad8a0 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/locationbasedmodelcapacities_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ListLocationBasedModelCapacities.json +// Generated from example definition: 2026-03-15-preview/ListLocationBasedModelCapacities.json func ExampleLocationBasedModelCapacitiesClient_NewListPager_listLocationBasedModelCapacities() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -60,7 +60,7 @@ func ExampleLocationBasedModelCapacitiesClient_NewListPager_listLocationBasedMod } } -// Generated from example definition: 2026-01-15-preview/ListLocationBasedModelCapacitiesClassicScope.json +// Generated from example definition: 2026-03-15-preview/ListLocationBasedModelCapacitiesClassicScope.json func ExampleLocationBasedModelCapacitiesClient_NewListPager_listLocationBasedModelCapacitiesClassicScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -108,7 +108,7 @@ func ExampleLocationBasedModelCapacitiesClient_NewListPager_listLocationBasedMod } } -// Generated from example definition: 2026-01-15-preview/ListLocationBasedModelCapacitiesDataZoneScope.json +// Generated from example definition: 2026-03-15-preview/ListLocationBasedModelCapacitiesDataZoneScope.json func ExampleLocationBasedModelCapacitiesClient_NewListPager_listLocationBasedModelCapacitiesDataZoneScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -157,7 +157,7 @@ func ExampleLocationBasedModelCapacitiesClient_NewListPager_listLocationBasedMod } } -// Generated from example definition: 2026-01-15-preview/ListLocationBasedModelCapacitiesGlobalScope.json +// Generated from example definition: 2026-03-15-preview/ListLocationBasedModelCapacitiesGlobalScope.json func ExampleLocationBasedModelCapacitiesClient_NewListPager_listLocationBasedModelCapacitiesGlobalScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputecapacities_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputecapacities_client.go new file mode 100644 index 000000000000..7cd84f999f85 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputecapacities_client.go @@ -0,0 +1,104 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcognitiveservices + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedComputeCapacitiesClient contains the methods for the ManagedComputeCapacities group. +// Don't use this type directly, use NewManagedComputeCapacitiesClient() instead. +// +// Generated from API version 2026-03-15-preview +type ManagedComputeCapacitiesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedComputeCapacitiesClient creates a new instance of ManagedComputeCapacitiesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewManagedComputeCapacitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedComputeCapacitiesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedComputeCapacitiesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets the managed compute capacities for a subscription. Returns available capacity +// per accelerator type, including deployment size information. +// - offer - The offer name to query capacity for (required). +// - options - ManagedComputeCapacitiesClientListOptions contains the optional parameters for the ManagedComputeCapacitiesClient.NewListPager +// method. +func (client *ManagedComputeCapacitiesClient) NewListPager(offer string, options *ManagedComputeCapacitiesClientListOptions) *runtime.Pager[ManagedComputeCapacitiesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedComputeCapacitiesClientListResponse]{ + More: func(page ManagedComputeCapacitiesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedComputeCapacitiesClientListResponse) (ManagedComputeCapacitiesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedComputeCapacitiesClient.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, offer, options) + }, nil) + if err != nil { + return ManagedComputeCapacitiesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ManagedComputeCapacitiesClient) listCreateRequest(ctx context.Context, offer string, options *ManagedComputeCapacitiesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/managedComputeCapacities" + 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() + if options != nil && options.AcceleratorType != nil { + reqQP.Set("acceleratorType", *options.AcceleratorType) + } + reqQP.Set("api-version", version20260315Preview) + if options != nil && options.DeploymentID != nil { + reqQP.Set("deploymentId", *options.DeploymentID) + } + reqQP.Set("offer", offer) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ManagedComputeCapacitiesClient) listHandleResponse(resp *http.Response) (ManagedComputeCapacitiesClientListResponse, error) { + result := ManagedComputeCapacitiesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedComputeCapacityListResult); err != nil { + return ManagedComputeCapacitiesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputecapacities_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputecapacities_client_example_test.go new file mode 100644 index 000000000000..3605dc99b128 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputecapacities_client_example_test.go @@ -0,0 +1,92 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcognitiveservices_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices/v4" + "log" +) + +// Generated from example definition: 2026-03-15-preview/ListManagedComputeCapacities.json +func ExampleManagedComputeCapacitiesClient_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("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedComputeCapacitiesClient().NewListPager("MaaP", 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 = armcognitiveservices.ManagedComputeCapacitiesClientListResponse{ + // ManagedComputeCapacityListResult: armcognitiveservices.ManagedComputeCapacityListResult{ + // Value: []*armcognitiveservices.ManagedComputeCapacity{ + // { + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.CognitiveServices/managedComputeCapacities/Azure.A100"), + // Name: to.Ptr("Azure.A100"), + // Type: to.Ptr("Microsoft.CognitiveServices/managedComputeCapacities"), + // Properties: &armcognitiveservices.ManagedComputeCapacityProperties{ + // AcceleratorType: to.Ptr("Azure.A100"), + // Location: to.Ptr("eastus"), + // AvailableAccelerators: to.Ptr[int32](16), + // DeploymentSizeCapacities: []*armcognitiveservices.DeploymentSizeCapacity{ + // { + // ModelInstanceAcceleratorCount: to.Ptr[int32](1), + // TotalAvailableCapacity: to.Ptr[int32](16), + // LargestDeploymentCapacity: to.Ptr[int32](8), + // }, + // { + // ModelInstanceAcceleratorCount: to.Ptr[int32](2), + // TotalAvailableCapacity: to.Ptr[int32](8), + // LargestDeploymentCapacity: to.Ptr[int32](4), + // }, + // { + // ModelInstanceAcceleratorCount: to.Ptr[int32](4), + // TotalAvailableCapacity: to.Ptr[int32](4), + // LargestDeploymentCapacity: to.Ptr[int32](2), + // }, + // }, + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.CognitiveServices/managedComputeCapacities/Azure.H100"), + // Name: to.Ptr("Azure.H100"), + // Type: to.Ptr("Microsoft.CognitiveServices/managedComputeCapacities"), + // Properties: &armcognitiveservices.ManagedComputeCapacityProperties{ + // AcceleratorType: to.Ptr("Azure.H100"), + // Location: to.Ptr("westus2"), + // AvailableAccelerators: to.Ptr[int32](32), + // DeploymentSizeCapacities: []*armcognitiveservices.DeploymentSizeCapacity{ + // { + // ModelInstanceAcceleratorCount: to.Ptr[int32](1), + // TotalAvailableCapacity: to.Ptr[int32](32), + // LargestDeploymentCapacity: to.Ptr[int32](16), + // }, + // { + // ModelInstanceAcceleratorCount: to.Ptr[int32](8), + // TotalAvailableCapacity: to.Ptr[int32](4), + // LargestDeploymentCapacity: to.Ptr[int32](2), + // }, + // }, + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputedeployments_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputedeployments_client.go new file mode 100644 index 000000000000..9f77002041dd --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputedeployments_client.go @@ -0,0 +1,413 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcognitiveservices + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedComputeDeploymentsClient contains the methods for the ManagedComputeDeployments group. +// Don't use this type directly, use NewManagedComputeDeploymentsClient() instead. +// +// Generated from API version 2026-03-15-preview +type ManagedComputeDeploymentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedComputeDeploymentsClient creates a new instance of ManagedComputeDeploymentsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewManagedComputeDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedComputeDeploymentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedComputeDeploymentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a managed compute deployment associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - deploymentName - The name of the managed compute deployment associated with the Cognitive Services Account +// - resource - The managed compute deployment properties. +// - options - ManagedComputeDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedComputeDeploymentsClient.BeginCreateOrUpdate +// method. +func (client *ManagedComputeDeploymentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, resource ManagedComputeDeployment, options *ManagedComputeDeploymentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ManagedComputeDeploymentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, deploymentName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedComputeDeploymentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedComputeDeploymentsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a managed compute deployment associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ManagedComputeDeploymentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, resource ManagedComputeDeployment, options *ManagedComputeDeploymentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ManagedComputeDeploymentsClient.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, deploymentName, resource, 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 *ManagedComputeDeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, resource ManagedComputeDeployment, _ *ManagedComputeDeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedComputeDeployments/{deploymentName}" + 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 deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified managed compute deployment associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - deploymentName - The name of the managed compute deployment associated with the Cognitive Services Account +// - options - ManagedComputeDeploymentsClientBeginDeleteOptions contains the optional parameters for the ManagedComputeDeploymentsClient.BeginDelete +// method. +func (client *ManagedComputeDeploymentsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *ManagedComputeDeploymentsClientBeginDeleteOptions) (*runtime.Poller[ManagedComputeDeploymentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, deploymentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedComputeDeploymentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedComputeDeploymentsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the specified managed compute deployment associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ManagedComputeDeploymentsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *ManagedComputeDeploymentsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ManagedComputeDeploymentsClient.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, deploymentName, 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, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ManagedComputeDeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, _ *ManagedComputeDeploymentsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedComputeDeployments/{deploymentName}" + 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 deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + +// Get - Gets the specified managed compute deployment associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - deploymentName - The name of the managed compute deployment associated with the Cognitive Services Account +// - options - ManagedComputeDeploymentsClientGetOptions contains the optional parameters for the ManagedComputeDeploymentsClient.Get +// method. +func (client *ManagedComputeDeploymentsClient) Get(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, options *ManagedComputeDeploymentsClientGetOptions) (ManagedComputeDeploymentsClientGetResponse, error) { + var err error + const operationName = "ManagedComputeDeploymentsClient.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, deploymentName, options) + if err != nil { + return ManagedComputeDeploymentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagedComputeDeploymentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedComputeDeploymentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ManagedComputeDeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, _ *ManagedComputeDeploymentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedComputeDeployments/{deploymentName}" + 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 deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ManagedComputeDeploymentsClient) getHandleResponse(resp *http.Response) (ManagedComputeDeploymentsClientGetResponse, error) { + result := ManagedComputeDeploymentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedComputeDeployment); err != nil { + return ManagedComputeDeploymentsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the managed compute deployments associated with the Cognitive Services account. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - options - ManagedComputeDeploymentsClientListOptions contains the optional parameters for the ManagedComputeDeploymentsClient.NewListPager +// method. +func (client *ManagedComputeDeploymentsClient) NewListPager(resourceGroupName string, accountName string, options *ManagedComputeDeploymentsClientListOptions) *runtime.Pager[ManagedComputeDeploymentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedComputeDeploymentsClientListResponse]{ + More: func(page ManagedComputeDeploymentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedComputeDeploymentsClientListResponse) (ManagedComputeDeploymentsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedComputeDeploymentsClient.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 ManagedComputeDeploymentsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ManagedComputeDeploymentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *ManagedComputeDeploymentsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedComputeDeployments" + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ManagedComputeDeploymentsClient) listHandleResponse(resp *http.Response) (ManagedComputeDeploymentsClientListResponse, error) { + result := ManagedComputeDeploymentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedComputeDeploymentListResult); err != nil { + return ManagedComputeDeploymentsClientListResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates the specified managed compute deployment associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of Cognitive Services account. +// - deploymentName - The name of the managed compute deployment associated with the Cognitive Services Account +// - properties - The managed compute deployment patch properties. +// - options - ManagedComputeDeploymentsClientBeginUpdateOptions contains the optional parameters for the ManagedComputeDeploymentsClient.BeginUpdate +// method. +func (client *ManagedComputeDeploymentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, properties PatchResourceSKU, options *ManagedComputeDeploymentsClientBeginUpdateOptions) (*runtime.Poller[ManagedComputeDeploymentsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, deploymentName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedComputeDeploymentsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ManagedComputeDeploymentsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates the specified managed compute deployment associated with the Cognitive Services account. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *ManagedComputeDeploymentsClient) update(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, properties PatchResourceSKU, options *ManagedComputeDeploymentsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ManagedComputeDeploymentsClient.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, deploymentName, properties, 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 *ManagedComputeDeploymentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, properties PatchResourceSKU, _ *ManagedComputeDeploymentsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedComputeDeployments/{deploymentName}" + 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 deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputedeployments_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputedeployments_client_example_test.go new file mode 100644 index 000000000000..0085bbcc6329 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputedeployments_client_example_test.go @@ -0,0 +1,525 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcognitiveservices_test + +import ( + "context" + "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/v4" + "log" +) + +// Generated from example definition: 2026-03-15-preview/CreateOrUpdateManagedComputeDeployment.json +func ExampleManagedComputeDeploymentsClient_BeginCreateOrUpdate_createOrUpdateManagedComputeDeployment() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedComputeDeploymentsClient().BeginCreateOrUpdate(ctx, "resourceGroupName", "accountName", "gpt-oss-120b-gpu", armcognitiveservices.ManagedComputeDeployment{ + Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + Model: to.Ptr("azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4"), + DeploymentTemplate: to.Ptr("azureml://registries/azureml-openai-oss/deploymenttemplates/gpt-oss-120b-short-context/versions/1"), + AcceleratorType: to.Ptr("H100_80GB"), + VersionUpgradeOption: to.Ptr(armcognitiveservices.DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable), + }, + SKU: &armcognitiveservices.SKU{ + Name: to.Ptr("GlobalManagedCompute"), + 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 poll 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 = armcognitiveservices.ManagedComputeDeploymentsClientCreateOrUpdateResponse{ + // ManagedComputeDeployment: armcognitiveservices.ManagedComputeDeployment{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/managedComputeDeployments/gpt-oss-120b-gpu"), + // Name: to.Ptr("gpt-oss-120b-gpu"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedComputeDeployments"), + // Etag: to.Ptr("\"0x8D...\""), + // Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + // Model: to.Ptr("azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4"), + // DeploymentTemplate: to.Ptr("azureml://registries/azureml-openai-oss/deploymenttemplates/gpt-oss-120b-short-context/versions/1"), + // AcceleratorType: to.Ptr("H100_80GB"), + // AcceleratorsPerInstance: to.Ptr[int32](4), + // TotalAccelerators: to.Ptr[int32](4), + // VersionUpgradeOption: to.Ptr(armcognitiveservices.DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable), + // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), + // ProvisioningDetails: &armcognitiveservices.ManagedComputeDeploymentProvisioningDetails{ + // Message: to.Ptr("Deployment provisioned successfully."), + // LastOperationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-23T14:45:00Z"); return t}()), + // }, + // Routes: &armcognitiveservices.ManagedComputeDeploymentRoutes{ + // ChatCompletionsScoringPath: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/chat/completions"), + // Swagger: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/swagger.json"), + // MessagesAPIScoringPath: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/messages"), + // }, + // }, + // SKU: &armcognitiveservices.SKU{ + // Name: to.Ptr("GlobalManagedCompute"), + // Capacity: to.Ptr[int32](1), + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/CreateOrUpdateVmManagedComputeDeployment.json +func ExampleManagedComputeDeploymentsClient_BeginCreateOrUpdate_createOrUpdateVMManagedComputeDeployment() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedComputeDeploymentsClient().BeginCreateOrUpdate(ctx, "resourceGroupName", "accountName", "gpt-oss-120b-byoc", armcognitiveservices.ManagedComputeDeployment{ + Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + Model: to.Ptr("azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4"), + DeploymentTemplate: to.Ptr("projects/my-project/deploymentTemplates/gpt-oss-120b-vllm-tuned/versions/2"), + ComputeID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/computes/my-h100-pool"), + Priority: to.Ptr("High"), + }, + SKU: &armcognitiveservices.SKU{ + Name: to.Ptr("VmManagedCompute"), + Capacity: to.Ptr[int32](2), + }, + }, 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 poll 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 = armcognitiveservices.ManagedComputeDeploymentsClientCreateOrUpdateResponse{ + // ManagedComputeDeployment: armcognitiveservices.ManagedComputeDeployment{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/managedComputeDeployments/gpt-oss-120b-byoc"), + // Name: to.Ptr("gpt-oss-120b-byoc"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedComputeDeployments"), + // Etag: to.Ptr("\"0x8D...\""), + // Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + // Model: to.Ptr("azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4"), + // DeploymentTemplate: to.Ptr("projects/my-project/deploymentTemplates/gpt-oss-120b-vllm-tuned/versions/2"), + // ComputeID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/computes/my-h100-pool"), + // Priority: to.Ptr("High"), + // VersionUpgradeOption: to.Ptr(armcognitiveservices.DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable), + // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), + // ProvisioningDetails: &armcognitiveservices.ManagedComputeDeploymentProvisioningDetails{ + // Message: to.Ptr("Deployment is healthy and serving traffic."), + // LastOperationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-04-12T10:25:00Z"); return t}()), + // }, + // Routes: &armcognitiveservices.ManagedComputeDeploymentRoutes{ + // ChatCompletionsScoringPath: to.Ptr("/managed-deployments/gpt-oss-120b-byoc/v1/chat/completions"), + // }, + // }, + // SKU: &armcognitiveservices.SKU{ + // Name: to.Ptr("VmManagedCompute"), + // Capacity: to.Ptr[int32](2), + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/DeleteManagedComputeDeployment.json +func ExampleManagedComputeDeploymentsClient_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("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedComputeDeploymentsClient().BeginDelete(ctx, "resourceGroupName", "accountName", "gpt-oss-120b-gpu", 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 poll 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 = armcognitiveservices.ManagedComputeDeploymentsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2026-03-15-preview/GetManagedComputeDeployment.json +func ExampleManagedComputeDeploymentsClient_Get_getManagedComputeDeployment() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedComputeDeploymentsClient().Get(ctx, "resourceGroupName", "accountName", "gpt-oss-120b-gpu", 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 = armcognitiveservices.ManagedComputeDeploymentsClientGetResponse{ + // ManagedComputeDeployment: armcognitiveservices.ManagedComputeDeployment{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/managedComputeDeployments/gpt-oss-120b-gpu"), + // Name: to.Ptr("gpt-oss-120b-gpu"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedComputeDeployments"), + // Etag: to.Ptr("\"0x8D...\""), + // Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + // Model: to.Ptr("azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4"), + // DeploymentTemplate: to.Ptr("azureml://registries/azureml-openai-oss/deploymenttemplates/gpt-oss-120b-short-context/versions/1"), + // AcceleratorType: to.Ptr("H100_80GB"), + // AcceleratorsPerInstance: to.Ptr[int32](4), + // TotalAccelerators: to.Ptr[int32](4), + // VersionUpgradeOption: to.Ptr(armcognitiveservices.DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable), + // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), + // ProvisioningDetails: &armcognitiveservices.ManagedComputeDeploymentProvisioningDetails{ + // Message: to.Ptr("Deployment is healthy and serving traffic."), + // LastOperationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-23T14:45:00Z"); return t}()), + // }, + // Routes: &armcognitiveservices.ManagedComputeDeploymentRoutes{ + // ChatCompletionsScoringPath: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/chat/completions"), + // Swagger: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/swagger.json"), + // MessagesAPIScoringPath: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/messages"), + // }, + // }, + // SKU: &armcognitiveservices.SKU{ + // Name: to.Ptr("GlobalManagedCompute"), + // Capacity: to.Ptr[int32](1), + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/GetVmManagedComputeDeployment.json +func ExampleManagedComputeDeploymentsClient_Get_getVMManagedComputeDeployment() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewManagedComputeDeploymentsClient().Get(ctx, "resourceGroupName", "accountName", "gpt-oss-120b-byoc", 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 = armcognitiveservices.ManagedComputeDeploymentsClientGetResponse{ + // ManagedComputeDeployment: armcognitiveservices.ManagedComputeDeployment{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/managedComputeDeployments/gpt-oss-120b-byoc"), + // Name: to.Ptr("gpt-oss-120b-byoc"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedComputeDeployments"), + // Etag: to.Ptr("\"0x8D...\""), + // Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + // Model: to.Ptr("azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4"), + // DeploymentTemplate: to.Ptr("projects/my-project/deploymentTemplates/gpt-oss-120b-vllm-tuned/versions/2"), + // ComputeID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/computes/my-h100-pool"), + // Priority: to.Ptr("High"), + // VersionUpgradeOption: to.Ptr(armcognitiveservices.DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable), + // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), + // ProvisioningDetails: &armcognitiveservices.ManagedComputeDeploymentProvisioningDetails{ + // Message: to.Ptr("Deployment is healthy and serving traffic."), + // LastOperationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-04-12T10:25:00Z"); return t}()), + // }, + // Routes: &armcognitiveservices.ManagedComputeDeploymentRoutes{ + // ChatCompletionsScoringPath: to.Ptr("/managed-deployments/gpt-oss-120b-byoc/v1/chat/completions"), + // }, + // }, + // SKU: &armcognitiveservices.SKU{ + // Name: to.Ptr("VmManagedCompute"), + // Capacity: to.Ptr[int32](2), + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/ListManagedComputeDeployments.json +func ExampleManagedComputeDeploymentsClient_NewListPager_listManagedComputeDeployments() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedComputeDeploymentsClient().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 = armcognitiveservices.ManagedComputeDeploymentsClientListResponse{ + // ManagedComputeDeploymentListResult: armcognitiveservices.ManagedComputeDeploymentListResult{ + // Value: []*armcognitiveservices.ManagedComputeDeployment{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/managedComputeDeployments/gpt-oss-120b-gpu"), + // Name: to.Ptr("gpt-oss-120b-gpu"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedComputeDeployments"), + // Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + // Model: to.Ptr("azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4"), + // DeploymentTemplate: to.Ptr("azureml://registries/azureml-openai-oss/deploymenttemplates/gpt-oss-120b-short-context/versions/1"), + // AcceleratorType: to.Ptr("H100_80GB"), + // AcceleratorsPerInstance: to.Ptr[int32](4), + // TotalAccelerators: to.Ptr[int32](4), + // VersionUpgradeOption: to.Ptr(armcognitiveservices.DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable), + // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), + // Routes: &armcognitiveservices.ManagedComputeDeploymentRoutes{ + // ChatCompletionsScoringPath: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/chat/completions"), + // Swagger: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/swagger.json"), + // MessagesAPIScoringPath: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/messages"), + // }, + // }, + // SKU: &armcognitiveservices.SKU{ + // Name: to.Ptr("GlobalManagedCompute"), + // Capacity: to.Ptr[int32](1), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/managedComputeDeployments/llama-3-gpu"), + // Name: to.Ptr("llama-3-gpu"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedComputeDeployments"), + // Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + // Model: to.Ptr("azureml://registries/azureml-meta/models/Meta-Llama-3.1-405B-Instruct/versions/2"), + // DeploymentTemplate: to.Ptr("azureml://registries/azureml-meta/deploymenttemplates/llama-3-405b-fp8/versions/1"), + // AcceleratorType: to.Ptr("H100_80GB"), + // AcceleratorsPerInstance: to.Ptr[int32](8), + // TotalAccelerators: to.Ptr[int32](16), + // VersionUpgradeOption: to.Ptr(armcognitiveservices.DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable), + // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), + // Routes: &armcognitiveservices.ManagedComputeDeploymentRoutes{ + // ChatCompletionsScoringPath: to.Ptr("/managedComputeDeployments/llama-3-gpu/chat/completions"), + // Swagger: to.Ptr("/managedComputeDeployments/llama-3-gpu/swagger.json"), + // }, + // }, + // SKU: &armcognitiveservices.SKU{ + // Name: to.Ptr("GlobalManagedCompute"), + // Capacity: to.Ptr[int32](2), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/managedComputeDeployments/gpt-oss-120b-byoc"), + // Name: to.Ptr("gpt-oss-120b-byoc"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedComputeDeployments"), + // Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + // Model: to.Ptr("azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4"), + // DeploymentTemplate: to.Ptr("projects/my-project/deploymentTemplates/gpt-oss-120b-vllm-tuned/versions/2"), + // ComputeID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/computes/my-h100-pool"), + // Priority: to.Ptr("High"), + // VersionUpgradeOption: to.Ptr(armcognitiveservices.DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable), + // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), + // Routes: &armcognitiveservices.ManagedComputeDeploymentRoutes{ + // ChatCompletionsScoringPath: to.Ptr("/managed-deployments/gpt-oss-120b-byoc/v1/chat/completions"), + // }, + // }, + // SKU: &armcognitiveservices.SKU{ + // Name: to.Ptr("VmManagedCompute"), + // Capacity: to.Ptr[int32](2), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2026-03-15-preview/ListVmManagedComputeDeployments.json +func ExampleManagedComputeDeploymentsClient_NewListPager_listVMManagedComputeDeployments() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedComputeDeploymentsClient().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 = armcognitiveservices.ManagedComputeDeploymentsClientListResponse{ + // ManagedComputeDeploymentListResult: armcognitiveservices.ManagedComputeDeploymentListResult{ + // Value: []*armcognitiveservices.ManagedComputeDeployment{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/managedComputeDeployments/gpt-oss-120b-byoc"), + // Name: to.Ptr("gpt-oss-120b-byoc"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedComputeDeployments"), + // Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + // Model: to.Ptr("azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4"), + // DeploymentTemplate: to.Ptr("projects/my-project/deploymentTemplates/gpt-oss-120b-vllm-tuned/versions/2"), + // ComputeID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/computes/my-h100-pool"), + // Priority: to.Ptr("High"), + // VersionUpgradeOption: to.Ptr(armcognitiveservices.DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable), + // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), + // Routes: &armcognitiveservices.ManagedComputeDeploymentRoutes{ + // ChatCompletionsScoringPath: to.Ptr("/managed-deployments/gpt-oss-120b-byoc/v1/chat/completions"), + // }, + // }, + // SKU: &armcognitiveservices.SKU{ + // Name: to.Ptr("VmManagedCompute"), + // Capacity: to.Ptr[int32](2), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2026-03-15-preview/UpdateManagedComputeDeployment.json +func ExampleManagedComputeDeploymentsClient_BeginUpdate_updateManagedComputeDeployment() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedComputeDeploymentsClient().BeginUpdate(ctx, "resourceGroupName", "accountName", "gpt-oss-120b-gpu", armcognitiveservices.PatchResourceSKU{ + SKU: &armcognitiveservices.SKU{ + Name: to.Ptr("GlobalManagedCompute"), + Capacity: to.Ptr[int32](2), + }, + }, 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 poll 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 = armcognitiveservices.ManagedComputeDeploymentsClientUpdateResponse{ + // ManagedComputeDeployment: armcognitiveservices.ManagedComputeDeployment{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/managedComputeDeployments/gpt-oss-120b-gpu"), + // Name: to.Ptr("gpt-oss-120b-gpu"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedComputeDeployments"), + // Etag: to.Ptr("\"0x8D...\""), + // Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + // Model: to.Ptr("azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4"), + // DeploymentTemplate: to.Ptr("azureml://registries/azureml-openai-oss/deploymenttemplates/gpt-oss-120b-short-context/versions/1"), + // AcceleratorType: to.Ptr("H100_80GB"), + // AcceleratorsPerInstance: to.Ptr[int32](4), + // TotalAccelerators: to.Ptr[int32](8), + // VersionUpgradeOption: to.Ptr(armcognitiveservices.DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable), + // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), + // ProvisioningDetails: &armcognitiveservices.ManagedComputeDeploymentProvisioningDetails{ + // Message: to.Ptr("Scale operation completed successfully."), + // LastOperationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-23T15:15:00Z"); return t}()), + // }, + // Routes: &armcognitiveservices.ManagedComputeDeploymentRoutes{ + // ChatCompletionsScoringPath: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/chat/completions"), + // Swagger: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/swagger.json"), + // MessagesAPIScoringPath: to.Ptr("/managedComputeDeployments/gpt-oss-120b-gpu/messages"), + // }, + // }, + // SKU: &armcognitiveservices.SKU{ + // Name: to.Ptr("GlobalManagedCompute"), + // Capacity: to.Ptr[int32](2), + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/UpdateVmManagedComputeDeployment.json +func ExampleManagedComputeDeploymentsClient_BeginUpdate_updateVMManagedComputeDeployment() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewManagedComputeDeploymentsClient().BeginUpdate(ctx, "resourceGroupName", "accountName", "gpt-oss-120b-byoc", armcognitiveservices.PatchResourceSKU{ + SKU: &armcognitiveservices.SKU{ + Name: to.Ptr("VmManagedCompute"), + Capacity: to.Ptr[int32](2), + }, + }, 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 poll 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 = armcognitiveservices.ManagedComputeDeploymentsClientUpdateResponse{ + // ManagedComputeDeployment: armcognitiveservices.ManagedComputeDeployment{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/managedComputeDeployments/gpt-oss-120b-byoc"), + // Name: to.Ptr("gpt-oss-120b-byoc"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedComputeDeployments"), + // Etag: to.Ptr("\"0x8D...\""), + // Properties: &armcognitiveservices.ManagedComputeDeploymentProperties{ + // Model: to.Ptr("azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4"), + // DeploymentTemplate: to.Ptr("projects/my-project/deploymentTemplates/gpt-oss-120b-vllm-tuned/versions/2"), + // ComputeID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/computes/my-h100-pool"), + // Priority: to.Ptr("High"), + // VersionUpgradeOption: to.Ptr(armcognitiveservices.DeploymentModelVersionUpgradeOptionOnceNewDefaultVersionAvailable), + // ProvisioningState: to.Ptr(armcognitiveservices.ProvisioningStateSucceeded), + // ProvisioningDetails: &armcognitiveservices.ManagedComputeDeploymentProvisioningDetails{ + // Message: to.Ptr("Scale operation completed successfully."), + // LastOperationTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-04-12T10:55:00Z"); return t}()), + // }, + // Routes: &armcognitiveservices.ManagedComputeDeploymentRoutes{ + // ChatCompletionsScoringPath: to.Ptr("/managed-deployments/gpt-oss-120b-byoc/v1/chat/completions"), + // }, + // }, + // SKU: &armcognitiveservices.SKU{ + // Name: to.Ptr("VmManagedCompute"), + // Capacity: to.Ptr[int32](2), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputeusagesoperationgroup_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputeusagesoperationgroup_client.go new file mode 100644 index 000000000000..9c91de87ceed --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputeusagesoperationgroup_client.go @@ -0,0 +1,100 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcognitiveservices + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagedComputeUsagesOperationGroupClient contains the methods for the ManagedComputeUsagesOperationGroup group. +// Don't use this type directly, use NewManagedComputeUsagesOperationGroupClient() instead. +// +// Generated from API version 2026-03-15-preview +type ManagedComputeUsagesOperationGroupClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagedComputeUsagesOperationGroupClient creates a new instance of ManagedComputeUsagesOperationGroupClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewManagedComputeUsagesOperationGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedComputeUsagesOperationGroupClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagedComputeUsagesOperationGroupClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - List managed compute quota usages for a subscription and location. +// - location - The location name. +// - options - ManagedComputeUsagesOperationGroupClientListOptions contains the optional parameters for the ManagedComputeUsagesOperationGroupClient.NewListPager +// method. +func (client *ManagedComputeUsagesOperationGroupClient) NewListPager(location string, options *ManagedComputeUsagesOperationGroupClientListOptions) *runtime.Pager[ManagedComputeUsagesOperationGroupClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ManagedComputeUsagesOperationGroupClientListResponse]{ + More: func(page ManagedComputeUsagesOperationGroupClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ManagedComputeUsagesOperationGroupClientListResponse) (ManagedComputeUsagesOperationGroupClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedComputeUsagesOperationGroupClient.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, location, options) + }, nil) + if err != nil { + return ManagedComputeUsagesOperationGroupClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ManagedComputeUsagesOperationGroupClient) listCreateRequest(ctx context.Context, location string, _ *ManagedComputeUsagesOperationGroupClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/managedComputeUsages" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ManagedComputeUsagesOperationGroupClient) listHandleResponse(resp *http.Response) (ManagedComputeUsagesOperationGroupClientListResponse, error) { + result := ManagedComputeUsagesOperationGroupClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ManagedComputeUsageListResult); err != nil { + return ManagedComputeUsagesOperationGroupClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputeusagesoperationgroup_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputeusagesoperationgroup_client_example_test.go new file mode 100644 index 000000000000..bfdca732a70d --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managedcomputeusagesoperationgroup_client_example_test.go @@ -0,0 +1,64 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcognitiveservices_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices/v4" + "log" +) + +// Generated from example definition: 2026-03-15-preview/ListManagedComputeUsages.json +func ExampleManagedComputeUsagesOperationGroupClient_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("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewManagedComputeUsagesOperationGroupClient().NewListPager("eastus", 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 = armcognitiveservices.ManagedComputeUsagesOperationGroupClientListResponse{ + // ManagedComputeUsageListResult: armcognitiveservices.ManagedComputeUsageListResult{ + // Value: []*armcognitiveservices.ManagedComputeUsage{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/locations/eastus/managedComputeUsages/ManagedCompute.Global.H100_80GB"), + // Name: &armcognitiveservices.MetricName{ + // Value: to.Ptr("ManagedCompute.Global.H100_80GB"), + // LocalizedValue: to.Ptr("H100_80GB Managed Compute Quota"), + // }, + // Type: to.Ptr("Microsoft.CognitiveServices/locations/managedComputeUsages"), + // OfferScope: to.Ptr("Global"), + // CurrentValue: to.Ptr[float64](8), + // Limit: to.Ptr[float64](300), + // Unit: to.Ptr(armcognitiveservices.UnitType("AcceleratorCount")), + // Deployments: []*armcognitiveservices.ManagedComputeDeploymentInfo{ + // { + // DeploymentID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.CognitiveServices/accounts/myAccount/deployments/gpt4-deploy"), + // ProjectID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.CognitiveServices/accounts/myAccount"), + // ModelID: to.Ptr("azureml://registries//models//versions/gpt-4o"), + // AcceleratorCount: to.Ptr[int64](8), + // InstanceCount: to.Ptr[int32](1), + // }, + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworkprovisions_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworkprovisions_client.go index f994a5345dea..9232e9666fdd 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworkprovisions_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworkprovisions_client.go @@ -18,6 +18,8 @@ import ( // ManagedNetworkProvisionsClient contains the methods for the ManagedNetworkProvisions group. // Don't use this type directly, use NewManagedNetworkProvisionsClient() instead. +// +// Generated from API version 2026-03-15-preview type ManagedNetworkProvisionsClient struct { internal *arm.Client subscriptionID string @@ -43,8 +45,6 @@ func NewManagedNetworkProvisionsClient(subscriptionID string, credential azcore. // // Provisions the managed network of a cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - managedNetworkName - Name of the managedNetwork associated with the cognitive services account. Only 'default' is supported. @@ -71,8 +71,6 @@ func (client *ManagedNetworkProvisionsClient) BeginProvisionManagedNetwork(ctx c // // Provisions the managed network of a cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *ManagedNetworkProvisionsClient) provisionManagedNetwork(ctx context.Context, resourceGroupName string, accountName string, managedNetworkName string, options *ManagedNetworkProvisionsClientBeginProvisionManagedNetworkOptions) (*http.Response, error) { var err error const operationName = "ManagedNetworkProvisionsClient.BeginProvisionManagedNetwork" @@ -118,8 +116,8 @@ func (client *ManagedNetworkProvisionsClient) provisionManagedNetworkCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { req.Raw().Header["Content-Type"] = []string{"application/json"} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworkprovisions_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworkprovisions_client_example_test.go index 3dba69261a45..7563eafd3a2a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworkprovisions_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworkprovisions_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ManagedNetwork/provisionManagedNetwork.json +// Generated from example definition: 2026-03-15-preview/ManagedNetwork/provisionManagedNetwork.json func ExampleManagedNetworkProvisionsClient_BeginProvisionManagedNetwork() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -29,13 +29,13 @@ func ExampleManagedNetworkProvisionsClient_BeginProvisionManagedNetwork() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.ManagedNetworkProvisionsClientProvisionManagedNetworkResponse{ - // ManagedNetworkProvisionStatus: &armcognitiveservices.ManagedNetworkProvisionStatus{ + // ManagedNetworkProvisionStatus: armcognitiveservices.ManagedNetworkProvisionStatus{ // Status: to.Ptr(armcognitiveservices.ManagedNetworkStatusActive), // }, // } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworksettings_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworksettings_client.go index 1016a6e08edf..27117034f4d8 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworksettings_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworksettings_client.go @@ -18,6 +18,8 @@ import ( // ManagedNetworkSettingsClient contains the methods for the ManagedNetworkSettings group. // Don't use this type directly, use NewManagedNetworkSettingsClient() instead. +// +// Generated from API version 2026-03-15-preview type ManagedNetworkSettingsClient struct { internal *arm.Client subscriptionID string @@ -43,8 +45,6 @@ func NewManagedNetworkSettingsClient(subscriptionID string, credential azcore.To // // Delete API for managed network settings of a cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - managedNetworkName - Name of the managedNetwork associated with the cognitive services account. Only 'default' is supported. @@ -71,8 +71,6 @@ func (client *ManagedNetworkSettingsClient) BeginDelete(ctx context.Context, res // // Delete API for managed network settings of a cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *ManagedNetworkSettingsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, managedNetworkName string, options *ManagedNetworkSettingsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ManagedNetworkSettingsClient.BeginDelete" @@ -118,8 +116,8 @@ func (client *ManagedNetworkSettingsClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } @@ -127,8 +125,6 @@ func (client *ManagedNetworkSettingsClient) deleteCreateRequest(ctx context.Cont // // Get API for managed network settings of a cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - managedNetworkName - Name of the managedNetwork associated with the cognitive services account. Only 'default' is supported. @@ -180,8 +176,8 @@ func (client *ManagedNetworkSettingsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -198,8 +194,6 @@ func (client *ManagedNetworkSettingsClient) getHandleResponse(resp *http.Respons // NewListPager - List API for managed network settings of a cognitive services account. // // List API for managed network settings of a cognitive services account. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - ManagedNetworkSettingsClientListOptions contains the optional parameters for the ManagedNetworkSettingsClient.NewListPager @@ -247,8 +241,8 @@ func (client *ManagedNetworkSettingsClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -266,8 +260,6 @@ func (client *ManagedNetworkSettingsClient) listHandleResponse(resp *http.Respon // // Patch API for managed network settings of a cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - managedNetworkName - Name of the managedNetwork associated with the cognitive services account. Only 'default' is supported. @@ -295,8 +287,6 @@ func (client *ManagedNetworkSettingsClient) BeginPatch(ctx context.Context, reso // // Patch API for managed network settings of a cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *ManagedNetworkSettingsClient) patch(ctx context.Context, resourceGroupName string, accountName string, managedNetworkName string, body ManagedNetworkSettingsPropertiesBasicResource, options *ManagedNetworkSettingsClientBeginPatchOptions) (*http.Response, error) { var err error const operationName = "ManagedNetworkSettingsClient.BeginPatch" @@ -342,8 +332,8 @@ func (client *ManagedNetworkSettingsClient) patchCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -356,8 +346,6 @@ func (client *ManagedNetworkSettingsClient) patchCreateRequest(ctx context.Conte // // PUT API for managed network settings of a cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - managedNetworkName - Name of the managedNetwork associated with the cognitive services account. Only 'default' is supported. @@ -385,8 +373,6 @@ func (client *ManagedNetworkSettingsClient) BeginPut(ctx context.Context, resour // // PUT API for managed network settings of a cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *ManagedNetworkSettingsClient) put(ctx context.Context, resourceGroupName string, accountName string, managedNetworkName string, body ManagedNetworkSettingsPropertiesBasicResource, options *ManagedNetworkSettingsClientBeginPutOptions) (*http.Response, error) { var err error const operationName = "ManagedNetworkSettingsClient.BeginPut" @@ -432,8 +418,8 @@ func (client *ManagedNetworkSettingsClient) putCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworksettings_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworksettings_client_example_test.go index 60dbf80d6247..cb595fdf1276 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworksettings_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/managednetworksettings_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ManagedNetwork/deleteManagedNetworkV2.json +// Generated from example definition: 2026-03-15-preview/ManagedNetwork/deleteManagedNetworkV2.json func ExampleManagedNetworkSettingsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -29,11 +29,11 @@ func ExampleManagedNetworkSettingsClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/ManagedNetwork/getManagedNetworkV2.json +// Generated from example definition: 2026-03-15-preview/ManagedNetwork/getManagedNetworkV2.json func ExampleManagedNetworkSettingsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -52,7 +52,7 @@ func ExampleManagedNetworkSettingsClient_Get() { _ = 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 = armcognitiveservices.ManagedNetworkSettingsClientGetResponse{ - // ManagedNetworkSettingsPropertiesBasicResource: &armcognitiveservices.ManagedNetworkSettingsPropertiesBasicResource{ + // ManagedNetworkSettingsPropertiesBasicResource: armcognitiveservices.ManagedNetworkSettingsPropertiesBasicResource{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedNetworks"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/cognitive-account-name/managedNetworks/default"), @@ -78,7 +78,7 @@ func ExampleManagedNetworkSettingsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ManagedNetwork/listManagedNetworkV2.json +// Generated from example definition: 2026-03-15-preview/ManagedNetwork/listManagedNetworkV2.json func ExampleManagedNetworkSettingsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -132,7 +132,7 @@ func ExampleManagedNetworkSettingsClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/ManagedNetwork/patchManagedNetworkV2.json +// Generated from example definition: 2026-03-15-preview/ManagedNetwork/patchManagedNetworkV2.json func ExampleManagedNetworkSettingsClient_BeginPatch() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -163,13 +163,13 @@ func ExampleManagedNetworkSettingsClient_BeginPatch() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.ManagedNetworkSettingsClientPatchResponse{ - // ManagedNetworkSettingsPropertiesBasicResource: &armcognitiveservices.ManagedNetworkSettingsPropertiesBasicResource{ + // ManagedNetworkSettingsPropertiesBasicResource: armcognitiveservices.ManagedNetworkSettingsPropertiesBasicResource{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedNetworks"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/cognitive-account-name/managedNetworks/default"), @@ -195,7 +195,7 @@ func ExampleManagedNetworkSettingsClient_BeginPatch() { // } } -// Generated from example definition: 2026-01-15-preview/ManagedNetwork/createOrUpdateManagedNetworkV2.json +// Generated from example definition: 2026-03-15-preview/ManagedNetwork/createOrUpdateManagedNetworkV2.json func ExampleManagedNetworkSettingsClient_BeginPut() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -226,13 +226,13 @@ func ExampleManagedNetworkSettingsClient_BeginPut() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.ManagedNetworkSettingsClientPutResponse{ - // ManagedNetworkSettingsPropertiesBasicResource: &armcognitiveservices.ManagedNetworkSettingsPropertiesBasicResource{ + // ManagedNetworkSettingsPropertiesBasicResource: armcognitiveservices.ManagedNetworkSettingsPropertiesBasicResource{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/managedNetworks"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/cognitive-account-name/managedNetworks/default"), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go index 3808463f0e17..ad5105426ffc 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client.go @@ -18,6 +18,8 @@ import ( // ManagementClient contains the methods for the Management group. // Don't use this type directly, use NewManagementClient() instead. +// +// Generated from API version 2026-03-15-preview type ManagementClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - parameters - The request body // - options - ManagementClientCalculateModelCapacityOptions contains the optional parameters for the ManagementClient.CalculateModelCapacity // method. @@ -80,8 +80,8 @@ func (client *ManagementClient) calculateModelCapacityCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -101,8 +101,6 @@ 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 2026-01-15-preview // - parameters - The request body // - options - ManagementClientCheckDomainAvailabilityOptions contains the optional parameters for the ManagementClient.CheckDomainAvailability // method. @@ -140,8 +138,8 @@ func (client *ManagementClient) checkDomainAvailabilityCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -161,8 +159,6 @@ func (client *ManagementClient) checkDomainAvailabilityHandleResponse(resp *http // CheckSKUAvailability - Check available SKUs. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - location - The location name. // - parameters - The request body // - options - ManagementClientCheckSKUAvailabilityOptions contains the optional parameters for the ManagementClient.CheckSKUAvailability @@ -205,8 +201,8 @@ func (client *ManagementClient) checkSKUAvailabilityCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []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 index befad1acad38..680a005853d1 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/management_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/CalculateModelCapacity.json +// Generated from example definition: 2026-03-15-preview/CalculateModelCapacity.json func ExampleManagementClient_CalculateModelCapacity() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,7 +54,7 @@ func ExampleManagementClient_CalculateModelCapacity() { _ = 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 = armcognitiveservices.ManagementClientCalculateModelCapacityResponse{ - // CalculateModelCapacityResult: &armcognitiveservices.CalculateModelCapacityResult{ + // CalculateModelCapacityResult: armcognitiveservices.CalculateModelCapacityResult{ // EstimatedCapacity: &armcognitiveservices.CalculateModelCapacityResultEstimatedCapacity{ // DeployableValue: to.Ptr[int32](400), // Value: to.Ptr[int32](346), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client.go index d6b769ce79b0..6fbf83fa09c8 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client.go @@ -18,6 +18,8 @@ import ( // ModelCapacitiesClient contains the methods for the ModelCapacities group. // Don't use this type directly, use NewModelCapacitiesClient() instead. +// +// Generated from API version 2026-03-15-preview type ModelCapacitiesClient struct { internal *arm.Client subscriptionID string @@ -40,8 +42,6 @@ func NewModelCapacitiesClient(subscriptionID string, credential azcore.TokenCred } // NewListPager - List ModelCapacities. -// -// Generated from API version 2026-01-15-preview // - modelFormat - The format of the Model // - modelName - The name of the Model // - modelVersion - The version of the Model @@ -82,11 +82,11 @@ func (client *ModelCapacitiesClient) listCreateRequest(ctx context.Context, mode return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") + reqQP.Set("api-version", version20260315Preview) reqQP.Set("modelFormat", modelFormat) reqQP.Set("modelName", modelName) reqQP.Set("modelVersion", modelVersion) - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client_example_test.go index fe4ddc3b5efc..cb1ffc7b3497 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/modelcapacities_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ListModelCapacities.json +// Generated from example definition: 2026-03-15-preview/ListModelCapacities.json func ExampleModelCapacitiesClient_NewListPager_listModelCapacities() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -60,7 +60,7 @@ func ExampleModelCapacitiesClient_NewListPager_listModelCapacities() { } } -// Generated from example definition: 2026-01-15-preview/ListModelCapacitiesClassicScope.json +// Generated from example definition: 2026-03-15-preview/ListModelCapacitiesClassicScope.json func ExampleModelCapacitiesClient_NewListPager_listModelCapacitiesClassicScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -108,7 +108,7 @@ func ExampleModelCapacitiesClient_NewListPager_listModelCapacitiesClassicScope() } } -// Generated from example definition: 2026-01-15-preview/ListModelCapacitiesDataZoneScope.json +// Generated from example definition: 2026-03-15-preview/ListModelCapacitiesDataZoneScope.json func ExampleModelCapacitiesClient_NewListPager_listModelCapacitiesDataZoneScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -157,7 +157,7 @@ func ExampleModelCapacitiesClient_NewListPager_listModelCapacitiesDataZoneScope( } } -// Generated from example definition: 2026-01-15-preview/ListModelCapacitiesGlobalScope.json +// Generated from example definition: 2026-03-15-preview/ListModelCapacitiesGlobalScope.json func ExampleModelCapacitiesClient_NewListPager_listModelCapacitiesGlobalScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go index 0bab0d235402..a01334814e1b 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models.go @@ -907,6 +907,38 @@ type CheckSKUAvailabilityParameter struct { Type *string } +// ClusterComputeProperties - Properties for a Cluster (AKS-backed) compute resource. +type ClusterComputeProperties struct { + // CONSTANT; The type of compute resource. + // Field has constant value ComputeTypeCluster, any specified value is ignored. + ComputeType *ComputeType + + // REQUIRED; Pools attached to this compute cluster. + Pools []*Pool + + // ARM ID of the subnet used for compute. + SubnetArmID *string + + // READ-ONLY; Creation time of the compute resource. + CreationTime *time.Time + + // READ-ONLY; Error details for the compute resource. + Errors []*ErrorDetail + + // READ-ONLY; Provisioning state of the compute resource. + ProvisioningState *ComputeProvisioningState +} + +// GetComputeProperties implements the ComputePropertiesClassification interface for type ClusterComputeProperties. +func (c *ClusterComputeProperties) GetComputeProperties() *ComputeProperties { + return &ComputeProperties{ + ComputeType: c.ComputeType, + CreationTime: c.CreationTime, + Errors: c.Errors, + ProvisioningState: c.ProvisioningState, + } +} + // CommitmentCost - Cognitive Services account commitment cost. type CommitmentCost struct { // Commitment meter Id. @@ -1100,6 +1132,49 @@ type CommitmentTierListResult struct { Value []*CommitmentTier } +// Compute - Cognitive Services compute resource. Supports polymorphic compute types +// (Cluster, ContainerInstance) via the computeType discriminator in properties. +type Compute struct { + // REQUIRED; Polymorphic properties of the compute resource. Use computeType to select Cluster or ContainerInstance. + Properties ComputePropertiesClassification + + // Identity for the resource. + Identity *Identity + + // The kind (type) of compute resource. + Kind *string + + // The location of the compute resource. + Location *string + + // 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ComputeListResult - The list of cognitive services computes operation response. +type ComputeListResult struct { + // The link used to get the next page of compute list. + NextLink *string + + // Gets the list of computes. + Value []*Compute +} + // ComputeOperationStatus - The status of an async compute operation. type ComputeOperationStatus struct { // The properties of the compute operation status. @@ -1133,6 +1208,25 @@ type ComputeOperationStatusProperties struct { StartTime *time.Time } +// ComputeProperties - Base properties for all compute resource types. +// The computeType discriminator determines the concrete property shape. +type ComputeProperties struct { + // REQUIRED; The type of compute resource. + ComputeType *ComputeType + + // READ-ONLY; Creation time of the compute resource. + CreationTime *time.Time + + // READ-ONLY; Error details for the compute resource. + Errors []*ErrorDetail + + // READ-ONLY; Provisioning state of the compute resource. + ProvisioningState *ComputeProvisioningState +} + +// GetComputeProperties implements the ComputePropertiesClassification interface for type ComputeProperties. +func (c *ComputeProperties) GetComputeProperties() *ComputeProperties { return c } + // ConnectionAPIKey - Api key object for connection credential. type ConnectionAPIKey struct { Key *string @@ -1267,6 +1361,56 @@ type ConnectionUsernamePassword struct { Username *string } +// ConnectivityEndpoints - Network connectivity endpoints for a Container Instance compute. +type ConnectivityEndpoints struct { + // READ-ONLY; The public IP address of the compute instance. + PublicIPAddress *string + + // READ-ONLY; The SSH port for the compute instance. + SSHPort *int32 +} + +// ContainerInstanceComputeProperties - Properties for a Container Instance compute resource. +type ContainerInstanceComputeProperties struct { + // CONSTANT; The type of compute resource. + // Field has constant value ComputeTypeContainerInstance, any specified value is ignored. + ComputeType *ComputeType + + // REQUIRED; Container image URI (e.g., MCR or ACR image path) for the container instance. + ImageLink *string + + // REQUIRED; ARM resource ID of the parent cluster that hosts this container instance. + TargetClusterID *string + + // ISO 8601 duration before the idle instance is automatically shut down (e.g., 'PT30M'). + IdleTimeBeforeShutdown *string + + // SSH configuration for remote access to the container instance. + SSHSettings *SSHSettings + + // READ-ONLY; Network connectivity endpoints assigned to the container instance. + ConnectivityEndpoints *ConnectivityEndpoints + + // READ-ONLY; Creation time of the compute resource. + CreationTime *time.Time + + // READ-ONLY; Error details for the compute resource. + Errors []*ErrorDetail + + // READ-ONLY; Provisioning state of the compute resource. + ProvisioningState *ComputeProvisioningState +} + +// GetComputeProperties implements the ComputePropertiesClassification interface for type ContainerInstanceComputeProperties. +func (c *ContainerInstanceComputeProperties) GetComputeProperties() *ComputeProperties { + return &ComputeProperties{ + ComputeType: c.ComputeType, + CreationTime: c.CreationTime, + Errors: c.Errors, + ProvisioningState: c.ProvisioningState, + } +} + // CustomBlocklistConfig - Gets or sets the source to which filter applies. type CustomBlocklistConfig struct { // If blocking would occur. @@ -1346,18 +1490,6 @@ func (c *CustomKeysConnectionProperties) GetConnectionPropertiesV2() *Connection } } -// CustomTopicConfig - Gets or sets the source to which filter applies. -type CustomTopicConfig struct { - // If blocking would occur. - Blocking *bool - - // Content source to apply the Content Filters. - Source *RaiPolicyContentSource - - // Name of RAI topic. - TopicName *string -} - // DefenderForAISetting - The Defender for AI resource. type DefenderForAISetting struct { // The Defender for AI resource properties. @@ -1468,6 +1600,18 @@ type DeploymentModel struct { CallRateLimit *CallRateLimit } +// DeploymentPolicyEvaluationResult - Policy evaluation result for a single deployment. +type DeploymentPolicyEvaluationResult struct { + // Error message if the evaluation outcome is Error. + ErrorMessage *string + + // The evaluation outcome. + EvaluationOutcome *PolicyEvaluationOutcome + + // Details of non-compliant policy assignments. + NonCompliantAssignments []*PolicyAssignmentEvaluationDetails +} + // DeploymentProperties - Properties of Cognitive Services account deployment. type DeploymentProperties struct { // Internal use only. @@ -1489,9 +1633,9 @@ type DeploymentProperties struct { // The name of RAI policy. RaiPolicyName *string - // Routing configuration for the deployment. This property is only applicable when the deployed model is 'model-router' version - // 2025-11-18 or later. Allows you to select the models subset for routing and the routing mode (balanced, accuracy, cost) - // for routing across all supported models or the model subset. + // Routing configuration for the model-router deployment. This property is only applicable when the deployed model is 'model-router' + // version 2025-11-18 or later. Allows you to select the models subset for routing and the routing mode (balanced, quality, + // cost) for routing across all supported models or the model subset. Routing *DeploymentRouting // Properties of Cognitive Services account deployment model. (Deprecated, please use Deployment.sku instead.) @@ -1525,13 +1669,14 @@ type DeploymentProperties struct { RateLimits []*ThrottlingRule } -// DeploymentRouting - Routing configuration for the deployment. Specifies how requests are routed across multiple models. +// DeploymentRouting - Routing configuration for the model-router deployment. Specifies how requests are routed across multiple +// models. type DeploymentRouting struct { - // The routing mode that determines how requests are distributed across models. + // The model-router routing mode that determines how requests are distributed across models. Mode *RoutingMode - // Optional. The list of models that the model router can use to route requests across. If not specified, the model router - // will route to all available models specified in the model-router version. + // Optional. The list of model-router supported models that the model router can use to route requests across. If not specified, + // the model router will route to all available models specified in the model-router version. Models []*DeploymentModel } @@ -1557,6 +1702,18 @@ type DeploymentScaleSettings struct { ActiveCapacity *int32 } +// DeploymentSizeCapacity - Capacity information for a specific deployment size. +type DeploymentSizeCapacity struct { + // READ-ONLY; The largest contiguous deployment capacity available for this deployment size. + LargestDeploymentCapacity *int32 + + // READ-ONLY; The number of accelerators required per model instance. + ModelInstanceAcceleratorCount *int32 + + // READ-ONLY; The total available capacity for this deployment size. + TotalAvailableCapacity *int32 +} + // DomainAvailability - Domain availability. type DomainAvailability struct { // Indicates the given SKU is available or not. @@ -1659,6 +1816,36 @@ type ErrorDetail struct { Target *string } +// EvaluateDeploymentPoliciesDeployment - A hypothetical deployment definition used for policy dry-run evaluation. +type EvaluateDeploymentPoliciesDeployment struct { + // REQUIRED; The name of the hypothetical deployment. + Name *string + + // REQUIRED; Properties of the hypothetical deployment. + Properties *EvaluateDeploymentPoliciesDeploymentProperties +} + +// EvaluateDeploymentPoliciesDeploymentProperties - Properties of a hypothetical deployment for policy evaluation. +type EvaluateDeploymentPoliciesDeploymentProperties struct { + // REQUIRED; The model to evaluate. + Model *DeploymentModel + + // The name of the RAI policy to evaluate. + RaiPolicyName *string +} + +// EvaluateDeploymentPoliciesRequest - Request body for the evaluateDeploymentPolicies action. +type EvaluateDeploymentPoliciesRequest struct { + // REQUIRED; The list of hypothetical deployments to evaluate against Azure Policy. + Deployments []*EvaluateDeploymentPoliciesDeployment +} + +// EvaluateDeploymentPoliciesResponse - Response body for the evaluateDeploymentPolicies action. +type EvaluateDeploymentPoliciesResponse struct { + // Per-deployment policy evaluation results, keyed by deployment name. + Results map[string]*DeploymentPolicyEvaluationResult +} + // FoundryAutoUpgrade - Represents the foundry auto-upgrade configuration for a Cognitive Services account. // Customers can opt out of auto-upgrade by setting mode to Disabled. type FoundryAutoUpgrade struct { @@ -1842,6 +2029,198 @@ func (m *ManagedAgentDeployment) GetAgentDeploymentProperties() *AgentDeployment } } +// ManagedComputeCapacity - Managed compute capacity information for Cognitive Services managed compute deployments. +// Provides available accelerator capacity per type and region at the subscription level. +type ManagedComputeCapacity struct { + // Properties of the managed compute capacity resource. + Properties *ManagedComputeCapacityProperties + + // 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ManagedComputeCapacityListResult - The list of managed compute capacities response. +type ManagedComputeCapacityListResult struct { + // The link used to get the next page of managed compute capacities. + NextLink *string + + // READ-ONLY; Gets the list of managed compute capacities. + Value []*ManagedComputeCapacity +} + +// ManagedComputeCapacityProperties - Properties of a managed compute capacity resource. +type ManagedComputeCapacityProperties struct { + // READ-ONLY; The type of accelerator (e.g., Azure.A100, Azure.H100). + AcceleratorType *string + + // READ-ONLY; The number of available accelerators in the region. + AvailableAccelerators *int32 + + // READ-ONLY; Capacity information broken down by deployment size. + DeploymentSizeCapacities []*DeploymentSizeCapacity + + // READ-ONLY; The Azure region where the capacity is available. + Location *string +} + +// ManagedComputeDeployment - Cognitive Services account managed compute deployment, backed by managed compute (GPU) resources. +type ManagedComputeDeployment struct { + // Properties of the Cognitive Services managed compute deployment. + Properties *ManagedComputeDeploymentProperties + + // The resource model definition representing SKU + SKU *SKU + + // 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ManagedComputeDeploymentInfo - Deployment detail within a managed compute usage entry. +type ManagedComputeDeploymentInfo struct { + // Number of GPUs consumed by this deployment. + AcceleratorCount *int64 + + // Full ARM resource ID of the deployment. + DeploymentID *string + + // Number of instances for this deployment. + InstanceCount *int32 + + // Model name (e.g., 'azureml://registries//models//versions/gpt-4o'). + ModelID *string + + // Full ARM resource ID of the account/project. + ProjectID *string +} + +// ManagedComputeDeploymentListResult - The list of managed compute deployments. +type ManagedComputeDeploymentListResult struct { + // The link used to get the next page of managed compute deployments. + NextLink *string + + // READ-ONLY; Gets the list of managed compute deployments and their properties. + Value []*ManagedComputeDeployment +} + +// ManagedComputeDeploymentProperties - Properties of a Cognitive Services managed compute deployment. +type ManagedComputeDeploymentProperties struct { + // REQUIRED; AzureML Registry model asset URI. Required on creation; immutable after creation. + // Example: azureml://registries/{registry}/models/{model}/versions/{version} + Model *string + + // Accelerator type (e.g., H100_80GB). Optional on creation; immutable after creation. + AcceleratorType *string + + // Foundry compute ARM resource ID for VM-backed managed compute deployments. Required when sku.name is VmManagedCompute; + // immutable after creation. + ComputeID *string + + // Deployment template identifier. Optional on creation. + // Accepts an AzureML Registry deployment template URI or a project-scoped deployment template path for VmManagedCompute. + // Examples: azureml://registries/{registry}/deploymenttemplates/{template}/versions/{version}, projects/{project}/deploymentTemplates/{template}/versions/{version} + DeploymentTemplate *string + + // Scheduling priority for VM-backed managed compute deployments. Immutable after creation. + Priority *string + + // Template auto-upgrade policy. Defaults to OnceNewDefaultVersionAvailable. + VersionUpgradeOption *DeploymentModelVersionUpgradeOption + + // READ-ONLY; Read-only. Number of accelerators (GPUs) consumed by each model instance, sourced from the deployment template. + AcceleratorsPerInstance *int32 + + // READ-ONLY; Read-only. Status message and timestamp from the last provisioning operation. + ProvisioningDetails *ManagedComputeDeploymentProvisioningDetails + + // READ-ONLY; Read-only. Current provisioning state. + ProvisioningState *ProvisioningState + + // READ-ONLY; Read-only. Inference route paths relative to the account endpoint. Populated when provisioningState is Succeeded. + Routes *ManagedComputeDeploymentRoutes + + // READ-ONLY; Read-only. Total accelerators allocated: sku.capacity (instances) x acceleratorsPerInstance. + TotalAccelerators *int32 +} + +// ManagedComputeDeploymentProvisioningDetails - Provisioning status details for a managed compute deployment. +type ManagedComputeDeploymentProvisioningDetails struct { + // Timestamp of the last provisioning operation. + LastOperationTimestamp *time.Time + + // A human-readable status message from the last provisioning operation. + Message *string +} + +// ManagedComputeDeploymentRoutes - Inference route paths for a managed compute deployment, relative to the account endpoint. +// Populated when provisioningState is Succeeded. +type ManagedComputeDeploymentRoutes struct { + // Relative path to the chat completions scoring endpoint. + ChatCompletionsScoringPath *string + + // Relative path to the messages API scoring endpoint. + MessagesAPIScoringPath *string + + // Relative path to the Swagger/OpenAPI endpoint. + Swagger *string +} + +// ManagedComputeUsage - Managed compute quota usage for a specific SKU. +type ManagedComputeUsage struct { + // Current value for this metric. + CurrentValue *float64 + + // Deployments consuming this managed compute quota. + Deployments []*ManagedComputeDeploymentInfo + + // Maximum value for this metric. + Limit *float64 + + // Offer scope (e.g., 'Global', 'Datazone-US'). + OfferScope *string + + // The unit of the metric. + Unit *UnitType + + // READ-ONLY; Fully qualified resource ID for the managed compute usage. + ID *string + + // READ-ONLY; The name information for the metric. + Name *MetricName + + // READ-ONLY; The resource type. + Type *string +} + +// ManagedComputeUsageListResult - List of managed compute quota entries. +type ManagedComputeUsageListResult struct { + // The link used to get the next page of managed compute usages. + NextLink *string + + // Per-SKU managed compute quota usage entries. + Value []*ManagedComputeUsage +} + type ManagedIdentityAuthTypeConnectionProperties struct { // CONSTANT; Authentication type of the connection target // Field has constant value ConnectionAuthTypeManagedIdentity, any specified value is ignored. @@ -2588,6 +2967,12 @@ func (p *PATAuthTypeConnectionProperties) GetConnectionPropertiesV2() *Connectio } } +// PatchResourceSKU - The object being used to update sku of a resource, in general used for PATCH operations. +type PatchResourceSKU struct { + // The resource model definition representing SKU + SKU *SKU +} + // PatchResourceTagsAndSKU - The object being used to update tags and sku of a resource, in general used for PATCH operations. type PatchResourceTagsAndSKU struct { // The resource model definition representing SKU @@ -2597,6 +2982,66 @@ type PatchResourceTagsAndSKU struct { Tags map[string]*string } +// PolicyAssignmentEvaluationDetails - Details of a non-compliant policy assignment. +type PolicyAssignmentEvaluationDetails struct { + // The policy assignment ID. + AssignmentID *string + + // The policy effect (e.g., Deny, Audit). + Effect *string + + // The evaluation outcome for this assignment. + EvaluationOutcome *PolicyEvaluationOutcome + + // Expression-level evaluation details. + ExpressionEvaluations []*PolicyExpressionEvaluationDetails + + // The reason for non-compliance. + NonComplianceReason *string + + // The policy definition ID. + PolicyDefinitionID *string + + // The policy set definition ID. + PolicySetDefinitionID *string +} + +// PolicyExpressionEvaluationDetails - Details of a policy expression evaluation. +type PolicyExpressionEvaluationDetails struct { + // The policy expression. + Expression *string + + // The kind of expression. + ExpressionKind *string + + // The actual value of the expression. + ExpressionValue *string + + // The operator used in evaluation. + Operator *string + + // The evaluation result. + Result *string + + // The target value of the expression. + TargetValue *string +} + +// Pool - A compute pool configuration. +type Pool struct { + // REQUIRED; The instance type (VM SKU) used in the pool. + InstanceType *string + + // REQUIRED; The name of the pool. + Name *string + + // REQUIRED; The number of nodes in the pool. + NodeCount *int32 + + // REQUIRED; The VM priority of the pool. + VMPriority *VMPriority +} + // PrivateEndpoint - The private endpoint resource. type PrivateEndpoint struct { // READ-ONLY; The resource identifier of the private endpoint @@ -3065,51 +3510,6 @@ type RaiContentFilterProperties struct { Source *RaiPolicyContentSource } -// RaiExternalSafetyProvider - Cognitive Services Rai External Safety provider. -type RaiExternalSafetyProvider struct { - // Properties of Cognitive Services Rai External Safety provider. - Properties *RaiExternalSafetyProviderProperties - - // 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; Resource tags. - Tags map[string]*string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// RaiExternalSafetyProviderProperties - RAI External SafetyProvider properties. -type RaiExternalSafetyProviderProperties struct { - // Creation time of the safety provider. - CreatedAt *time.Time - - // Last modified time of the safety provider. - LastModifiedAt *time.Time - - // Safety provider mode sync/async. - Mode *string - - // The unique identifier of the safety provider. - ProviderID *string - - // Name of the safety provider. - ProviderName *string - - // Webhook URL for the safety provider. - URL *string -} - // RaiExternalSafetyProviderResult - The list of cognitive services RAI External Safety Providers. type RaiExternalSafetyProviderResult struct { // The link used to get the next page of Rai External Safety Provider. @@ -3247,9 +3647,6 @@ type RaiPolicyProperties struct { // The list of custom Blocklist. CustomBlocklists []*CustomBlocklistConfig - // The list of custom rai topics. - CustomTopics []*CustomTopicConfig - // Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronous_filter =3. Please // use 'Asynchronous_filter' after 2025-06-01. It is the same as 'Deferred' in previous version. Mode *RaiPolicyMode @@ -3622,6 +4019,15 @@ type SKUResource struct { SKU *SKU } +// SSHSettings - SSH configuration for a Container Instance compute. +type SSHSettings struct { + // Whether SSH admin access is enabled. + AdminEnabled *bool + + // The SSH public key for authenticating to the compute instance. + SSHPublicKey *string +} + // SafetyProviderConfig - Gets or sets the source to which safety providers applies. type SafetyProviderConfig struct { // If blocking would occur. @@ -3926,3 +4332,76 @@ type VirtualNetworkRule struct { // Gets the state of virtual network rule. State *string } + +// Workbench resource under a Cognitive Services project. +// Provides interactive compute with data access for AI development. +type Workbench struct { + // REQUIRED; Properties of the workbench resource. + Properties *WorkbenchProperties + + // Identity for the resource. + Identity *Identity + + // The location of the workbench resource. + Location *string + + // 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// WorkbenchListResult - The list of workbenches operation response. +type WorkbenchListResult struct { + // The link used to get the next page of workbench list. + NextLink *string + + // Gets the list of workbenches. + Value []*Workbench +} + +// WorkbenchProperties - Properties for a Workbench resource. +type WorkbenchProperties struct { + // REQUIRED; Container image URI (e.g., MCR or ACR image path) for the workbench. + ImageLink *string + + // REQUIRED; ARM resource ID of the parent cluster that hosts this workbench. + TargetClusterID *string + + // The dataset ID to mount for the workbench. + DatasetID *string + + // ISO 8601 duration before the idle workbench is automatically shut down (e.g., 'PT30M'). + IdleTimeBeforeShutdown *string + + // SSH configuration for remote access to the workbench. + SSHSettings *SSHSettings + + // READ-ONLY; Network connectivity endpoints assigned to the workbench. + ConnectivityEndpoints *ConnectivityEndpoints + + // READ-ONLY; Creation time of the workbench resource. + CreationTime *time.Time + + // READ-ONLY; Error details for the workbench resource. + Errors []*ErrorDetail + + // READ-ONLY; Provisioning state of the workbench resource. + ProvisioningState *ComputeProvisioningState + + // READ-ONLY; The web endpoint URL for accessing the workbench. + WebEndpoint *string +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go index 751c4eb78678..6c7ed484ec8c 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client.go @@ -18,6 +18,8 @@ import ( // ModelsClient contains the methods for the Models group. // Don't use this type directly, use NewModelsClient() instead. +// +// Generated from API version 2026-03-15-preview type ModelsClient struct { internal *arm.Client subscriptionID string @@ -40,8 +42,6 @@ func NewModelsClient(subscriptionID string, credential azcore.TokenCredential, o } // NewListPager - List Models. -// -// Generated from API version 2026-01-15-preview // - location - The location name. // - options - ModelsClientListOptions contains the optional parameters for the ModelsClient.NewListPager method. func (client *ModelsClient) NewListPager(location string, options *ModelsClientListOptions) *runtime.Pager[ModelsClientListResponse] { @@ -83,8 +83,8 @@ func (client *ModelsClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 index d77b1b56deb9..5c148d471573 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ListLocationModels.json +// Generated from example definition: 2026-03-15-preview/ListLocationModels.json func ExampleModelsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go index 9a26bd14c6f7..897b40c213f4 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/models_serde.go @@ -1885,6 +1885,53 @@ func (c *CheckSKUAvailabilityParameter) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ClusterComputeProperties. +func (c ClusterComputeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["computeType"] = ComputeTypeCluster + populateTime[datetime.RFC3339](objectMap, "creationTime", c.CreationTime) + populate(objectMap, "errors", c.Errors) + populate(objectMap, "pools", c.Pools) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "subnetArmId", c.SubnetArmID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterComputeProperties. +func (c *ClusterComputeProperties) 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 "computeType": + err = unpopulate(val, "ComputeType", &c.ComputeType) + delete(rawMsg, key) + case "creationTime": + err = unpopulateTime[datetime.RFC3339](val, "CreationTime", &c.CreationTime) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &c.Errors) + delete(rawMsg, key) + case "pools": + err = unpopulate(val, "Pools", &c.Pools) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "subnetArmId": + err = unpopulate(val, "SubnetArmID", &c.SubnetArmID) + 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 CommitmentCost. func (c CommitmentCost) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2369,6 +2416,100 @@ func (c *CommitmentTierListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Compute. +func (c Compute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "kind", c.Kind) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Compute. +func (c *Compute) 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 "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &c.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + c.Properties, err = unmarshalComputePropertiesClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComputeListResult. +func (c ComputeListResult) 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 ComputeListResult. +func (c *ComputeListResult) 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 ComputeOperationStatus. func (c ComputeOperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2451,6 +2592,45 @@ func (c *ComputeOperationStatusProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ComputeProperties. +func (c ComputeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "computeType", c.ComputeType) + populateTime[datetime.RFC3339](objectMap, "creationTime", c.CreationTime) + populate(objectMap, "errors", c.Errors) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComputeProperties. +func (c *ComputeProperties) 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 "computeType": + err = unpopulate(val, "ComputeType", &c.ComputeType) + delete(rawMsg, key) + case "creationTime": + err = unpopulateTime[datetime.RFC3339](val, "CreationTime", &c.CreationTime) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &c.Errors) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + 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) @@ -2922,6 +3102,96 @@ func (c *ConnectionUsernamePassword) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ConnectivityEndpoints. +func (c ConnectivityEndpoints) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "publicIpAddress", c.PublicIPAddress) + populate(objectMap, "sshPort", c.SSHPort) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectivityEndpoints. +func (c *ConnectivityEndpoints) 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 "publicIpAddress": + err = unpopulate(val, "PublicIPAddress", &c.PublicIPAddress) + delete(rawMsg, key) + case "sshPort": + err = unpopulate(val, "SSHPort", &c.SSHPort) + 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 ContainerInstanceComputeProperties. +func (c ContainerInstanceComputeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["computeType"] = ComputeTypeContainerInstance + populate(objectMap, "connectivityEndpoints", c.ConnectivityEndpoints) + populateTime[datetime.RFC3339](objectMap, "creationTime", c.CreationTime) + populate(objectMap, "errors", c.Errors) + populate(objectMap, "idleTimeBeforeShutdown", c.IdleTimeBeforeShutdown) + populate(objectMap, "imageLink", c.ImageLink) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "sshSettings", c.SSHSettings) + populate(objectMap, "targetClusterId", c.TargetClusterID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerInstanceComputeProperties. +func (c *ContainerInstanceComputeProperties) 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 "computeType": + err = unpopulate(val, "ComputeType", &c.ComputeType) + delete(rawMsg, key) + case "connectivityEndpoints": + err = unpopulate(val, "ConnectivityEndpoints", &c.ConnectivityEndpoints) + delete(rawMsg, key) + case "creationTime": + err = unpopulateTime[datetime.RFC3339](val, "CreationTime", &c.CreationTime) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &c.Errors) + delete(rawMsg, key) + case "idleTimeBeforeShutdown": + err = unpopulate(val, "IdleTimeBeforeShutdown", &c.IdleTimeBeforeShutdown) + delete(rawMsg, key) + case "imageLink": + err = unpopulate(val, "ImageLink", &c.ImageLink) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "sshSettings": + err = unpopulate(val, "SSHSettings", &c.SSHSettings) + delete(rawMsg, key) + case "targetClusterId": + err = unpopulate(val, "TargetClusterID", &c.TargetClusterID) + 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 CustomBlocklistConfig. func (c CustomBlocklistConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3063,41 +3333,6 @@ func (c *CustomKeysConnectionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomTopicConfig. -func (c CustomTopicConfig) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "blocking", c.Blocking) - populate(objectMap, "source", c.Source) - populate(objectMap, "topicName", c.TopicName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomTopicConfig. -func (c *CustomTopicConfig) 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 "blocking": - err = unpopulate(val, "Blocking", &c.Blocking) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &c.Source) - delete(rawMsg, key) - case "topicName": - err = unpopulate(val, "TopicName", &c.TopicName) - 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 DefenderForAISetting. func (d DefenderForAISetting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3375,6 +3610,41 @@ func (d *DeploymentModel) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DeploymentPolicyEvaluationResult. +func (d DeploymentPolicyEvaluationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorMessage", d.ErrorMessage) + populate(objectMap, "evaluationOutcome", d.EvaluationOutcome) + populate(objectMap, "nonCompliantAssignments", d.NonCompliantAssignments) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPolicyEvaluationResult. +func (d *DeploymentPolicyEvaluationResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &d.ErrorMessage) + delete(rawMsg, key) + case "evaluationOutcome": + err = unpopulate(val, "EvaluationOutcome", &d.EvaluationOutcome) + delete(rawMsg, key) + case "nonCompliantAssignments": + err = unpopulate(val, "NonCompliantAssignments", &d.NonCompliantAssignments) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DeploymentProperties. func (d DeploymentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3559,19 +3829,17 @@ func (d *DeploymentScaleSettings) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DomainAvailability. -func (d DomainAvailability) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentSizeCapacity. +func (d DeploymentSizeCapacity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isSubdomainAvailable", d.IsSubdomainAvailable) - populate(objectMap, "kind", d.Kind) - populate(objectMap, "reason", d.Reason) - populate(objectMap, "subdomainName", d.SubdomainName) - populate(objectMap, "type", d.Type) + populate(objectMap, "largestDeploymentCapacity", d.LargestDeploymentCapacity) + populate(objectMap, "modelInstanceAcceleratorCount", d.ModelInstanceAcceleratorCount) + populate(objectMap, "totalAvailableCapacity", d.TotalAvailableCapacity) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DomainAvailability. -func (d *DomainAvailability) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentSizeCapacity. +func (d *DeploymentSizeCapacity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -3579,14 +3847,51 @@ func (d *DomainAvailability) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "isSubdomainAvailable": - err = unpopulate(val, "IsSubdomainAvailable", &d.IsSubdomainAvailable) + case "largestDeploymentCapacity": + err = unpopulate(val, "LargestDeploymentCapacity", &d.LargestDeploymentCapacity) delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &d.Kind) + case "modelInstanceAcceleratorCount": + err = unpopulate(val, "ModelInstanceAcceleratorCount", &d.ModelInstanceAcceleratorCount) delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &d.Reason) + case "totalAvailableCapacity": + err = unpopulate(val, "TotalAvailableCapacity", &d.TotalAvailableCapacity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DomainAvailability. +func (d DomainAvailability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isSubdomainAvailable", d.IsSubdomainAvailable) + populate(objectMap, "kind", d.Kind) + populate(objectMap, "reason", d.Reason) + populate(objectMap, "subdomainName", d.SubdomainName) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DomainAvailability. +func (d *DomainAvailability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isSubdomainAvailable": + err = unpopulate(val, "IsSubdomainAvailable", &d.IsSubdomainAvailable) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &d.Reason) delete(rawMsg, key) case "subdomainName": err = unpopulate(val, "SubdomainName", &d.SubdomainName) @@ -3828,6 +4133,122 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EvaluateDeploymentPoliciesDeployment. +func (e EvaluateDeploymentPoliciesDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EvaluateDeploymentPoliciesDeployment. +func (e *EvaluateDeploymentPoliciesDeployment) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EvaluateDeploymentPoliciesDeploymentProperties. +func (e EvaluateDeploymentPoliciesDeploymentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "model", e.Model) + populate(objectMap, "raiPolicyName", e.RaiPolicyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EvaluateDeploymentPoliciesDeploymentProperties. +func (e *EvaluateDeploymentPoliciesDeploymentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "model": + err = unpopulate(val, "Model", &e.Model) + delete(rawMsg, key) + case "raiPolicyName": + err = unpopulate(val, "RaiPolicyName", &e.RaiPolicyName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EvaluateDeploymentPoliciesRequest. +func (e EvaluateDeploymentPoliciesRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deployments", e.Deployments) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EvaluateDeploymentPoliciesRequest. +func (e *EvaluateDeploymentPoliciesRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deployments": + err = unpopulate(val, "Deployments", &e.Deployments) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EvaluateDeploymentPoliciesResponse. +func (e EvaluateDeploymentPoliciesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "results", e.Results) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EvaluateDeploymentPoliciesResponse. +func (e *EvaluateDeploymentPoliciesResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "results": + err = unpopulate(val, "Results", &e.Results) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type FoundryAutoUpgrade. func (f FoundryAutoUpgrade) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3970,139 +4391,617 @@ func (h *HostedAgentDeployment) UnmarshalJSON(data []byte) error { case "state": err = unpopulate(val, "State", &h.State) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &h.Tags) + case "tags": + err = unpopulate(val, "Tags", &h.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. +func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identityClientId", k.IdentityClientID) + populate(objectMap, "keyName", k.KeyName) + populate(objectMap, "keyVaultUri", k.KeyVaultURI) + populate(objectMap, "keyVersion", k.KeyVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. +func (k *KeyVaultProperties) 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", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identityClientId": + err = unpopulate(val, "IdentityClientID", &k.IdentityClientID) + delete(rawMsg, key) + case "keyName": + err = unpopulate(val, "KeyName", &k.KeyName) + delete(rawMsg, key) + case "keyVaultUri": + err = unpopulate(val, "KeyVaultURI", &k.KeyVaultURI) + delete(rawMsg, key) + case "keyVersion": + err = unpopulate(val, "KeyVersion", &k.KeyVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedAgentDeployment. +func (m ManagedAgentDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "agents", m.Agents) + populate(objectMap, "deploymentId", m.DeploymentID) + objectMap["deploymentType"] = AgentDeploymentTypeManaged + populate(objectMap, "description", m.Description) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "protocols", m.Protocols) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "state", m.State) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedAgentDeployment. +func (m *ManagedAgentDeployment) 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 "agents": + err = unpopulate(val, "Agents", &m.Agents) + delete(rawMsg, key) + case "deploymentId": + err = unpopulate(val, "DeploymentID", &m.DeploymentID) + delete(rawMsg, key) + case "deploymentType": + err = unpopulate(val, "DeploymentType", &m.DeploymentType) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "protocols": + err = unpopulate(val, "Protocols", &m.Protocols) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &m.State) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + 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 ManagedComputeCapacity. +func (m ManagedComputeCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedComputeCapacity. +func (m *ManagedComputeCapacity) 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 "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + 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 ManagedComputeCapacityListResult. +func (m ManagedComputeCapacityListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedComputeCapacityListResult. +func (m *ManagedComputeCapacityListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedComputeCapacityProperties. +func (m ManagedComputeCapacityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "acceleratorType", m.AcceleratorType) + populate(objectMap, "availableAccelerators", m.AvailableAccelerators) + populate(objectMap, "deploymentSizeCapacities", m.DeploymentSizeCapacities) + populate(objectMap, "location", m.Location) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedComputeCapacityProperties. +func (m *ManagedComputeCapacityProperties) 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 "acceleratorType": + err = unpopulate(val, "AcceleratorType", &m.AcceleratorType) + delete(rawMsg, key) + case "availableAccelerators": + err = unpopulate(val, "AvailableAccelerators", &m.AvailableAccelerators) + delete(rawMsg, key) + case "deploymentSizeCapacities": + err = unpopulate(val, "DeploymentSizeCapacities", &m.DeploymentSizeCapacities) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + 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 ManagedComputeDeployment. +func (m ManagedComputeDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "sku", m.SKU) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedComputeDeployment. +func (m *ManagedComputeDeployment) 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 "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &m.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + 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 ManagedComputeDeploymentInfo. +func (m ManagedComputeDeploymentInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "acceleratorCount", m.AcceleratorCount) + populate(objectMap, "deploymentId", m.DeploymentID) + populate(objectMap, "instanceCount", m.InstanceCount) + populate(objectMap, "modelId", m.ModelID) + populate(objectMap, "projectId", m.ProjectID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedComputeDeploymentInfo. +func (m *ManagedComputeDeploymentInfo) 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 "acceleratorCount": + err = unpopulate(val, "AcceleratorCount", &m.AcceleratorCount) + delete(rawMsg, key) + case "deploymentId": + err = unpopulate(val, "DeploymentID", &m.DeploymentID) + delete(rawMsg, key) + case "instanceCount": + err = unpopulate(val, "InstanceCount", &m.InstanceCount) + delete(rawMsg, key) + case "modelId": + err = unpopulate(val, "ModelID", &m.ModelID) + delete(rawMsg, key) + case "projectId": + err = unpopulate(val, "ProjectID", &m.ProjectID) + 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 ManagedComputeDeploymentListResult. +func (m ManagedComputeDeploymentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedComputeDeploymentListResult. +func (m *ManagedComputeDeploymentListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedComputeDeploymentProperties. +func (m ManagedComputeDeploymentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "acceleratorType", m.AcceleratorType) + populate(objectMap, "acceleratorsPerInstance", m.AcceleratorsPerInstance) + populate(objectMap, "computeId", m.ComputeID) + populate(objectMap, "deploymentTemplate", m.DeploymentTemplate) + populate(objectMap, "model", m.Model) + populate(objectMap, "priority", m.Priority) + populate(objectMap, "provisioningDetails", m.ProvisioningDetails) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "routes", m.Routes) + populate(objectMap, "totalAccelerators", m.TotalAccelerators) + populate(objectMap, "versionUpgradeOption", m.VersionUpgradeOption) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedComputeDeploymentProperties. +func (m *ManagedComputeDeploymentProperties) 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 "acceleratorType": + err = unpopulate(val, "AcceleratorType", &m.AcceleratorType) + delete(rawMsg, key) + case "acceleratorsPerInstance": + err = unpopulate(val, "AcceleratorsPerInstance", &m.AcceleratorsPerInstance) + delete(rawMsg, key) + case "computeId": + err = unpopulate(val, "ComputeID", &m.ComputeID) + delete(rawMsg, key) + case "deploymentTemplate": + err = unpopulate(val, "DeploymentTemplate", &m.DeploymentTemplate) + delete(rawMsg, key) + case "model": + err = unpopulate(val, "Model", &m.Model) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &m.Priority) + delete(rawMsg, key) + case "provisioningDetails": + err = unpopulate(val, "ProvisioningDetails", &m.ProvisioningDetails) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "routes": + err = unpopulate(val, "Routes", &m.Routes) + delete(rawMsg, key) + case "totalAccelerators": + err = unpopulate(val, "TotalAccelerators", &m.TotalAccelerators) + delete(rawMsg, key) + case "versionUpgradeOption": + err = unpopulate(val, "VersionUpgradeOption", &m.VersionUpgradeOption) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IPRule. -func (i IPRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedComputeDeploymentProvisioningDetails. +func (m ManagedComputeDeploymentProvisioningDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", i.Value) + populateTime[datetime.RFC3339](objectMap, "lastOperationTimestamp", m.LastOperationTimestamp) + populate(objectMap, "message", m.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. -func (i *IPRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedComputeDeploymentProvisioningDetails. +func (m *ManagedComputeDeploymentProvisioningDetails) 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", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &i.Value) + case "lastOperationTimestamp": + err = unpopulateTime[datetime.RFC3339](val, "LastOperationTimestamp", &m.LastOperationTimestamp) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &m.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedComputeDeploymentRoutes. +func (m ManagedComputeDeploymentRoutes) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + populate(objectMap, "chatCompletionsScoringPath", m.ChatCompletionsScoringPath) + populate(objectMap, "messagesApiScoringPath", m.MessagesAPIScoringPath) + populate(objectMap, "swagger", m.Swagger) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. -func (i *Identity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedComputeDeploymentRoutes. +func (m *ManagedComputeDeploymentRoutes) 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", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) + case "chatCompletionsScoringPath": + err = unpopulate(val, "ChatCompletionsScoringPath", &m.ChatCompletionsScoringPath) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "messagesApiScoringPath": + err = unpopulate(val, "MessagesAPIScoringPath", &m.MessagesAPIScoringPath) delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + case "swagger": + err = unpopulate(val, "Swagger", &m.Swagger) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. -func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedComputeUsage. +func (m ManagedComputeUsage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identityClientId", k.IdentityClientID) - populate(objectMap, "keyName", k.KeyName) - populate(objectMap, "keyVaultUri", k.KeyVaultURI) - populate(objectMap, "keyVersion", k.KeyVersion) + populate(objectMap, "currentValue", m.CurrentValue) + populate(objectMap, "deployments", m.Deployments) + populate(objectMap, "id", m.ID) + populate(objectMap, "limit", m.Limit) + populate(objectMap, "name", m.Name) + populate(objectMap, "offerScope", m.OfferScope) + populate(objectMap, "type", m.Type) + populate(objectMap, "unit", m.Unit) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. -func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedComputeUsage. +func (m *ManagedComputeUsage) 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", k, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "identityClientId": - err = unpopulate(val, "IdentityClientID", &k.IdentityClientID) + case "currentValue": + err = unpopulate(val, "CurrentValue", &m.CurrentValue) delete(rawMsg, key) - case "keyName": - err = unpopulate(val, "KeyName", &k.KeyName) + case "deployments": + err = unpopulate(val, "Deployments", &m.Deployments) delete(rawMsg, key) - case "keyVaultUri": - err = unpopulate(val, "KeyVaultURI", &k.KeyVaultURI) + case "id": + err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) - case "keyVersion": - err = unpopulate(val, "KeyVersion", &k.KeyVersion) + case "limit": + err = unpopulate(val, "Limit", &m.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "offerScope": + err = unpopulate(val, "OfferScope", &m.OfferScope) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &m.Unit) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ManagedAgentDeployment. -func (m ManagedAgentDeployment) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedComputeUsageListResult. +func (m ManagedComputeUsageListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "agents", m.Agents) - populate(objectMap, "deploymentId", m.DeploymentID) - objectMap["deploymentType"] = AgentDeploymentTypeManaged - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "protocols", m.Protocols) - populate(objectMap, "provisioningState", m.ProvisioningState) - populate(objectMap, "state", m.State) - populate(objectMap, "tags", m.Tags) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedAgentDeployment. -func (m *ManagedAgentDeployment) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedComputeUsageListResult. +func (m *ManagedComputeUsageListResult) 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) @@ -4110,32 +5009,11 @@ func (m *ManagedAgentDeployment) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "agents": - err = unpopulate(val, "Agents", &m.Agents) - delete(rawMsg, key) - case "deploymentId": - err = unpopulate(val, "DeploymentID", &m.DeploymentID) - delete(rawMsg, key) - case "deploymentType": - err = unpopulate(val, "DeploymentType", &m.DeploymentType) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "protocols": - err = unpopulate(val, "Protocols", &m.Protocols) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &m.State) + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) + case "value": + err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { @@ -5746,8 +6624,188 @@ func (p PATAuthTypeConnectionProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PATAuthTypeConnectionProperties. -func (p *PATAuthTypeConnectionProperties) UnmarshalJSON(data []byte) error { +// 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 = unpopulateTime[datetime.RFC3339](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", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchResourceSKU. +func (p PatchResourceSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sku", p.SKU) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchResourceSKU. +func (p *PatchResourceSKU) 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 "sku": + err = unpopulate(val, "SKU", &p.SKU) + 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 PatchResourceTagsAndSKU. +func (p PatchResourceTagsAndSKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sku", p.SKU) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchResourceTagsAndSKU. +func (p *PatchResourceTagsAndSKU) 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 "sku": + err = unpopulate(val, "SKU", &p.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + 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 PolicyAssignmentEvaluationDetails. +func (p PolicyAssignmentEvaluationDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignmentId", p.AssignmentID) + populate(objectMap, "effect", p.Effect) + populate(objectMap, "evaluationOutcome", p.EvaluationOutcome) + populate(objectMap, "expressionEvaluations", p.ExpressionEvaluations) + populate(objectMap, "nonComplianceReason", p.NonComplianceReason) + populate(objectMap, "policyDefinitionId", p.PolicyDefinitionID) + populate(objectMap, "policySetDefinitionId", p.PolicySetDefinitionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentEvaluationDetails. +func (p *PolicyAssignmentEvaluationDetails) 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 "assignmentId": + err = unpopulate(val, "AssignmentID", &p.AssignmentID) + delete(rawMsg, key) + case "effect": + err = unpopulate(val, "Effect", &p.Effect) + delete(rawMsg, key) + case "evaluationOutcome": + err = unpopulate(val, "EvaluationOutcome", &p.EvaluationOutcome) + delete(rawMsg, key) + case "expressionEvaluations": + err = unpopulate(val, "ExpressionEvaluations", &p.ExpressionEvaluations) + delete(rawMsg, key) + case "nonComplianceReason": + err = unpopulate(val, "NonComplianceReason", &p.NonComplianceReason) + delete(rawMsg, key) + case "policyDefinitionId": + err = unpopulate(val, "PolicyDefinitionID", &p.PolicyDefinitionID) + delete(rawMsg, key) + case "policySetDefinitionId": + err = unpopulate(val, "PolicySetDefinitionID", &p.PolicySetDefinitionID) + 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 PolicyExpressionEvaluationDetails. +func (p PolicyExpressionEvaluationDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "expression", p.Expression) + populate(objectMap, "expressionKind", p.ExpressionKind) + populate(objectMap, "expressionValue", p.ExpressionValue) + populate(objectMap, "operator", p.Operator) + populate(objectMap, "result", p.Result) + populate(objectMap, "targetValue", p.TargetValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyExpressionEvaluationDetails. +func (p *PolicyExpressionEvaluationDetails) 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) @@ -5755,47 +6813,23 @@ func (p *PATAuthTypeConnectionProperties) UnmarshalJSON(data []byte) error { 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 = unpopulateTime[datetime.RFC3339](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) + case "expression": + err = unpopulate(val, "Expression", &p.Expression) delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &p.Metadata) - delete(rawMsg, key) - case "peRequirement": - err = unpopulate(val, "PeRequirement", &p.PeRequirement) + case "expressionKind": + err = unpopulate(val, "ExpressionKind", &p.ExpressionKind) delete(rawMsg, key) - case "peStatus": - err = unpopulate(val, "PeStatus", &p.PeStatus) + case "expressionValue": + err = unpopulate(val, "ExpressionValue", &p.ExpressionValue) delete(rawMsg, key) - case "sharedUserList": - err = unpopulate(val, "SharedUserList", &p.SharedUserList) + case "operator": + err = unpopulate(val, "Operator", &p.Operator) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &p.Target) + case "result": + err = unpopulate(val, "Result", &p.Result) delete(rawMsg, key) - case "useWorkspaceManagedIdentity": - err = unpopulate(val, "UseWorkspaceManagedIdentity", &p.UseWorkspaceManagedIdentity) + case "targetValue": + err = unpopulate(val, "TargetValue", &p.TargetValue) delete(rawMsg, key) } if err != nil { @@ -5805,16 +6839,18 @@ func (p *PATAuthTypeConnectionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PatchResourceTagsAndSKU. -func (p PatchResourceTagsAndSKU) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Pool. +func (p Pool) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "sku", p.SKU) - populate(objectMap, "tags", p.Tags) + populate(objectMap, "instanceType", p.InstanceType) + populate(objectMap, "name", p.Name) + populate(objectMap, "nodeCount", p.NodeCount) + populate(objectMap, "vmPriority", p.VMPriority) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PatchResourceTagsAndSKU. -func (p *PatchResourceTagsAndSKU) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Pool. +func (p *Pool) 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) @@ -5822,11 +6858,17 @@ func (p *PatchResourceTagsAndSKU) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "sku": - err = unpopulate(val, "SKU", &p.SKU) + case "instanceType": + err = unpopulate(val, "InstanceType", &p.InstanceType) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &p.Tags) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "nodeCount": + err = unpopulate(val, "NodeCount", &p.NodeCount) + delete(rawMsg, key) + case "vmPriority": + err = unpopulate(val, "VMPriority", &p.VMPriority) delete(rawMsg, key) } if err != nil { @@ -7079,104 +8121,6 @@ func (r *RaiContentFilterProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RaiExternalSafetyProvider. -func (r RaiExternalSafetyProvider) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", r.Etag) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RaiExternalSafetyProvider. -func (r *RaiExternalSafetyProvider) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &r.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RaiExternalSafetyProviderProperties. -func (r RaiExternalSafetyProviderProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateTime[datetime.RFC3339](objectMap, "createdAt", r.CreatedAt) - populateTime[datetime.RFC3339](objectMap, "lastModifiedAt", r.LastModifiedAt) - populate(objectMap, "mode", r.Mode) - populate(objectMap, "providerId", r.ProviderID) - populate(objectMap, "providerName", r.ProviderName) - populate(objectMap, "url", r.URL) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RaiExternalSafetyProviderProperties. -func (r *RaiExternalSafetyProviderProperties) 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 "createdAt": - err = unpopulateTime[datetime.RFC3339](val, "CreatedAt", &r.CreatedAt) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTime[datetime.RFC3339](val, "LastModifiedAt", &r.LastModifiedAt) - delete(rawMsg, key) - case "mode": - err = unpopulate(val, "Mode", &r.Mode) - delete(rawMsg, key) - case "providerId": - err = unpopulate(val, "ProviderID", &r.ProviderID) - delete(rawMsg, key) - case "providerName": - err = unpopulate(val, "ProviderName", &r.ProviderName) - delete(rawMsg, key) - case "url": - err = unpopulate(val, "URL", &r.URL) - 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 RaiExternalSafetyProviderResult. func (r RaiExternalSafetyProviderResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7484,7 +8428,6 @@ func (r RaiPolicyProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "basePolicyName", r.BasePolicyName) populate(objectMap, "contentFilters", r.ContentFilters) populate(objectMap, "customBlocklists", r.CustomBlocklists) - populate(objectMap, "customTopics", r.CustomTopics) populate(objectMap, "mode", r.Mode) populate(objectMap, "safetyProviders", r.SafetyProviders) populate(objectMap, "type", r.Type) @@ -7509,9 +8452,6 @@ func (r *RaiPolicyProperties) UnmarshalJSON(data []byte) error { case "customBlocklists": err = unpopulate(val, "CustomBlocklists", &r.CustomBlocklists) delete(rawMsg, key) - case "customTopics": - err = unpopulate(val, "CustomTopics", &r.CustomTopics) - delete(rawMsg, key) case "mode": err = unpopulate(val, "Mode", &r.Mode) delete(rawMsg, key) @@ -8445,6 +9385,37 @@ func (s *SKUResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SSHSettings. +func (s SSHSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adminEnabled", s.AdminEnabled) + populate(objectMap, "sshPublicKey", s.SSHPublicKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SSHSettings. +func (s *SSHSettings) 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 "adminEnabled": + err = unpopulate(val, "AdminEnabled", &s.AdminEnabled) + delete(rawMsg, key) + case "sshPublicKey": + err = unpopulate(val, "SSHPublicKey", &s.SSHPublicKey) + 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 SafetyProviderConfig. func (s SafetyProviderConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -9114,6 +10085,159 @@ func (v *VirtualNetworkRule) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Workbench. +func (w Workbench) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", w.Etag) + populate(objectMap, "id", w.ID) + populate(objectMap, "identity", w.Identity) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Workbench. +func (w *Workbench) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &w.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &w.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbenchListResult. +func (w WorkbenchListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbenchListResult. +func (w *WorkbenchListResult) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkbenchProperties. +func (w WorkbenchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectivityEndpoints", w.ConnectivityEndpoints) + populateTime[datetime.RFC3339](objectMap, "creationTime", w.CreationTime) + populate(objectMap, "datasetId", w.DatasetID) + populate(objectMap, "errors", w.Errors) + populate(objectMap, "idleTimeBeforeShutdown", w.IdleTimeBeforeShutdown) + populate(objectMap, "imageLink", w.ImageLink) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "sshSettings", w.SSHSettings) + populate(objectMap, "targetClusterId", w.TargetClusterID) + populate(objectMap, "webEndpoint", w.WebEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkbenchProperties. +func (w *WorkbenchProperties) 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", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectivityEndpoints": + err = unpopulate(val, "ConnectivityEndpoints", &w.ConnectivityEndpoints) + delete(rawMsg, key) + case "creationTime": + err = unpopulateTime[datetime.RFC3339](val, "CreationTime", &w.CreationTime) + delete(rawMsg, key) + case "datasetId": + err = unpopulate(val, "DatasetID", &w.DatasetID) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &w.Errors) + delete(rawMsg, key) + case "idleTimeBeforeShutdown": + err = unpopulate(val, "IdleTimeBeforeShutdown", &w.IdleTimeBeforeShutdown) + delete(rawMsg, key) + case "imageLink": + err = unpopulate(val, "ImageLink", &w.ImageLink) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "sshSettings": + err = unpopulate(val, "SSHSettings", &w.SSHSettings) + delete(rawMsg, key) + case "targetClusterId": + err = unpopulate(val, "TargetClusterID", &w.TargetClusterID) + delete(rawMsg, key) + case "webEndpoint": + err = unpopulate(val, "WebEndpoint", &w.WebEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client.go index eae0aea55fa6..c7b703e812b9 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client.go @@ -18,6 +18,8 @@ import ( // NetworkSecurityPerimeterConfigurationsClient contains the methods for the NetworkSecurityPerimeterConfigurations group. // Don't use this type directly, use NewNetworkSecurityPerimeterConfigurationsClient() instead. +// +// Generated from API version 2026-03-15-preview type NetworkSecurityPerimeterConfigurationsClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - 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. @@ -94,8 +94,8 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) getCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -110,8 +110,6 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) getHandleResponse(re } // NewListPager - Gets a list of NSP configurations for an account. -// -// Generated from API version 2026-01-15-preview // - 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 @@ -159,8 +157,8 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) listCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -176,8 +174,6 @@ 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 2026-01-15-preview // - 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. @@ -202,8 +198,6 @@ 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 2026-01-15-preview 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" @@ -249,8 +243,8 @@ func (client *NetworkSecurityPerimeterConfigurationsClient) reconcileCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 index 2fd59c6fb6df..d500070a90d0 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/networksecurityperimeterconfigurations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/GetNetworkSecurityPerimeterConfigurations.json +// Generated from example definition: 2026-03-15-preview/GetNetworkSecurityPerimeterConfigurations.json func ExampleNetworkSecurityPerimeterConfigurationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -30,7 +30,7 @@ func ExampleNetworkSecurityPerimeterConfigurationsClient_Get() { _ = 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 = armcognitiveservices.NetworkSecurityPerimeterConfigurationsClientGetResponse{ - // NetworkSecurityPerimeterConfiguration: &armcognitiveservices.NetworkSecurityPerimeterConfiguration{ + // 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/config1"), @@ -66,7 +66,7 @@ func ExampleNetworkSecurityPerimeterConfigurationsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListNetworkSecurityPerimeterConfigurations.json +// Generated from example definition: 2026-03-15-preview/ListNetworkSecurityPerimeterConfigurations.json func ExampleNetworkSecurityPerimeterConfigurationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -130,7 +130,7 @@ func ExampleNetworkSecurityPerimeterConfigurationsClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/ReconcileNetworkSecurityPerimeterConfigurations.json +// Generated from example definition: 2026-03-15-preview/ReconcileNetworkSecurityPerimeterConfigurations.json func ExampleNetworkSecurityPerimeterConfigurationsClient_BeginReconcile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -147,13 +147,13 @@ func ExampleNetworkSecurityPerimeterConfigurationsClient_BeginReconcile() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.NetworkSecurityPerimeterConfigurationsClientReconcileResponse{ - // NetworkSecurityPerimeterConfiguration: &armcognitiveservices.NetworkSecurityPerimeterConfiguration{ + // 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/config1"), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go index 11a9b4bf4be7..03073c84f165 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client.go @@ -11,10 +11,13 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" + "strings" ) // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. +// +// Generated from API version 2026-03-15-preview type OperationsClient struct { internal *arm.Client } @@ -34,8 +37,6 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all the available Cognitive Services account operations. -// -// Generated from API version 2026-01-15-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -68,8 +69,8 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *Operat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client_example_test.go index e6e8190d1409..2e3976844065 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/operations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/GetOperations.json +// Generated from example definition: 2026-03-15-preview/GetOperations.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/options.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/options.go index ade71840d4e5..ebd6bc55c7ea 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/options.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/options.go @@ -79,6 +79,12 @@ type AccountsClientBeginUpdateOptions struct { ResumeToken string } +// AccountsClientEvaluateDeploymentPoliciesOptions contains the optional parameters for the AccountsClient.EvaluateDeploymentPolicies +// method. +type AccountsClientEvaluateDeploymentPoliciesOptions struct { + // placeholder for future optional parameters +} + // AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. type AccountsClientGetOptions struct { // placeholder for future optional parameters @@ -322,6 +328,52 @@ type ComputeOperationsClientGetOptions struct { // placeholder for future optional parameters } +// ComputesClientBeginCreateOrUpdateOptions contains the optional parameters for the ComputesClient.BeginCreateOrUpdate method. +type ComputesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ComputesClientBeginDeleteOptions contains the optional parameters for the ComputesClient.BeginDelete method. +type ComputesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ComputesClientBeginRestartOptions contains the optional parameters for the ComputesClient.BeginRestart method. +type ComputesClientBeginRestartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ComputesClientBeginStartOptions contains the optional parameters for the ComputesClient.BeginStart method. +type ComputesClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ComputesClientBeginStopOptions contains the optional parameters for the ComputesClient.BeginStop method. +type ComputesClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ComputesClientBeginUpdateOptions contains the optional parameters for the ComputesClient.BeginUpdate method. +type ComputesClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ComputesClientGetOptions contains the optional parameters for the ComputesClient.Get method. +type ComputesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ComputesClientListOptions contains the optional parameters for the ComputesClient.NewListPager method. +type ComputesClientListOptions struct { + // placeholder for future optional parameters +} + // DefenderForAISettingsClientCreateOrUpdateOptions contains the optional parameters for the DefenderForAISettingsClient.CreateOrUpdate // method. type DefenderForAISettingsClientCreateOrUpdateOptions struct { @@ -432,6 +484,56 @@ type LocationBasedModelCapacitiesClientListOptions struct { // placeholder for future optional parameters } +// ManagedComputeCapacitiesClientListOptions contains the optional parameters for the ManagedComputeCapacitiesClient.NewListPager +// method. +type ManagedComputeCapacitiesClientListOptions struct { + // Optional accelerator type filter to narrow results to a specific accelerator type. + AcceleratorType *string + + // Optional deployment resource ID. When provided, returns capacity for the specific region + // where the deployment is hosted rather than the best available region. + DeploymentID *string +} + +// ManagedComputeDeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedComputeDeploymentsClient.BeginCreateOrUpdate +// method. +type ManagedComputeDeploymentsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ManagedComputeDeploymentsClientBeginDeleteOptions contains the optional parameters for the ManagedComputeDeploymentsClient.BeginDelete +// method. +type ManagedComputeDeploymentsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ManagedComputeDeploymentsClientBeginUpdateOptions contains the optional parameters for the ManagedComputeDeploymentsClient.BeginUpdate +// method. +type ManagedComputeDeploymentsClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ManagedComputeDeploymentsClientGetOptions contains the optional parameters for the ManagedComputeDeploymentsClient.Get +// method. +type ManagedComputeDeploymentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedComputeDeploymentsClientListOptions contains the optional parameters for the ManagedComputeDeploymentsClient.NewListPager +// method. +type ManagedComputeDeploymentsClientListOptions struct { + // placeholder for future optional parameters +} + +// ManagedComputeUsagesOperationGroupClientListOptions contains the optional parameters for the ManagedComputeUsagesOperationGroupClient.NewListPager +// method. +type ManagedComputeUsagesOperationGroupClientListOptions struct { + // placeholder for future optional parameters +} + // ManagedNetworkProvisionsClientBeginProvisionManagedNetworkOptions contains the optional parameters for the ManagedNetworkProvisionsClient.BeginProvisionManagedNetwork // method. type ManagedNetworkProvisionsClientBeginProvisionManagedNetworkOptions struct { @@ -880,3 +982,50 @@ type UsagesClientListOptions struct { // the metric, can have an or of multiple names). Filter *string } + +// WorkbenchesClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkbenchesClient.BeginCreateOrUpdate +// method. +type WorkbenchesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// WorkbenchesClientBeginDeleteOptions contains the optional parameters for the WorkbenchesClient.BeginDelete method. +type WorkbenchesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// WorkbenchesClientBeginRestartOptions contains the optional parameters for the WorkbenchesClient.BeginRestart method. +type WorkbenchesClientBeginRestartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// WorkbenchesClientBeginStartOptions contains the optional parameters for the WorkbenchesClient.BeginStart method. +type WorkbenchesClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// WorkbenchesClientBeginStopOptions contains the optional parameters for the WorkbenchesClient.BeginStop method. +type WorkbenchesClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// WorkbenchesClientBeginUpdateOptions contains the optional parameters for the WorkbenchesClient.BeginUpdate method. +type WorkbenchesClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// WorkbenchesClientGetOptions contains the optional parameters for the WorkbenchesClient.Get method. +type WorkbenchesClientGetOptions struct { + // placeholder for future optional parameters +} + +// WorkbenchesClientListOptions contains the optional parameters for the WorkbenchesClient.NewListPager method. +type WorkbenchesClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrule_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrule_client.go index aeeec6d543bc..c35167020f9e 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrule_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrule_client.go @@ -18,6 +18,8 @@ import ( // OutboundRuleClient contains the methods for the OutboundRule group. // Don't use this type directly, use NewOutboundRuleClient() instead. +// +// Generated from API version 2026-03-15-preview type OutboundRuleClient struct { internal *arm.Client subscriptionID string @@ -45,8 +47,6 @@ func NewOutboundRuleClient(subscriptionID string, credential azcore.TokenCredent // The PUT API for creating or updating a single outbound rule of the managed network associated with the cognitive services // account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - managedNetworkName - Name of the managedNetwork associated with the cognitive services account. Only 'default' is supported. @@ -76,8 +76,6 @@ func (client *OutboundRuleClient) BeginCreateOrUpdate(ctx context.Context, resou // The PUT API for creating or updating a single outbound rule of the managed network associated with the cognitive services // account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *OutboundRuleClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, managedNetworkName string, ruleName string, body OutboundRuleBasicResource, options *OutboundRuleClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "OutboundRuleClient.BeginCreateOrUpdate" @@ -127,8 +125,8 @@ func (client *OutboundRuleClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -142,8 +140,6 @@ func (client *OutboundRuleClient) createOrUpdateCreateRequest(ctx context.Contex // // The DELETE API for deleting a single outbound rule of the managed network associated with the cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - managedNetworkName - Name of the managedNetwork associated with the cognitive services account. Only 'default' is supported. @@ -172,8 +168,6 @@ func (client *OutboundRuleClient) BeginDelete(ctx context.Context, resourceGroup // // The DELETE API for deleting a single outbound rule of the managed network associated with the cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *OutboundRuleClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, managedNetworkName string, ruleName string, options *OutboundRuleClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "OutboundRuleClient.BeginDelete" @@ -223,8 +217,8 @@ func (client *OutboundRuleClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } @@ -232,8 +226,6 @@ func (client *OutboundRuleClient) deleteCreateRequest(ctx context.Context, resou // // The GET API for retrieving a single outbound rule of the managed network associated with the cognitive services account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - managedNetworkName - Name of the managedNetwork associated with the cognitive services account. Only 'default' is supported. @@ -289,8 +281,8 @@ func (client *OutboundRuleClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -308,8 +300,6 @@ func (client *OutboundRuleClient) getHandleResponse(resp *http.Response) (Outbou // services account. // // The GET API for retrieving the list of outbound rules of the managed network associated with the cognitive services account. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - managedNetworkName - Name of the managedNetwork associated with the cognitive services account. Only 'default' is supported. @@ -361,8 +351,8 @@ func (client *OutboundRuleClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrule_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrule_client_example_test.go index 9ee41a7382eb..1990c185506a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrule_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrule_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ManagedNetwork/createOrUpdateRuleV2.json +// Generated from example definition: 2026-03-15-preview/ManagedNetwork/createOrUpdateRuleV2.json func ExampleOutboundRuleClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -36,13 +36,13 @@ func ExampleOutboundRuleClient_BeginCreateOrUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.OutboundRuleClientCreateOrUpdateResponse{ - // OutboundRuleBasicResource: &armcognitiveservices.OutboundRuleBasicResource{ + // OutboundRuleBasicResource: armcognitiveservices.OutboundRuleBasicResource{ // Name: to.Ptr("rule_name_1"), // Type: to.Ptr("accounts/outboundRules"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/cognitive-account-name/managedNetworks/default/outboundRules/rule_name_1"), @@ -56,7 +56,7 @@ func ExampleOutboundRuleClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/ManagedNetwork/deleteRuleV2.json +// Generated from example definition: 2026-03-15-preview/ManagedNetwork/deleteRuleV2.json func ExampleOutboundRuleClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -73,11 +73,11 @@ func ExampleOutboundRuleClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/ManagedNetwork/getRuleV2.json +// Generated from example definition: 2026-03-15-preview/ManagedNetwork/getRuleV2.json func ExampleOutboundRuleClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -96,7 +96,7 @@ func ExampleOutboundRuleClient_Get() { _ = 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 = armcognitiveservices.OutboundRuleClientGetResponse{ - // OutboundRuleBasicResource: &armcognitiveservices.OutboundRuleBasicResource{ + // OutboundRuleBasicResource: armcognitiveservices.OutboundRuleBasicResource{ // Name: to.Ptr("rule_name_1"), // Type: to.Ptr("accounts/outboundRules"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/cognitive-account-name/managedNetworks/default/outboundRules/rule_name_1"), @@ -110,7 +110,7 @@ func ExampleOutboundRuleClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ManagedNetwork/listRuleV2.json +// Generated from example definition: 2026-03-15-preview/ManagedNetwork/listRuleV2.json func ExampleOutboundRuleClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrules_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrules_client.go index 7be5ce2874ab..eabd6859720e 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrules_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrules_client.go @@ -18,6 +18,8 @@ import ( // OutboundRulesClient contains the methods for the OutboundRules group. // Don't use this type directly, use NewOutboundRulesClient() instead. +// +// Generated from API version 2026-03-15-preview type OutboundRulesClient struct { internal *arm.Client subscriptionID string @@ -43,27 +45,42 @@ func NewOutboundRulesClient(subscriptionID string, credential azcore.TokenCreden // account. // // The POST API for updating the outbound rules of the managed network associated with the cognitive services account. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - managedNetworkName - Name of the managedNetwork associated with the cognitive services account. Only 'default' is supported. // - body - The Managed Network Settings object of the account. // - options - OutboundRulesClientBeginPostOptions contains the optional parameters for the OutboundRulesClient.BeginPost method. -func (client *OutboundRulesClient) BeginPost(ctx context.Context, resourceGroupName string, accountName string, managedNetworkName string, body ManagedNetworkSettingsBasicResource, options *OutboundRulesClientBeginPostOptions) (*runtime.Poller[OutboundRulesClientPostResponse], error) { +func (client *OutboundRulesClient) BeginPost(ctx context.Context, resourceGroupName string, accountName string, managedNetworkName string, body ManagedNetworkSettingsBasicResource, options *OutboundRulesClientBeginPostOptions) (*runtime.Poller[*runtime.Pager[OutboundRulesClientPostResponse]], error) { + pager := runtime.NewPager(runtime.PagingHandler[OutboundRulesClientPostResponse]{ + More: func(page OutboundRulesClientPostResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OutboundRulesClientPostResponse) (OutboundRulesClientPostResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OutboundRulesClient.BeginPost") + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), *page.NextLink, func(ctx context.Context) (*policy.Request, error) { + return client.postCreateRequest(ctx, resourceGroupName, accountName, managedNetworkName, body, options) + }, nil) + if err != nil { + return OutboundRulesClientPostResponse{}, err + } + return client.postHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) if options == nil || options.ResumeToken == "" { resp, err := client.post(ctx, resourceGroupName, accountName, managedNetworkName, body, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OutboundRulesClientPostResponse]{ - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[*runtime.Pager[OutboundRulesClientPostResponse]]{ + Response: &pager, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OutboundRulesClientPostResponse]{ - Tracer: client.internal.Tracer(), + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[*runtime.Pager[OutboundRulesClientPostResponse]]{ + Response: &pager, + Tracer: client.internal.Tracer(), }) } } @@ -71,9 +88,6 @@ func (client *OutboundRulesClient) BeginPost(ctx context.Context, resourceGroupN // Post - The POST API for updating the outbound rules of the managed network associated with the cognitive services account. // // The POST API for updating the outbound rules of the managed network associated with the cognitive services account. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *OutboundRulesClient) post(ctx context.Context, resourceGroupName string, accountName string, managedNetworkName string, body ManagedNetworkSettingsBasicResource, options *OutboundRulesClientBeginPostOptions) (*http.Response, error) { var err error const operationName = "OutboundRulesClient.BeginPost" @@ -119,8 +133,8 @@ func (client *OutboundRulesClient) postCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -128,3 +142,12 @@ func (client *OutboundRulesClient) postCreateRequest(ctx context.Context, resour } return req, nil } + +// postHandleResponse handles the Post response. +func (client *OutboundRulesClient) postHandleResponse(resp *http.Response) (OutboundRulesClientPostResponse, error) { + result := OutboundRulesClientPostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OutboundRuleListResult); err != nil { + return OutboundRulesClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrules_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrules_client_example_test.go index eb10c548a10a..5e74c1dd9736 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrules_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/outboundrules_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ManagedNetwork/postOutboundRulesV2.json +// Generated from example definition: 2026-03-15-preview/ManagedNetwork/postOutboundRulesV2.json func ExampleOutboundRulesClient_BeginPost() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -41,26 +41,34 @@ func ExampleOutboundRulesClient_BeginPost() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) + } + for res.More() { + page, err := res.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 = armcognitiveservices.OutboundRulesClientPostResponse{ + // OutboundRuleListResult: armcognitiveservices.OutboundRuleListResult{ + // Value: []*armcognitiveservices.OutboundRuleBasicResource{ + // { + // Name: to.Ptr("rule_name_1"), + // Type: to.Ptr("accounts/outboundRules"), + // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/cognitive-account-name/managedNetworks/default/outboundRules/rule_name_1"), + // Properties: &armcognitiveservices.FqdnOutboundRule{ + // Type: to.Ptr(armcognitiveservices.RuleTypeFQDN), + // Category: to.Ptr(armcognitiveservices.RuleCategoryRequired), + // Destination: to.Ptr("destination_of_the_fqdn_rule"), + // Status: to.Ptr(armcognitiveservices.RuleStatusActive), + // }, + // }, + // }, + // }, + // } } - // 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 = armcognitiveservices.OutboundRulesClientPostResponse{ - // OutboundRuleListResult: &armcognitiveservices.OutboundRuleListResult{ - // Value: []*armcognitiveservices.OutboundRuleBasicResource{ - // { - // Name: to.Ptr("rule_name_1"), - // Type: to.Ptr("accounts/outboundRules"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/cognitive-account-name/managedNetworks/default/outboundRules/rule_name_1"), - // Properties: &armcognitiveservices.FqdnOutboundRule{ - // Type: to.Ptr(armcognitiveservices.RuleTypeFQDN), - // Category: to.Ptr(armcognitiveservices.RuleCategoryRequired), - // Destination: to.Ptr("destination_of_the_fqdn_rule"), - // Status: to.Ptr(armcognitiveservices.RuleStatusActive), - // }, - // }, - // }, - // }, - // } } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/polymorphic_helpers.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/polymorphic_helpers.go index b4e8023999f5..abb76a2d01c3 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/polymorphic_helpers.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/polymorphic_helpers.go @@ -16,10 +16,10 @@ func unmarshalAgentDeploymentPropertiesClassification(rawMsg json.RawMessage) (A } var b AgentDeploymentPropertiesClassification switch m["deploymentType"] { - case string(AgentDeploymentTypeManaged): - b = &ManagedAgentDeployment{} case string(AgentDeploymentTypeHosted): b = &HostedAgentDeployment{} + case string(AgentDeploymentTypeManaged): + b = &ManagedAgentDeployment{} default: b = &AgentDeploymentProperties{} } @@ -39,12 +39,12 @@ func unmarshalApplicationAuthorizationPolicyClassification(rawMsg json.RawMessag } var b ApplicationAuthorizationPolicyClassification switch m["type"] { + case string(BuiltInAuthorizationSchemeChannels): + b = &ChannelsBuiltInAuthorizationPolicy{} case string(BuiltInAuthorizationSchemeDefault): b = &RoleBasedBuiltInAuthorizationPolicy{} case string(BuiltInAuthorizationSchemeOrganizationScope): b = &OrganizationSharedBuiltInAuthorizationPolicy{} - case string(BuiltInAuthorizationSchemeChannels): - b = &ChannelsBuiltInAuthorizationPolicy{} default: b = &ApplicationAuthorizationPolicy{} } @@ -54,6 +54,29 @@ func unmarshalApplicationAuthorizationPolicyClassification(rawMsg json.RawMessag return b, nil } +func unmarshalComputePropertiesClassification(rawMsg json.RawMessage) (ComputePropertiesClassification, 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 ComputePropertiesClassification + switch m["computeType"] { + case string(ComputeTypeCluster): + b = &ClusterComputeProperties{} + case string(ComputeTypeContainerInstance): + b = &ContainerInstanceComputeProperties{} + default: + b = &ComputeProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + func unmarshalConnectionPropertiesV2Classification(rawMsg json.RawMessage) (ConnectionPropertiesV2Classification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil @@ -64,30 +87,30 @@ func unmarshalConnectionPropertiesV2Classification(rawMsg json.RawMessage) (Conn } var b ConnectionPropertiesV2Classification switch m["authType"] { - case string(ConnectionAuthTypePAT): - b = &PATAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeAAD): + b = &AADAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeAPIKey): + b = &APIKeyAuthConnectionProperties{} + case string(ConnectionAuthTypeAccessKey): + b = &AccessKeyAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeAccountKey): + b = &AccountKeyAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeCustomKeys): + b = &CustomKeysConnectionProperties{} case string(ConnectionAuthTypeManagedIdentity): b = &ManagedIdentityAuthTypeConnectionProperties{} - case string(ConnectionAuthTypeUsernamePassword): - b = &UsernamePasswordAuthTypeConnectionProperties{} case string(ConnectionAuthTypeNone): b = &NoneAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeOAuth2): + b = &OAuth2AuthTypeConnectionProperties{} + case string(ConnectionAuthTypePAT): + b = &PATAuthTypeConnectionProperties{} case string(ConnectionAuthTypeSAS): b = &SASAuthTypeConnectionProperties{} - case string(ConnectionAuthTypeAccountKey): - b = &AccountKeyAuthTypeConnectionProperties{} case string(ConnectionAuthTypeServicePrincipal): b = &ServicePrincipalAuthTypeConnectionProperties{} - case string(ConnectionAuthTypeAccessKey): - b = &AccessKeyAuthTypeConnectionProperties{} - case string(ConnectionAuthTypeAPIKey): - b = &APIKeyAuthConnectionProperties{} - case string(ConnectionAuthTypeCustomKeys): - b = &CustomKeysConnectionProperties{} - case string(ConnectionAuthTypeOAuth2): - b = &OAuth2AuthTypeConnectionProperties{} - case string(ConnectionAuthTypeAAD): - b = &AADAuthTypeConnectionProperties{} + case string(ConnectionAuthTypeUsernamePassword): + b = &UsernamePasswordAuthTypeConnectionProperties{} default: b = &ConnectionPropertiesV2{} } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go index 55b4d7b4f115..4e440c9fb34c 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client.go @@ -18,6 +18,8 @@ import ( // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. // Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +// +// Generated from API version 2026-03-15-preview type PrivateEndpointConnectionsClient struct { internal *arm.Client subscriptionID string @@ -42,8 +44,6 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Cognitive Services Account @@ -69,8 +69,6 @@ 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 2026-01-15-preview 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" @@ -116,8 +114,8 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { @@ -128,8 +126,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Cognitive Services Account @@ -154,8 +150,6 @@ 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 2026-01-15-preview 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" @@ -201,15 +195,13 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Cognitive Services Account @@ -261,8 +253,8 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -278,8 +270,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List @@ -326,8 +316,8 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client_example_test.go index 2e7c4d99c6d8..e678d33d55e3 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privateendpointconnections_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/PutPrivateEndpointConnection.json +// Generated from example definition: 2026-03-15-preview/PutPrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -36,13 +36,13 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.PrivateEndpointConnectionsClientCreateOrUpdateResponse{ - // PrivateEndpointConnection: &armcognitiveservices.PrivateEndpointConnection{ + // PrivateEndpointConnection: armcognitiveservices.PrivateEndpointConnection{ // Name: to.Ptr("{privateEndpointConnectionName}"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/res7231/providers/Microsoft.CognitiveServices/accounts/sto288/privateEndpointConnections/{privateEndpointConnectionName}"), @@ -60,7 +60,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/DeletePrivateEndpointConnection.json +// Generated from example definition: 2026-03-15-preview/DeletePrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,7 +77,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginDelete() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res @@ -86,7 +86,7 @@ func ExamplePrivateEndpointConnectionsClient_BeginDelete() { // } } -// Generated from example definition: 2026-01-15-preview/GetPrivateEndpointConnection.json +// Generated from example definition: 2026-03-15-preview/GetPrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,7 +105,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { _ = 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 = armcognitiveservices.PrivateEndpointConnectionsClientGetResponse{ - // PrivateEndpointConnection: &armcognitiveservices.PrivateEndpointConnection{ + // PrivateEndpointConnection: armcognitiveservices.PrivateEndpointConnection{ // Name: to.Ptr("{privateEndpointConnectionName}"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/privateEndpointConnections"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/res7231/providers/Microsoft.CognitiveServices/accounts/sto288/privateEndpointConnections/{privateEndpointConnectionName}"), @@ -123,7 +123,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListPrivateEndpointConnections.json +// Generated from example definition: 2026-03-15-preview/ListPrivateEndpointConnections.json func ExamplePrivateEndpointConnectionsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -142,7 +142,7 @@ func ExamplePrivateEndpointConnectionsClient_List() { _ = 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 = armcognitiveservices.PrivateEndpointConnectionsClientListResponse{ - // PrivateEndpointConnectionListResult: &armcognitiveservices.PrivateEndpointConnectionListResult{ + // PrivateEndpointConnectionListResult: armcognitiveservices.PrivateEndpointConnectionListResult{ // Value: []*armcognitiveservices.PrivateEndpointConnection{ // { // Name: to.Ptr("{privateEndpointConnectionName}"), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go index d4d5eb9fb902..5cf498c3c6bd 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client.go @@ -18,6 +18,8 @@ import ( // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. // Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +// +// Generated from API version 2026-03-15-preview type PrivateLinkResourcesClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List @@ -89,8 +89,8 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client_example_test.go index 580fbec1215c..d14e9a8b04e6 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/privatelinkresources_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ListPrivateLinkResources.json +// Generated from example definition: 2026-03-15-preview/ListPrivateLinkResources.json func ExamplePrivateLinkResourcesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -30,7 +30,7 @@ func ExamplePrivateLinkResourcesClient_List() { _ = 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 = armcognitiveservices.PrivateLinkResourcesClientListResponse{ - // PrivateLinkResourceListResult: &armcognitiveservices.PrivateLinkResourceListResult{ + // PrivateLinkResourceListResult: armcognitiveservices.PrivateLinkResourceListResult{ // Value: []*armcognitiveservices.PrivateLinkResource{ // { // Name: to.Ptr("blob"), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectcapabilityhosts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectcapabilityhosts_client.go index 31360bef6d5c..bb9b6c7e9159 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectcapabilityhosts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectcapabilityhosts_client.go @@ -18,6 +18,8 @@ import ( // ProjectCapabilityHostsClient contains the methods for the ProjectCapabilityHosts group. // Don't use this type directly, use NewProjectCapabilityHostsClient() instead. +// +// Generated from API version 2026-03-15-preview type ProjectCapabilityHostsClient struct { internal *arm.Client subscriptionID string @@ -43,8 +45,6 @@ func NewProjectCapabilityHostsClient(subscriptionID string, credential azcore.To // // Create or update project capabilityHost. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -74,8 +74,6 @@ func (client *ProjectCapabilityHostsClient) BeginCreateOrUpdate(ctx context.Cont // // Create or update project capabilityHost. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *ProjectCapabilityHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, projectName string, capabilityHostName string, capabilityHost ProjectCapabilityHost, options *ProjectCapabilityHostsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ProjectCapabilityHostsClient.BeginCreateOrUpdate" @@ -125,8 +123,8 @@ func (client *ProjectCapabilityHostsClient) createOrUpdateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, capabilityHost); err != nil { @@ -139,8 +137,6 @@ func (client *ProjectCapabilityHostsClient) createOrUpdateCreateRequest(ctx cont // // Delete project capabilityHost. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -168,8 +164,6 @@ func (client *ProjectCapabilityHostsClient) BeginDelete(ctx context.Context, res // // Delete project capabilityHost. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview 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" @@ -219,8 +213,8 @@ func (client *ProjectCapabilityHostsClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } @@ -228,8 +222,6 @@ func (client *ProjectCapabilityHostsClient) deleteCreateRequest(ctx context.Cont // // Get project capabilityHost. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -286,8 +278,8 @@ func (client *ProjectCapabilityHostsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -304,8 +296,6 @@ func (client *ProjectCapabilityHostsClient) getHandleResponse(resp *http.Respons // NewListPager - List capabilityHost. // // List capabilityHost. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -358,8 +348,8 @@ func (client *ProjectCapabilityHostsClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectcapabilityhosts_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectcapabilityhosts_client_example_test.go index ab6fff5725a5..e0c9466d7380 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectcapabilityhosts_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectcapabilityhosts_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ProjectCapabilityHost/createOrUpdate.json +// Generated from example definition: 2026-03-15-preview/ProjectCapabilityHost/createOrUpdate.json func ExampleProjectCapabilityHostsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -44,13 +44,13 @@ func ExampleProjectCapabilityHostsClient_BeginCreateOrUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.ProjectCapabilityHostsClientCreateOrUpdateResponse{ - // ProjectCapabilityHost: &armcognitiveservices.ProjectCapabilityHost{ + // ProjectCapabilityHost: armcognitiveservices.ProjectCapabilityHost{ // Name: to.Ptr("capabilityHostName"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/capabilityHosts"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/account-1/projects/project-1/capabilityHosts/capabilityHostName"), @@ -73,7 +73,7 @@ func ExampleProjectCapabilityHostsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/ProjectCapabilityHost/delete.json +// Generated from example definition: 2026-03-15-preview/ProjectCapabilityHost/delete.json func ExampleProjectCapabilityHostsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -90,11 +90,11 @@ func ExampleProjectCapabilityHostsClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/ProjectCapabilityHost/get.json +// Generated from example definition: 2026-03-15-preview/ProjectCapabilityHost/get.json func ExampleProjectCapabilityHostsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -113,7 +113,7 @@ func ExampleProjectCapabilityHostsClient_Get() { _ = 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 = armcognitiveservices.ProjectCapabilityHostsClientGetResponse{ - // ProjectCapabilityHost: &armcognitiveservices.ProjectCapabilityHost{ + // ProjectCapabilityHost: armcognitiveservices.ProjectCapabilityHost{ // Name: to.Ptr("capabilityHostName"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/capabilityHosts"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveServices/accounts/account-1/projects/project-1/capabilityHosts/capabilityHostName"), @@ -136,7 +136,7 @@ func ExampleProjectCapabilityHostsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ProjectCapabilityHost/list.json +// Generated from example definition: 2026-03-15-preview/ProjectCapabilityHost/list.json func ExampleProjectCapabilityHostsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectconnections_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectconnections_client.go index 5e668454c3aa..7f384509584c 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectconnections_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectconnections_client.go @@ -19,6 +19,8 @@ import ( // ProjectConnectionsClient contains the methods for the ProjectConnections group. // Don't use this type directly, use NewProjectConnectionsClient() instead. +// +// Generated from API version 2026-03-15-preview type ProjectConnectionsClient struct { internal *arm.Client subscriptionID string @@ -44,8 +46,6 @@ func NewProjectConnectionsClient(subscriptionID string, credential azcore.TokenC // // 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 2026-01-15-preview // - 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. @@ -103,8 +103,8 @@ func (client *ProjectConnectionsClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, connection); err != nil { @@ -126,8 +126,6 @@ func (client *ProjectConnectionsClient) createHandleResponse(resp *http.Response // // Delete Cognitive Services project connection by name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -183,8 +181,8 @@ func (client *ProjectConnectionsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } @@ -192,8 +190,6 @@ func (client *ProjectConnectionsClient) deleteCreateRequest(ctx context.Context, // // Lists Cognitive Services project connection by name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -249,8 +245,8 @@ func (client *ProjectConnectionsClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -267,8 +263,6 @@ func (client *ProjectConnectionsClient) getHandleResponse(resp *http.Response) ( // NewListPager - Lists all the available Cognitive Services project connections under the specified project. // // Lists all the available Cognitive Services project connections under the specified project. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -321,7 +315,7 @@ func (client *ProjectConnectionsClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") + reqQP.Set("api-version", version20260315Preview) if options != nil && options.Category != nil { reqQP.Set("category", *options.Category) } @@ -331,7 +325,7 @@ func (client *ProjectConnectionsClient) listCreateRequest(ctx context.Context, r if options != nil && options.Target != nil { reqQP.Set("target", *options.Target) } - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -349,8 +343,6 @@ func (client *ProjectConnectionsClient) listHandleResponse(resp *http.Response) // // Update Cognitive Services project connection under the specified project. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -408,8 +400,8 @@ func (client *ProjectConnectionsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, connection); err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectconnections_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectconnections_client_example_test.go index fc5d5d20e3ac..744a87dcace9 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectconnections_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projectconnections_client_example_test.go @@ -13,7 +13,7 @@ import ( "time" ) -// Generated from example definition: 2026-01-15-preview/ProjectConnection/create.json +// Generated from example definition: 2026-03-15-preview/ProjectConnection/create.json func ExampleProjectConnectionsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExampleProjectConnectionsClient_Create() { _ = 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 = armcognitiveservices.ProjectConnectionsClientCreateResponse{ - // ConnectionPropertiesV2BasicResource: &armcognitiveservices.ConnectionPropertiesV2BasicResource{ + // ConnectionPropertiesV2BasicResource: armcognitiveservices.ConnectionPropertiesV2BasicResource{ // Name: to.Ptr("connection-1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/connections"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup-1/providers/Microsoft.CognitiveServices/accounts/account-1/projects/project-1/connections/connection-1"), @@ -53,7 +53,7 @@ func ExampleProjectConnectionsClient_Create() { // } } -// Generated from example definition: 2026-01-15-preview/ProjectConnection/delete.json +// Generated from example definition: 2026-03-15-preview/ProjectConnection/delete.json func ExampleProjectConnectionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -75,7 +75,7 @@ func ExampleProjectConnectionsClient_Delete() { // } } -// Generated from example definition: 2026-01-15-preview/ProjectConnection/get.json +// Generated from example definition: 2026-03-15-preview/ProjectConnection/get.json func ExampleProjectConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -94,7 +94,7 @@ func ExampleProjectConnectionsClient_Get() { _ = 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 = armcognitiveservices.ProjectConnectionsClientGetResponse{ - // ConnectionPropertiesV2BasicResource: &armcognitiveservices.ConnectionPropertiesV2BasicResource{ + // ConnectionPropertiesV2BasicResource: armcognitiveservices.ConnectionPropertiesV2BasicResource{ // Name: to.Ptr("connection-1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/connections"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup-1/providers/Microsoft.CognitiveServices/accounts/account-1/projects/project-1/connections/connection-1"), @@ -108,7 +108,7 @@ func ExampleProjectConnectionsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ProjectConnection/list.json +// Generated from example definition: 2026-03-15-preview/ProjectConnection/list.json func ExampleProjectConnectionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -162,7 +162,7 @@ func ExampleProjectConnectionsClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/ProjectConnection/update.json +// Generated from example definition: 2026-03-15-preview/ProjectConnection/update.json func ExampleProjectConnectionsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -193,7 +193,7 @@ func ExampleProjectConnectionsClient_Update() { _ = 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 = armcognitiveservices.ProjectConnectionsClientUpdateResponse{ - // ConnectionPropertiesV2BasicResource: &armcognitiveservices.ConnectionPropertiesV2BasicResource{ + // ConnectionPropertiesV2BasicResource: armcognitiveservices.ConnectionPropertiesV2BasicResource{ // Name: to.Ptr("connection-1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/connections"), // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/resourceGroup-1/providers/Microsoft.CognitiveServices/accounts/account-1/projects/project-1/connections/connection-1"), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projects_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projects_client.go index 8c157a63a35f..141df5ce7c88 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projects_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projects_client.go @@ -18,6 +18,8 @@ import ( // ProjectsClient contains the methods for the Projects group. // Don't use this type directly, use NewProjectsClient() instead. +// +// Generated from API version 2026-03-15-preview type ProjectsClient struct { internal *arm.Client subscriptionID string @@ -42,8 +44,6 @@ func NewProjectsClient(subscriptionID string, credential azcore.TokenCredential, // 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 2026-01-15-preview // - 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. @@ -69,8 +69,6 @@ func (client *ProjectsClient) BeginCreate(ctx context.Context, resourceGroupName // 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 2026-01-15-preview 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" @@ -116,8 +114,8 @@ func (client *ProjectsClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, project); err != nil { @@ -128,8 +126,6 @@ func (client *ProjectsClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Deletes a Cognitive Services project from the resource group. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -153,8 +149,6 @@ func (client *ProjectsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a Cognitive Services project from the resource group. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview 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" @@ -169,7 +163,7 @@ func (client *ProjectsClient) deleteOperation(ctx context.Context, resourceGroup if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -200,15 +194,13 @@ func (client *ProjectsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 2026-01-15-preview // - 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. @@ -259,8 +251,8 @@ func (client *ProjectsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -275,8 +267,6 @@ func (client *ProjectsClient) getHandleResponse(resp *http.Response) (ProjectsCl } // NewListPager - Returns all the projects in a Cognitive Services account. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -323,8 +313,8 @@ func (client *ProjectsClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -340,8 +330,6 @@ func (client *ProjectsClient) listHandleResponse(resp *http.Response) (ProjectsC // BeginUpdate - Updates a Cognitive Services Project // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - 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. @@ -366,8 +354,6 @@ func (client *ProjectsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates a Cognitive Services Project // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview 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" @@ -413,8 +399,8 @@ func (client *ProjectsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, project); err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projects_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projects_client_example_test.go index a7da0844dc9c..a725dd4334eb 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projects_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/projects_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/CreateProject.json +// Generated from example definition: 2026-03-15-preview/CreateProject.json func ExampleProjectsClient_BeginCreate_createProject() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -38,13 +38,13 @@ func ExampleProjectsClient_BeginCreate_createProject() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.ProjectsClientCreateResponse{ - // Project: &armcognitiveservices.Project{ + // Project: armcognitiveservices.Project{ // Name: to.Ptr("testProject1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects"), // Etag: to.Ptr("W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\""), @@ -70,7 +70,7 @@ func ExampleProjectsClient_BeginCreate_createProject() { // } } -// Generated from example definition: 2026-01-15-preview/CreateProjectMin.json +// Generated from example definition: 2026-03-15-preview/CreateProjectMin.json func ExampleProjectsClient_BeginCreate_createProjectMin() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -93,13 +93,13 @@ func ExampleProjectsClient_BeginCreate_createProjectMin() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.ProjectsClientCreateResponse{ - // Project: &armcognitiveservices.Project{ + // Project: armcognitiveservices.Project{ // Name: to.Ptr("testProject1"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects"), // Etag: to.Ptr("W/\"datetime'2017-04-10T08%3A00%3A05.445595Z'\""), @@ -123,7 +123,7 @@ func ExampleProjectsClient_BeginCreate_createProjectMin() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteProject.json +// Generated from example definition: 2026-03-15-preview/DeleteProject.json func ExampleProjectsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -138,13 +138,18 @@ func ExampleProjectsClient_BeginDelete() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.ProjectsClientDeleteResponse{ + // } } -// Generated from example definition: 2026-01-15-preview/GetProject.json +// Generated from example definition: 2026-03-15-preview/GetProject.json func ExampleProjectsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -163,7 +168,7 @@ func ExampleProjectsClient_Get() { _ = 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 = armcognitiveservices.ProjectsClientGetResponse{ - // Project: &armcognitiveservices.Project{ + // Project: armcognitiveservices.Project{ // Name: to.Ptr("myProject"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects"), // Etag: to.Ptr("W/\"datetime'2017-04-10T04%3A42%3A19.7067387Z'\""), @@ -187,7 +192,7 @@ func ExampleProjectsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListProjects.json +// Generated from example definition: 2026-03-15-preview/ListProjects.json func ExampleProjectsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -258,7 +263,7 @@ func ExampleProjectsClient_NewListPager() { } } -// Generated from example definition: 2026-01-15-preview/UpdateProjects.json +// Generated from example definition: 2026-03-15-preview/UpdateProjects.json func ExampleProjectsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -280,13 +285,13 @@ func ExampleProjectsClient_BeginUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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 = armcognitiveservices.ProjectsClientUpdateResponse{ - // Project: &armcognitiveservices.Project{ + // Project: armcognitiveservices.Project{ // Name: to.Ptr("projectName"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects"), // Etag: to.Ptr("W/\"datetime'2017-04-10T07%3A46%3A21.5618831Z'\""), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/quotatiers_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/quotatiers_client.go index a515edc6b5bd..a32977d40026 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/quotatiers_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/quotatiers_client.go @@ -18,6 +18,8 @@ import ( // QuotaTiersClient contains the methods for the QuotaTiers group. // Don't use this type directly, use NewQuotaTiersClient() instead. +// +// Generated from API version 2026-03-15-preview type QuotaTiersClient struct { internal *arm.Client subscriptionID string @@ -44,8 +46,6 @@ func NewQuotaTiersClient(subscriptionID string, credential azcore.TokenCredentia // Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide resource type. It holds // current tier information. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - defaultParam - Default parameter. Leave the value as default. // - tier - The parameters to provide for the quota tier resource. // - options - QuotaTiersClientCreateOrUpdateOptions contains the optional parameters for the QuotaTiersClient.CreateOrUpdate @@ -88,8 +88,8 @@ func (client *QuotaTiersClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, tier); err != nil { @@ -112,8 +112,6 @@ func (client *QuotaTiersClient) createOrUpdateHandleResponse(resp *http.Response // Gets the Quota Tier information for the given subscription. QuotaTiers is a subscription wide resource type. It holds current // tier information. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - defaultParam - Default parameter. Leave the value as default. // - options - QuotaTiersClientGetOptions contains the optional parameters for the QuotaTiersClient.Get method. func (client *QuotaTiersClient) Get(ctx context.Context, defaultParam string, options *QuotaTiersClientGetOptions) (QuotaTiersClientGetResponse, error) { @@ -154,8 +152,8 @@ func (client *QuotaTiersClient) getCreateRequest(ctx context.Context, defaultPar return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -170,8 +168,6 @@ func (client *QuotaTiersClient) getHandleResponse(resp *http.Response) (QuotaTie } // NewListBySubscriptionPager - Returns all the resources of a particular type belonging to a subscription. -// -// Generated from API version 2026-01-15-preview // - options - QuotaTiersClientListBySubscriptionOptions contains the optional parameters for the QuotaTiersClient.NewListBySubscriptionPager // method. func (client *QuotaTiersClient) NewListBySubscriptionPager(options *QuotaTiersClientListBySubscriptionOptions) *runtime.Pager[QuotaTiersClientListBySubscriptionResponse] { @@ -209,8 +205,8 @@ func (client *QuotaTiersClient) listBySubscriptionCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -229,8 +225,6 @@ func (client *QuotaTiersClient) listBySubscriptionHandleResponse(resp *http.Resp // Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide resource type. It holds // current tier information. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - defaultParam - Default parameter. Leave the value as default. // - tier - The parameters to provide for the quota tier resource. // - options - QuotaTiersClientUpdateOptions contains the optional parameters for the QuotaTiersClient.Update method. @@ -272,8 +266,8 @@ func (client *QuotaTiersClient) updateCreateRequest(ctx context.Context, default return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, tier); err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/quotatiers_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/quotatiers_client_example_test.go index 2397df3f8228..4631ad49015d 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/quotatiers_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/quotatiers_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/CreateOrUpdateQuotaTier.json +// Generated from example definition: 2026-03-15-preview/CreateOrUpdateQuotaTier.json func ExampleQuotaTiersClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -35,7 +35,7 @@ func ExampleQuotaTiersClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.QuotaTiersClientCreateOrUpdateResponse{ - // QuotaTier: &armcognitiveservices.QuotaTier{ + // QuotaTier: armcognitiveservices.QuotaTier{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.CognitiveServices/quotaTiers"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/quotaTiers/default"), @@ -48,7 +48,7 @@ func ExampleQuotaTiersClient_CreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/GetQuotaTier.json +// Generated from example definition: 2026-03-15-preview/GetQuotaTier.json func ExampleQuotaTiersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -67,7 +67,7 @@ func ExampleQuotaTiersClient_Get() { _ = 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 = armcognitiveservices.QuotaTiersClientGetResponse{ - // QuotaTier: &armcognitiveservices.QuotaTier{ + // QuotaTier: armcognitiveservices.QuotaTier{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.CognitiveServices/quotaTiers"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/quotaTiers/default"), @@ -85,7 +85,7 @@ func ExampleQuotaTiersClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListQuotaTiers.json +// Generated from example definition: 2026-03-15-preview/ListQuotaTiers.json func ExampleQuotaTiersClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -131,7 +131,7 @@ func ExampleQuotaTiersClient_NewListBySubscriptionPager() { } } -// Generated from example definition: 2026-01-15-preview/UpdateQuotaTier.json +// Generated from example definition: 2026-03-15-preview/UpdateQuotaTier.json func ExampleQuotaTiersClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -154,7 +154,7 @@ func ExampleQuotaTiersClient_Update() { _ = 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 = armcognitiveservices.QuotaTiersClientUpdateResponse{ - // QuotaTier: &armcognitiveservices.QuotaTier{ + // QuotaTier: armcognitiveservices.QuotaTier{ // Name: to.Ptr("default"), // Type: to.Ptr("Microsoft.CognitiveServices/quotaTiers"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/quotaTiers/default"), diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client.go index 2b8e5448a4ee..3f3c8254e94d 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client.go @@ -18,6 +18,8 @@ import ( // RaiBlocklistItemsClient contains the methods for the RaiBlocklistItems group. // Don't use this type directly, use NewRaiBlocklistItemsClient() instead. +// +// Generated from API version 2026-03-15-preview type RaiBlocklistItemsClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account @@ -95,8 +95,8 @@ func (client *RaiBlocklistItemsClient) batchAddCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiBlocklistItems); err != nil { @@ -116,8 +116,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account @@ -169,8 +167,8 @@ func (client *RaiBlocklistItemsClient) batchDeleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiBlocklistItemsNames); err != nil { return nil, err @@ -180,8 +178,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account @@ -239,8 +235,8 @@ func (client *RaiBlocklistItemsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiBlocklistItem); err != nil { @@ -260,8 +256,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account @@ -287,8 +281,6 @@ 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 2026-01-15-preview 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" @@ -338,15 +330,13 @@ func (client *RaiBlocklistItemsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets the specified custom blocklist Item associated with the custom blocklist. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account @@ -402,8 +392,8 @@ func (client *RaiBlocklistItemsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -418,8 +408,6 @@ func (client *RaiBlocklistItemsClient) getHandleResponse(resp *http.Response) (R } // NewListPager - Gets the blocklist items associated with the custom blocklist. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account @@ -472,8 +460,8 @@ func (client *RaiBlocklistItemsClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 index a9315abdc463..ff771432157f 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklistitems_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/AddRaiBlocklistItems.json +// Generated from example definition: 2026-03-15-preview/AddRaiBlocklistItems.json func ExampleRaiBlocklistItemsClient_BatchAdd() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -46,7 +46,7 @@ func ExampleRaiBlocklistItemsClient_BatchAdd() { _ = 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 = armcognitiveservices.RaiBlocklistItemsClientBatchAddResponse{ - // RaiBlocklist: &armcognitiveservices.RaiBlocklist{ + // RaiBlocklist: armcognitiveservices.RaiBlocklist{ // Name: to.Ptr("myblocklist"), // Etag: to.Ptr("\"00000000-0000-0000-0000-000000000000\""), // Properties: &armcognitiveservices.RaiBlocklistProperties{ @@ -56,7 +56,7 @@ func ExampleRaiBlocklistItemsClient_BatchAdd() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteRaiBlocklistItems.json +// Generated from example definition: 2026-03-15-preview/DeleteRaiBlocklistItems.json func ExampleRaiBlocklistItemsClient_BatchDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -76,7 +76,7 @@ func ExampleRaiBlocklistItemsClient_BatchDelete() { } } -// Generated from example definition: 2026-01-15-preview/PutRaiBlocklistItem.json +// Generated from example definition: 2026-03-15-preview/PutRaiBlocklistItem.json func ExampleRaiBlocklistItemsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -100,7 +100,7 @@ func ExampleRaiBlocklistItemsClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.RaiBlocklistItemsClientCreateOrUpdateResponse{ - // RaiBlocklistItem: &armcognitiveservices.RaiBlocklistItem{ + // 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{ @@ -111,7 +111,7 @@ func ExampleRaiBlocklistItemsClient_CreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteRaiBlocklistItem.json +// Generated from example definition: 2026-03-15-preview/DeleteRaiBlocklistItem.json func ExampleRaiBlocklistItemsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -128,11 +128,11 @@ func ExampleRaiBlocklistItemsClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/GetRaiBlocklistItem.json +// Generated from example definition: 2026-03-15-preview/GetRaiBlocklistItem.json func ExampleRaiBlocklistItemsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -151,7 +151,7 @@ func ExampleRaiBlocklistItemsClient_Get() { _ = 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 = armcognitiveservices.RaiBlocklistItemsClientGetResponse{ - // RaiBlocklistItem: &armcognitiveservices.RaiBlocklistItem{ + // 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{ @@ -162,7 +162,7 @@ func ExampleRaiBlocklistItemsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListBlocklistItems.json +// Generated from example definition: 2026-03-15-preview/ListBlocklistItems.json func ExampleRaiBlocklistItemsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client.go index 6efafaf375f7..e5702ba1b12c 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client.go @@ -18,6 +18,8 @@ import ( // RaiBlocklistsClient contains the methods for the RaiBlocklists group. // Don't use this type directly, use NewRaiBlocklistsClient() instead. +// +// Generated from API version 2026-03-15-preview type RaiBlocklistsClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account @@ -95,8 +95,8 @@ func (client *RaiBlocklistsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiBlocklist); err != nil { @@ -116,8 +116,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account @@ -142,8 +140,6 @@ 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 2026-01-15-preview 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" @@ -189,15 +185,13 @@ func (client *RaiBlocklistsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets the specified custom blocklist associated with the Azure OpenAI account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiBlocklistName - The name of the RaiBlocklist associated with the Cognitive Services Account @@ -248,8 +242,8 @@ func (client *RaiBlocklistsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -264,8 +258,6 @@ func (client *RaiBlocklistsClient) getHandleResponse(resp *http.Response) (RaiBl } // NewListPager - Gets the custom blocklists associated with the Azure OpenAI account. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - RaiBlocklistsClientListOptions contains the optional parameters for the RaiBlocklistsClient.NewListPager method. @@ -312,8 +304,8 @@ func (client *RaiBlocklistsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 index 413078ca1346..b870ee9c3b4d 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiblocklists_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/PutRaiBlocklist.json +// Generated from example definition: 2026-03-15-preview/PutRaiBlocklist.json func ExampleRaiBlocklistsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -35,7 +35,7 @@ func ExampleRaiBlocklistsClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.RaiBlocklistsClientCreateOrUpdateResponse{ - // RaiBlocklist: &armcognitiveservices.RaiBlocklist{ + // 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{ @@ -45,7 +45,7 @@ func ExampleRaiBlocklistsClient_CreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteRaiBlocklist.json +// Generated from example definition: 2026-03-15-preview/DeleteRaiBlocklist.json func ExampleRaiBlocklistsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -62,11 +62,11 @@ func ExampleRaiBlocklistsClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/GetRaiBlocklist.json +// Generated from example definition: 2026-03-15-preview/GetRaiBlocklist.json func ExampleRaiBlocklistsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -85,7 +85,7 @@ func ExampleRaiBlocklistsClient_Get() { _ = 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 = armcognitiveservices.RaiBlocklistsClientGetResponse{ - // RaiBlocklist: &armcognitiveservices.RaiBlocklist{ + // 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{ @@ -95,7 +95,7 @@ func ExampleRaiBlocklistsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListBlocklists.json +// Generated from example definition: 2026-03-15-preview/ListBlocklists.json func ExampleRaiBlocklistsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client.go index b0e642870426..8c4bf0e6b83e 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client.go @@ -18,6 +18,8 @@ import ( // RaiContentFiltersClient contains the methods for the RaiContentFilters group. // Don't use this type directly, use NewRaiContentFiltersClient() instead. +// +// Generated from API version 2026-03-15-preview type RaiContentFiltersClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - location - The name of the Azure region. // - filterName - The name of the RAI Content Filter. // - options - RaiContentFiltersClientGetOptions contains the optional parameters for the RaiContentFiltersClient.Get method. @@ -88,8 +88,8 @@ func (client *RaiContentFiltersClient) getCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -104,8 +104,6 @@ func (client *RaiContentFiltersClient) getHandleResponse(resp *http.Response) (R } // NewListPager - List Content Filters types. -// -// Generated from API version 2026-01-15-preview // - location - The name of the Azure region. // - options - RaiContentFiltersClientListOptions contains the optional parameters for the RaiContentFiltersClient.NewListPager // method. @@ -148,8 +146,8 @@ func (client *RaiContentFiltersClient) listCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 index 106f4631daa3..9f178d60470c 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raicontentfilters_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/GetRaiContentFilter.json +// Generated from example definition: 2026-03-15-preview/GetRaiContentFilter.json func ExampleRaiContentFiltersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -30,7 +30,7 @@ func ExampleRaiContentFiltersClient_Get() { _ = 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 = armcognitiveservices.RaiContentFiltersClientGetResponse{ - // RaiContentFilter: &armcognitiveservices.RaiContentFilter{ + // 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"), @@ -43,7 +43,7 @@ func ExampleRaiContentFiltersClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListRaiContentFilters.json +// Generated from example definition: 2026-03-15-preview/ListRaiContentFilters.json func ExampleRaiContentFiltersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyprovider_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyprovider_client.go index fdf8be9c02c1..411e522f946c 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyprovider_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyprovider_client.go @@ -7,7 +7,6 @@ package armcognitiveservices import ( "context" "errors" - "fmt" "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" @@ -19,6 +18,8 @@ import ( // RaiExternalSafetyProviderClient contains the methods for the RaiExternalSafetyProvider group. // Don't use this type directly, use NewRaiExternalSafetyProviderClient() instead. +// +// Generated from API version 2026-03-15-preview type RaiExternalSafetyProviderClient struct { internal *arm.Client subscriptionID string @@ -42,8 +43,6 @@ func NewRaiExternalSafetyProviderClient(subscriptionID string, credential azcore // CreateOrUpdate - Create the rai safety provider associated with the subscription. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - safetyProviderName - The name of the Rai External Safety Provider associated with the Cognitive Services Account // - safetyProvider - Properties describing the rai external safety provider. // - options - RaiExternalSafetyProviderClientCreateOrUpdateOptions contains the optional parameters for the RaiExternalSafetyProviderClient.CreateOrUpdate @@ -86,8 +85,8 @@ func (client *RaiExternalSafetyProviderClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, safetyProvider); err != nil { @@ -99,29 +98,14 @@ func (client *RaiExternalSafetyProviderClient) createOrUpdateCreateRequest(ctx c // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *RaiExternalSafetyProviderClient) createOrUpdateHandleResponse(resp *http.Response) (RaiExternalSafetyProviderClientCreateOrUpdateResponse, error) { result := RaiExternalSafetyProviderClientCreateOrUpdateResponse{} - switch resp.StatusCode { - case http.StatusOK: - var val RaiExternalSafetyProviderSchema - if err := runtime.UnmarshalAsJSON(resp, &val); err != nil { - return RaiExternalSafetyProviderClientCreateOrUpdateResponse{}, err - } - result.Value = val - case http.StatusCreated: - var val RaiExternalSafetyProvider - if err := runtime.UnmarshalAsJSON(resp, &val); err != nil { - return RaiExternalSafetyProviderClientCreateOrUpdateResponse{}, err - } - result.Value = val - default: - return RaiExternalSafetyProviderClientCreateOrUpdateResponse{}, fmt.Errorf("unhandled HTTP status code %d", resp.StatusCode) + if err := runtime.UnmarshalAsJSON(resp, &result.RaiExternalSafetyProviderSchema); err != nil { + return RaiExternalSafetyProviderClientCreateOrUpdateResponse{}, err } return result, nil } // BeginDelete - Deletes the specified custom topic associated with the subscription. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - safetyProviderName - The name of the Rai External Safety Provider associated with the Cognitive Services Account // - options - RaiExternalSafetyProviderClientBeginDeleteOptions contains the optional parameters for the RaiExternalSafetyProviderClient.BeginDelete // method. @@ -144,8 +128,6 @@ func (client *RaiExternalSafetyProviderClient) BeginDelete(ctx context.Context, // Delete - Deletes the specified custom topic associated with the subscription. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *RaiExternalSafetyProviderClient) deleteOperation(ctx context.Context, safetyProviderName string, options *RaiExternalSafetyProviderClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "RaiExternalSafetyProviderClient.BeginDelete" @@ -183,15 +165,13 @@ func (client *RaiExternalSafetyProviderClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets the specified external safety provider associated with the Subscription // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - safetyProviderName - The name of the Rai External Safety Provider associated with the Cognitive Services Account // - options - RaiExternalSafetyProviderClientGetOptions contains the optional parameters for the RaiExternalSafetyProviderClient.Get // method. @@ -233,8 +213,8 @@ func (client *RaiExternalSafetyProviderClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyprovider_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyprovider_client_example_test.go index 7cc880c6ca93..7cce5dc92484 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyprovider_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyprovider_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/PutRaiExternalSafetyProvider.json +// Generated from example definition: 2026-03-15-preview/PutRaiExternalSafetyProvider.json func ExampleRaiExternalSafetyProviderClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -41,7 +41,7 @@ func ExampleRaiExternalSafetyProviderClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.RaiExternalSafetyProviderClientCreateOrUpdateResponse{ - // RaiExternalSafetyProviderSchema: &armcognitiveservices.RaiExternalSafetyProviderSchema{ + // RaiExternalSafetyProviderSchema: armcognitiveservices.RaiExternalSafetyProviderSchema{ // Name: to.Ptr("safetyProviderName"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/raiExternalSafetyProviders/safetyProviderName"), // Properties: &armcognitiveservices.RaiExternalSafetyProviderSchemaProperties{ @@ -59,7 +59,7 @@ func ExampleRaiExternalSafetyProviderClient_CreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteRaiExternalSafetyProvider.json +// Generated from example definition: 2026-03-15-preview/DeleteRaiExternalSafetyProvider.json func ExampleRaiExternalSafetyProviderClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -76,11 +76,11 @@ func ExampleRaiExternalSafetyProviderClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/GetRaiExternalSafetyProvider.json +// Generated from example definition: 2026-03-15-preview/GetRaiExternalSafetyProvider.json func ExampleRaiExternalSafetyProviderClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -99,7 +99,7 @@ func ExampleRaiExternalSafetyProviderClient_Get() { _ = 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 = armcognitiveservices.RaiExternalSafetyProviderClientGetResponse{ - // RaiExternalSafetyProviderSchema: &armcognitiveservices.RaiExternalSafetyProviderSchema{ + // RaiExternalSafetyProviderSchema: armcognitiveservices.RaiExternalSafetyProviderSchema{ // Name: to.Ptr("safetyProviderName"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/raiExternalSafetyProviders/safetyProviderName"), // Properties: &armcognitiveservices.RaiExternalSafetyProviderSchemaProperties{ diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyproviders_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyproviders_client.go index d8b0d32cab64..db6fce8b80bc 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyproviders_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyproviders_client.go @@ -18,6 +18,8 @@ import ( // RaiExternalSafetyProvidersClient contains the methods for the RaiExternalSafetyProviders group. // Don't use this type directly, use NewRaiExternalSafetyProvidersClient() instead. +// +// Generated from API version 2026-03-15-preview type RaiExternalSafetyProvidersClient struct { internal *arm.Client subscriptionID string @@ -40,8 +42,6 @@ func NewRaiExternalSafetyProvidersClient(subscriptionID string, credential azcor } // NewListPager - Gets the safety providers associated with the subscription -// -// Generated from API version 2026-01-15-preview // - options - RaiExternalSafetyProvidersClientListOptions contains the optional parameters for the RaiExternalSafetyProvidersClient.NewListPager // method. func (client *RaiExternalSafetyProvidersClient) NewListPager(options *RaiExternalSafetyProvidersClientListOptions) *runtime.Pager[RaiExternalSafetyProvidersClientListResponse] { @@ -79,8 +79,8 @@ func (client *RaiExternalSafetyProvidersClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyproviders_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyproviders_client_example_test.go index c5d1abea55a5..6644e6919ac2 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyproviders_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raiexternalsafetyproviders_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ListRaiExternalSafetyProviders.json +// Generated from example definition: 2026-03-15-preview/ListRaiExternalSafetyProviders.json func ExampleRaiExternalSafetyProvidersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client.go index 6f8841a69255..06efd604c6f1 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client.go @@ -18,6 +18,8 @@ import ( // RaiPoliciesClient contains the methods for the RaiPolicies group. // Don't use this type directly, use NewRaiPoliciesClient() instead. +// +// Generated from API version 2026-03-15-preview type RaiPoliciesClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiPolicyName - The name of the RaiPolicy associated with the Cognitive Services Account @@ -95,8 +95,8 @@ func (client *RaiPoliciesClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiPolicy); err != nil { @@ -116,8 +116,6 @@ 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 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiPolicyName - The name of the RaiPolicy associated with the Cognitive Services Account @@ -141,8 +139,6 @@ 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 2026-01-15-preview 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" @@ -188,15 +184,13 @@ func (client *RaiPoliciesClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets the specified Content Filters associated with the Azure OpenAI account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiPolicyName - The name of the RaiPolicy associated with the Cognitive Services Account @@ -247,8 +241,8 @@ func (client *RaiPoliciesClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -263,8 +257,6 @@ func (client *RaiPoliciesClient) getHandleResponse(resp *http.Response) (RaiPoli } // NewListPager - Gets the content filters associated with the Azure OpenAI account. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - RaiPoliciesClientListOptions contains the optional parameters for the RaiPoliciesClient.NewListPager method. @@ -311,8 +303,8 @@ func (client *RaiPoliciesClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 index 6ff214719237..64f9d7ab5805 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raipolicies_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/PutRaiPolicy.json +// Generated from example definition: 2026-03-15-preview/PutRaiPolicy.json func ExampleRaiPoliciesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -118,7 +118,7 @@ func ExampleRaiPoliciesClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.RaiPoliciesClientCreateOrUpdateResponse{ - // RaiPolicy: &armcognitiveservices.RaiPolicy{ + // 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{ @@ -211,7 +211,7 @@ func ExampleRaiPoliciesClient_CreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteRaiPolicy.json +// Generated from example definition: 2026-03-15-preview/DeleteRaiPolicy.json func ExampleRaiPoliciesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -228,11 +228,11 @@ func ExampleRaiPoliciesClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/GetRaiPolicy.json +// Generated from example definition: 2026-03-15-preview/GetRaiPolicy.json func ExampleRaiPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -251,7 +251,7 @@ func ExampleRaiPoliciesClient_Get() { _ = 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 = armcognitiveservices.RaiPoliciesClientGetResponse{ - // RaiPolicy: &armcognitiveservices.RaiPolicy{ + // 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{ @@ -344,7 +344,7 @@ func ExampleRaiPoliciesClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListRaiPolicies.json +// Generated from example definition: 2026-03-15-preview/ListRaiPolicies.json func ExampleRaiPoliciesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitoollabels_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitoollabels_client.go index bacf8f44457d..4e00bf6818ea 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitoollabels_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitoollabels_client.go @@ -18,6 +18,8 @@ import ( // RaiToolLabelsClient contains the methods for the RaiToolLabels group. // Don't use this type directly, use NewRaiToolLabelsClient() instead. +// +// Generated from API version 2026-03-15-preview type RaiToolLabelsClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ func NewRaiToolLabelsClient(subscriptionID string, credential azcore.TokenCreden // CreateOrUpdate - Creates the RAI Tool Label associated with the Azure OpenAI account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiToolConnectionName - The name of the Rai Tool Label @@ -95,8 +95,8 @@ func (client *RaiToolLabelsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiToolLabel); err != nil { @@ -116,8 +116,6 @@ func (client *RaiToolLabelsClient) createOrUpdateHandleResponse(resp *http.Respo // BeginDelete - Deletes the specified RAI Tool Label associated with the Azure OpenAI account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiToolConnectionName - The name of the Rai Tool Label @@ -142,8 +140,6 @@ func (client *RaiToolLabelsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Deletes the specified RAI Tool Label associated with the Azure OpenAI account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *RaiToolLabelsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, raiToolConnectionName string, options *RaiToolLabelsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "RaiToolLabelsClient.BeginDelete" @@ -189,15 +185,13 @@ func (client *RaiToolLabelsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets the specified RAI Tool Label associated with the Azure OpenAI account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiToolConnectionName - The name of the Rai Tool Label @@ -248,8 +242,8 @@ func (client *RaiToolLabelsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -264,8 +258,6 @@ func (client *RaiToolLabelsClient) getHandleResponse(resp *http.Response) (RaiTo } // NewListPager - Lists all RAI Tool Labels associated with the Azure OpenAI account. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - RaiToolLabelsClientListOptions contains the optional parameters for the RaiToolLabelsClient.NewListPager method. @@ -312,8 +304,8 @@ func (client *RaiToolLabelsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitoollabels_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitoollabels_client_example_test.go index 09f28c543402..3b3631da4bf7 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitoollabels_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitoollabels_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/PutRaiToolLabel.json +// Generated from example definition: 2026-03-15-preview/PutRaiToolLabel.json func ExampleRaiToolLabelsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,7 +54,7 @@ func ExampleRaiToolLabelsClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.RaiToolLabelsClientCreateOrUpdateResponse{ - // RaiToolLabel: &armcognitiveservices.RaiToolLabel{ + // RaiToolLabel: armcognitiveservices.RaiToolLabel{ // Name: to.Ptr("Web_Search"), // Type: to.Ptr("Microsoft.CognitiveServices/accounts/raiToolLabels"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiToolLabels/Web_Search"), @@ -84,7 +84,7 @@ func ExampleRaiToolLabelsClient_CreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteRaiToolLabel.json +// Generated from example definition: 2026-03-15-preview/DeleteRaiToolLabel.json func ExampleRaiToolLabelsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -101,11 +101,11 @@ func ExampleRaiToolLabelsClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/GetRaiToolLabel.json +// Generated from example definition: 2026-03-15-preview/GetRaiToolLabel.json func ExampleRaiToolLabelsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -124,7 +124,7 @@ func ExampleRaiToolLabelsClient_Get() { _ = 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 = armcognitiveservices.RaiToolLabelsClientGetResponse{ - // RaiToolLabel: &armcognitiveservices.RaiToolLabel{ + // RaiToolLabel: armcognitiveservices.RaiToolLabel{ // Name: to.Ptr("raiToolLabelName"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiIfcToolLabels/raiIfcToolLabelName"), // Properties: &armcognitiveservices.RaiToolLabelProperties{ @@ -156,7 +156,7 @@ func ExampleRaiToolLabelsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListRaiToolLabels.json +// Generated from example definition: 2026-03-15-preview/ListRaiToolLabels.json func ExampleRaiToolLabelsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitopics_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitopics_client.go index 5021f3e8cd46..69b06309d644 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitopics_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitopics_client.go @@ -18,6 +18,8 @@ import ( // RaiTopicsClient contains the methods for the RaiTopics group. // Don't use this type directly, use NewRaiTopicsClient() instead. +// +// Generated from API version 2026-03-15-preview type RaiTopicsClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ func NewRaiTopicsClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Create the rai topic associated with the Azure OpenAI account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiTopicName - The name of the Rai Topic associated with the Cognitive Services Account @@ -95,8 +95,8 @@ func (client *RaiTopicsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiTopic); err != nil { @@ -116,8 +116,6 @@ func (client *RaiTopicsClient) createOrUpdateHandleResponse(resp *http.Response) // BeginDelete - Deletes the specified custom topic associated with the Azure OpenAI account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiTopicName - The name of the Rai Topic associated with the Cognitive Services Account @@ -141,8 +139,6 @@ func (client *RaiTopicsClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes the specified custom topic associated with the Azure OpenAI account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *RaiTopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, raiTopicName string, options *RaiTopicsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "RaiTopicsClient.BeginDelete" @@ -188,15 +184,13 @@ func (client *RaiTopicsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets the specified custom topic associated with the Azure OpenAI account. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - raiTopicName - The name of the Rai Topic associated with the Cognitive Services Account @@ -247,8 +241,8 @@ func (client *RaiTopicsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -263,8 +257,6 @@ func (client *RaiTopicsClient) getHandleResponse(resp *http.Response) (RaiTopics } // NewListPager - Gets the custom topics associated with the Azure OpenAI account. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - options - RaiTopicsClientListOptions contains the optional parameters for the RaiTopicsClient.NewListPager method. @@ -311,8 +303,8 @@ func (client *RaiTopicsClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitopics_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitopics_client_example_test.go index d51de465c144..b7aec2fde607 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitopics_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/raitopics_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/PutRaiTopic.json +// Generated from example definition: 2026-03-15-preview/PutRaiTopic.json func ExampleRaiTopicsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -37,7 +37,7 @@ func ExampleRaiTopicsClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.RaiTopicsClientCreateOrUpdateResponse{ - // RaiTopic: &armcognitiveservices.RaiTopic{ + // RaiTopic: armcognitiveservices.RaiTopic{ // Name: to.Ptr("raiTopicName"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiTopics/raiTopicName"), // Properties: &armcognitiveservices.RaiTopicProperties{ @@ -53,7 +53,7 @@ func ExampleRaiTopicsClient_CreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteRaiTopic.json +// Generated from example definition: 2026-03-15-preview/DeleteRaiTopic.json func ExampleRaiTopicsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -70,11 +70,11 @@ func ExampleRaiTopicsClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/GetRaiTopic.json +// Generated from example definition: 2026-03-15-preview/GetRaiTopic.json func ExampleRaiTopicsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -93,7 +93,7 @@ func ExampleRaiTopicsClient_Get() { _ = 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 = armcognitiveservices.RaiTopicsClientGetResponse{ - // RaiTopic: &armcognitiveservices.RaiTopic{ + // RaiTopic: armcognitiveservices.RaiTopic{ // Name: to.Ptr("raiTopicName"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/raiTopics/raiTopicName"), // Properties: &armcognitiveservices.RaiTopicProperties{ @@ -109,7 +109,7 @@ func ExampleRaiTopicsClient_Get() { // } } -// Generated from example definition: 2026-01-15-preview/ListRaiTopics.json +// Generated from example definition: 2026-03-15-preview/ListRaiTopics.json func ExampleRaiTopicsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go index db9440a0e6b1..00aef6d835ba 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client.go @@ -18,6 +18,8 @@ import ( // ResourceSKUsClient contains the methods for the ResourceSKUs group. // Don't use this type directly, use NewResourceSKUsClient() instead. +// +// Generated from API version 2026-03-15-preview type ResourceSKUsClient struct { internal *arm.Client subscriptionID string @@ -40,8 +42,6 @@ func NewResourceSKUsClient(subscriptionID string, credential azcore.TokenCredent } // NewListPager - Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. -// -// Generated from API version 2026-01-15-preview // - options - ResourceSKUsClientListOptions contains the optional parameters for the ResourceSKUsClient.NewListPager method. func (client *ResourceSKUsClient) NewListPager(options *ResourceSKUsClientListOptions) *runtime.Pager[ResourceSKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ResourceSKUsClientListResponse]{ @@ -78,8 +78,8 @@ func (client *ResourceSKUsClient) listCreateRequest(ctx context.Context, _ *Reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client_example_test.go index fdabbca38257..c0fe095709cc 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/resourceskus_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/GetSkus.json +// Generated from example definition: 2026-03-15-preview/GetSkus.json func ExampleResourceSKUsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/responses.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/responses.go index c642d7811d52..e0b808788c0e 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/responses.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/responses.go @@ -66,6 +66,12 @@ type AccountsClientDeleteResponse struct { // placeholder for future response values } +// AccountsClientEvaluateDeploymentPoliciesResponse contains the response from method AccountsClient.EvaluateDeploymentPolicies. +type AccountsClientEvaluateDeploymentPoliciesResponse struct { + // Response body for the evaluateDeploymentPolicies action. + EvaluateDeploymentPoliciesResponse +} + // AccountsClientGetResponse contains the response from method AccountsClient.Get. type AccountsClientGetResponse struct { // Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU. @@ -285,6 +291,53 @@ type ComputeOperationsClientGetResponse struct { ComputeOperationStatus } +// ComputesClientCreateOrUpdateResponse contains the response from method ComputesClient.BeginCreateOrUpdate. +type ComputesClientCreateOrUpdateResponse struct { + // Cognitive Services compute resource. Supports polymorphic compute types + // (Cluster, ContainerInstance) via the computeType discriminator in properties. + Compute +} + +// ComputesClientDeleteResponse contains the response from method ComputesClient.BeginDelete. +type ComputesClientDeleteResponse struct { + // placeholder for future response values +} + +// ComputesClientGetResponse contains the response from method ComputesClient.Get. +type ComputesClientGetResponse struct { + // Cognitive Services compute resource. Supports polymorphic compute types + // (Cluster, ContainerInstance) via the computeType discriminator in properties. + Compute +} + +// ComputesClientListResponse contains the response from method ComputesClient.NewListPager. +type ComputesClientListResponse struct { + // The list of cognitive services computes operation response. + ComputeListResult +} + +// ComputesClientRestartResponse contains the response from method ComputesClient.BeginRestart. +type ComputesClientRestartResponse struct { + // placeholder for future response values +} + +// ComputesClientStartResponse contains the response from method ComputesClient.BeginStart. +type ComputesClientStartResponse struct { + // placeholder for future response values +} + +// ComputesClientStopResponse contains the response from method ComputesClient.BeginStop. +type ComputesClientStopResponse struct { + // placeholder for future response values +} + +// ComputesClientUpdateResponse contains the response from method ComputesClient.BeginUpdate. +type ComputesClientUpdateResponse struct { + // Cognitive Services compute resource. Supports polymorphic compute types + // (Cluster, ContainerInstance) via the computeType discriminator in properties. + Compute +} + // DefenderForAISettingsClientCreateOrUpdateResponse contains the response from method DefenderForAISettingsClient.CreateOrUpdate. type DefenderForAISettingsClientCreateOrUpdateResponse struct { // The Defender for AI resource. @@ -402,6 +455,47 @@ type LocationBasedModelCapacitiesClientListResponse struct { ModelCapacityListResult } +// ManagedComputeCapacitiesClientListResponse contains the response from method ManagedComputeCapacitiesClient.NewListPager. +type ManagedComputeCapacitiesClientListResponse struct { + // The list of managed compute capacities response. + ManagedComputeCapacityListResult +} + +// ManagedComputeDeploymentsClientCreateOrUpdateResponse contains the response from method ManagedComputeDeploymentsClient.BeginCreateOrUpdate. +type ManagedComputeDeploymentsClientCreateOrUpdateResponse struct { + // Cognitive Services account managed compute deployment, backed by managed compute (GPU) resources. + ManagedComputeDeployment +} + +// ManagedComputeDeploymentsClientDeleteResponse contains the response from method ManagedComputeDeploymentsClient.BeginDelete. +type ManagedComputeDeploymentsClientDeleteResponse struct { + // placeholder for future response values +} + +// ManagedComputeDeploymentsClientGetResponse contains the response from method ManagedComputeDeploymentsClient.Get. +type ManagedComputeDeploymentsClientGetResponse struct { + // Cognitive Services account managed compute deployment, backed by managed compute (GPU) resources. + ManagedComputeDeployment +} + +// ManagedComputeDeploymentsClientListResponse contains the response from method ManagedComputeDeploymentsClient.NewListPager. +type ManagedComputeDeploymentsClientListResponse struct { + // The list of managed compute deployments. + ManagedComputeDeploymentListResult +} + +// ManagedComputeDeploymentsClientUpdateResponse contains the response from method ManagedComputeDeploymentsClient.BeginUpdate. +type ManagedComputeDeploymentsClientUpdateResponse struct { + // Cognitive Services account managed compute deployment, backed by managed compute (GPU) resources. + ManagedComputeDeployment +} + +// ManagedComputeUsagesOperationGroupClientListResponse contains the response from method ManagedComputeUsagesOperationGroupClient.NewListPager. +type ManagedComputeUsagesOperationGroupClientListResponse struct { + // List of managed compute quota entries. + ManagedComputeUsageListResult +} + // ManagedNetworkProvisionsClientProvisionManagedNetworkResponse contains the response from method ManagedNetworkProvisionsClient.BeginProvisionManagedNetwork. type ManagedNetworkProvisionsClientProvisionManagedNetworkResponse struct { // Status of the Provisioning for the managed network of a cognitive services account. @@ -727,8 +821,8 @@ type RaiContentFiltersClientListResponse struct { // RaiExternalSafetyProviderClientCreateOrUpdateResponse contains the response from method RaiExternalSafetyProviderClient.CreateOrUpdate. type RaiExternalSafetyProviderClientCreateOrUpdateResponse struct { - // Possible types are RaiExternalSafetyProvider, RaiExternalSafetyProviderSchema - Value any + // Cognitive Services Rai External Safety provider Schema. + RaiExternalSafetyProviderSchema } // RaiExternalSafetyProviderClientDeleteResponse contains the response from method RaiExternalSafetyProviderClient.BeginDelete. @@ -851,3 +945,50 @@ type UsagesClientListResponse struct { // The response to a list usage request. UsageListResult } + +// WorkbenchesClientCreateOrUpdateResponse contains the response from method WorkbenchesClient.BeginCreateOrUpdate. +type WorkbenchesClientCreateOrUpdateResponse struct { + // Workbench resource under a Cognitive Services project. + // Provides interactive compute with data access for AI development. + Workbench +} + +// WorkbenchesClientDeleteResponse contains the response from method WorkbenchesClient.BeginDelete. +type WorkbenchesClientDeleteResponse struct { + // placeholder for future response values +} + +// WorkbenchesClientGetResponse contains the response from method WorkbenchesClient.Get. +type WorkbenchesClientGetResponse struct { + // Workbench resource under a Cognitive Services project. + // Provides interactive compute with data access for AI development. + Workbench +} + +// WorkbenchesClientListResponse contains the response from method WorkbenchesClient.NewListPager. +type WorkbenchesClientListResponse struct { + // The list of workbenches operation response. + WorkbenchListResult +} + +// WorkbenchesClientRestartResponse contains the response from method WorkbenchesClient.BeginRestart. +type WorkbenchesClientRestartResponse struct { + // placeholder for future response values +} + +// WorkbenchesClientStartResponse contains the response from method WorkbenchesClient.BeginStart. +type WorkbenchesClientStartResponse struct { + // placeholder for future response values +} + +// WorkbenchesClientStopResponse contains the response from method WorkbenchesClient.BeginStop. +type WorkbenchesClientStopResponse struct { + // placeholder for future response values +} + +// WorkbenchesClientUpdateResponse contains the response from method WorkbenchesClient.BeginUpdate. +type WorkbenchesClientUpdateResponse struct { + // Workbench resource under a Cognitive Services project. + // Provides interactive compute with data access for AI development. + Workbench +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/subscriptionraipolicy_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/subscriptionraipolicy_client.go index 3d3dfc9ce76f..ab1c4d0c8dc8 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/subscriptionraipolicy_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/subscriptionraipolicy_client.go @@ -18,6 +18,8 @@ import ( // SubscriptionRaiPolicyClient contains the methods for the SubscriptionRaiPolicy group. // Don't use this type directly, use NewSubscriptionRaiPolicyClient() instead. +// +// Generated from API version 2026-03-15-preview type SubscriptionRaiPolicyClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ func NewSubscriptionRaiPolicyClient(subscriptionID string, credential azcore.Tok // CreateOrUpdate - Update the state of specified Content Filters associated with the subscription. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - raiPolicyName - The name of the RaiPolicy associated with the Cognitive Services Account // - raiPolicy - Properties describing the Content Filters. // - options - SubscriptionRaiPolicyClientCreateOrUpdateOptions contains the optional parameters for the SubscriptionRaiPolicyClient.CreateOrUpdate @@ -85,8 +85,8 @@ func (client *SubscriptionRaiPolicyClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, raiPolicy); err != nil { @@ -106,8 +106,6 @@ func (client *SubscriptionRaiPolicyClient) createOrUpdateHandleResponse(resp *ht // BeginDelete - Deletes the specified Content Filters associated with the subscription. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - raiPolicyName - The name of the RaiPolicy associated with the Cognitive Services Account // - options - SubscriptionRaiPolicyClientBeginDeleteOptions contains the optional parameters for the SubscriptionRaiPolicyClient.BeginDelete // method. @@ -130,8 +128,6 @@ func (client *SubscriptionRaiPolicyClient) BeginDelete(ctx context.Context, raiP // Delete - Deletes the specified Content Filters associated with the subscription. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview func (client *SubscriptionRaiPolicyClient) deleteOperation(ctx context.Context, raiPolicyName string, options *SubscriptionRaiPolicyClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SubscriptionRaiPolicyClient.BeginDelete" @@ -169,15 +165,13 @@ func (client *SubscriptionRaiPolicyClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets the specified Content Filters associated with the Subscription. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - raiPolicyName - The name of the RaiPolicy associated with the Cognitive Services Account // - options - SubscriptionRaiPolicyClientGetOptions contains the optional parameters for the SubscriptionRaiPolicyClient.Get // method. @@ -219,8 +213,8 @@ func (client *SubscriptionRaiPolicyClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/subscriptionraipolicy_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/subscriptionraipolicy_client_example_test.go index 8b08b0a2348f..91ff38ad83f8 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/subscriptionraipolicy_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/subscriptionraipolicy_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/PutSubscriptionRaiPolicy.json +// Generated from example definition: 2026-03-15-preview/PutSubscriptionRaiPolicy.json func ExampleSubscriptionRaiPolicyClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -118,7 +118,7 @@ func ExampleSubscriptionRaiPolicyClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.SubscriptionRaiPolicyClientCreateOrUpdateResponse{ - // RaiPolicy: &armcognitiveservices.RaiPolicy{ + // 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{ @@ -211,7 +211,7 @@ func ExampleSubscriptionRaiPolicyClient_CreateOrUpdate() { // } } -// Generated from example definition: 2026-01-15-preview/DeleteSubscriptionRaiPolicy.json +// Generated from example definition: 2026-03-15-preview/DeleteSubscriptionRaiPolicy.json func ExampleSubscriptionRaiPolicyClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -228,11 +228,11 @@ func ExampleSubscriptionRaiPolicyClient_BeginDelete() { } _, err = poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll the result: %v", err) } } -// Generated from example definition: 2026-01-15-preview/GetSubscriptionRaiPolicy.json +// Generated from example definition: 2026-03-15-preview/GetSubscriptionRaiPolicy.json func ExampleSubscriptionRaiPolicyClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -251,7 +251,7 @@ func ExampleSubscriptionRaiPolicyClient_Get() { _ = 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 = armcognitiveservices.SubscriptionRaiPolicyClientGetResponse{ - // RaiPolicy: &armcognitiveservices.RaiPolicy{ + // 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{ diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testdata/_metadata.json b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testdata/_metadata.json index df57441a26ae..2fe4910091db 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testdata/_metadata.json +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testdata/_metadata.json @@ -1,6 +1,6 @@ { "apiVersions": { - "Microsoft.CognitiveServices": "2026-01-15-preview" + "Microsoft.CognitiveServices": "2026-03-15-preview" }, - "emitterVersion": "0.10.4" + "emitterVersion": "0.14.1" } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testraiexternalsafetyprovider_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testraiexternalsafetyprovider_client.go index 040381bf8759..0a0c989ea9c4 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testraiexternalsafetyprovider_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testraiexternalsafetyprovider_client.go @@ -18,6 +18,8 @@ import ( // TestRaiExternalSafetyProviderClient contains the methods for the TestRaiExternalSafetyProvider group. // Don't use this type directly, use NewTestRaiExternalSafetyProviderClient() instead. +// +// Generated from API version 2026-03-15-preview type TestRaiExternalSafetyProviderClient struct { internal *arm.Client subscriptionID string @@ -41,8 +43,6 @@ func NewTestRaiExternalSafetyProviderClient(subscriptionID string, credential az // CreateOrUpdate - Test the rai safety provider associated with the subscription. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2026-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of Cognitive Services account. // - safetyProviderName - The name of the Rai External Safety Provider associated with the Cognitive Services Account @@ -95,8 +95,8 @@ func (client *TestRaiExternalSafetyProviderClient) createOrUpdateCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, safetyProvider); err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testraiexternalsafetyprovider_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testraiexternalsafetyprovider_client_example_test.go index d2798c64b6bc..44ed282ee0b9 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testraiexternalsafetyprovider_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/testraiexternalsafetyprovider_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/TestRaiExternalSafetyProvider.json +// Generated from example definition: 2026-03-15-preview/TestRaiExternalSafetyProvider.json func ExampleTestRaiExternalSafetyProviderClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -41,7 +41,7 @@ func ExampleTestRaiExternalSafetyProviderClient_CreateOrUpdate() { _ = 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 = armcognitiveservices.TestRaiExternalSafetyProviderClientCreateOrUpdateResponse{ - // RaiExternalSafetyProviderSchema: &armcognitiveservices.RaiExternalSafetyProviderSchema{ + // RaiExternalSafetyProviderSchema: armcognitiveservices.RaiExternalSafetyProviderSchema{ // Name: to.Ptr("mySafetyProvider"), // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CognitiveServices/raiExternalSafetyProviders/mySafetyProvider"), // Properties: &armcognitiveservices.RaiExternalSafetyProviderSchemaProperties{ diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/tsp-location.yaml b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/tsp-location.yaml index 4cf3bf1aba5f..91382106951f 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/tsp-location.yaml +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/cognitiveservices/CognitiveServices.Management -commit: 2f2a6cd8118938c1ba3f65d4e09a550d4504620f +commit: 03635f9c9be65a2d2ca84f07b187173660d541e3 repo: Azure/azure-rest-api-specs additionalDirectories: diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go index 0aebe44c380f..ea9519706c8a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client.go @@ -18,6 +18,8 @@ import ( // UsagesClient contains the methods for the Usages group. // Don't use this type directly, use NewUsagesClient() instead. +// +// Generated from API version 2026-03-15-preview type UsagesClient struct { internal *arm.Client subscriptionID string @@ -40,8 +42,6 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o } // NewListPager - Get usages for the requested subscription -// -// Generated from API version 2026-01-15-preview // - location - The location name. // - options - UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. func (client *UsagesClient) NewListPager(location string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { @@ -86,8 +86,8 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2026-01-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") 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 index 82247bee2a09..75bca4a2540c 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client_example_test.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/usages_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2026-01-15-preview/ListUsages.json +// Generated from example definition: 2026-03-15-preview/ListUsages.json func ExampleUsagesClient_NewListPager_getUsages() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -53,7 +53,7 @@ func ExampleUsagesClient_NewListPager_getUsages() { } } -// Generated from example definition: 2026-01-15-preview/ListUsagesClassicScope.json +// Generated from example definition: 2026-03-15-preview/ListUsagesClassicScope.json func ExampleUsagesClient_NewListPager_getUsagesClassicScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -94,7 +94,7 @@ func ExampleUsagesClient_NewListPager_getUsagesClassicScope() { } } -// Generated from example definition: 2026-01-15-preview/ListUsagesDataZoneScope.json +// Generated from example definition: 2026-03-15-preview/ListUsagesDataZoneScope.json func ExampleUsagesClient_NewListPager_getUsagesDataZoneScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -136,7 +136,7 @@ func ExampleUsagesClient_NewListPager_getUsagesDataZoneScope() { } } -// Generated from example definition: 2026-01-15-preview/ListUsagesGlobalScope.json +// Generated from example definition: 2026-03-15-preview/ListUsagesGlobalScope.json func ExampleUsagesClient_NewListPager_getUsagesGlobalScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/version.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/version.go index e28b38047505..26979f3037e2 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/version.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/version.go @@ -6,5 +6,5 @@ package armcognitiveservices const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices" - moduleVersion = "v4.0.0-beta.1" + moduleVersion = "v4.0.0-beta.2" ) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/workbenches_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/workbenches_client.go new file mode 100644 index 000000000000..a06622bd24e9 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/workbenches_client.go @@ -0,0 +1,687 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcognitiveservices + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// WorkbenchesClient contains the methods for the Workbenches group. +// Don't use this type directly, use NewWorkbenchesClient() instead. +// +// Generated from API version 2026-03-15-preview +type WorkbenchesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWorkbenchesClient creates a new instance of WorkbenchesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewWorkbenchesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkbenchesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WorkbenchesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a workbench associated with the project. +// If the operation fails it returns an *azcore.ResponseError type. +// - 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. +// - workbenchName - The name of the workbench associated with the project. +// - resource - The workbench properties. +// - options - WorkbenchesClientBeginCreateOrUpdateOptions contains the optional parameters for the WorkbenchesClient.BeginCreateOrUpdate +// method. +func (client *WorkbenchesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, resource Workbench, options *WorkbenchesClientBeginCreateOrUpdateOptions) (*runtime.Poller[WorkbenchesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, projectName, workbenchName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkbenchesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WorkbenchesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a workbench associated with the project. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *WorkbenchesClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, resource Workbench, options *WorkbenchesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "WorkbenchesClient.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, workbenchName, resource, 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 *WorkbenchesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, resource Workbench, _ *WorkbenchesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}" + 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 workbenchName == "" { + return nil, errors.New("parameter workbenchName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workbenchName}", url.PathEscape(workbenchName)) + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified workbench associated with the project. +// If the operation fails it returns an *azcore.ResponseError type. +// - 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. +// - workbenchName - The name of the workbench associated with the project. +// - options - WorkbenchesClientBeginDeleteOptions contains the optional parameters for the WorkbenchesClient.BeginDelete method. +func (client *WorkbenchesClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginDeleteOptions) (*runtime.Poller[WorkbenchesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, projectName, workbenchName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkbenchesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WorkbenchesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the specified workbench associated with the project. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *WorkbenchesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "WorkbenchesClient.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, workbenchName, 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 *WorkbenchesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, _ *WorkbenchesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}" + 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 workbenchName == "" { + return nil, errors.New("parameter workbenchName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workbenchName}", url.PathEscape(workbenchName)) + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + +// Get - Gets the specified workbench associated with the project. +// If the operation fails it returns an *azcore.ResponseError type. +// - 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. +// - workbenchName - The name of the workbench associated with the project. +// - options - WorkbenchesClientGetOptions contains the optional parameters for the WorkbenchesClient.Get method. +func (client *WorkbenchesClient) Get(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientGetOptions) (WorkbenchesClientGetResponse, error) { + var err error + const operationName = "WorkbenchesClient.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, workbenchName, options) + if err != nil { + return WorkbenchesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WorkbenchesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WorkbenchesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *WorkbenchesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, _ *WorkbenchesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}" + 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 workbenchName == "" { + return nil, errors.New("parameter workbenchName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workbenchName}", url.PathEscape(workbenchName)) + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WorkbenchesClient) getHandleResponse(resp *http.Response) (WorkbenchesClientGetResponse, error) { + result := WorkbenchesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Workbench); err != nil { + return WorkbenchesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the workbenches associated with the project. +// - 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 - WorkbenchesClientListOptions contains the optional parameters for the WorkbenchesClient.NewListPager method. +func (client *WorkbenchesClient) NewListPager(resourceGroupName string, accountName string, projectName string, options *WorkbenchesClientListOptions) *runtime.Pager[WorkbenchesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[WorkbenchesClientListResponse]{ + More: func(page WorkbenchesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WorkbenchesClientListResponse) (WorkbenchesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WorkbenchesClient.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 WorkbenchesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *WorkbenchesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, _ *WorkbenchesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches" + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *WorkbenchesClient) listHandleResponse(resp *http.Response) (WorkbenchesClientListResponse, error) { + result := WorkbenchesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WorkbenchListResult); err != nil { + return WorkbenchesClientListResponse{}, err + } + return result, nil +} + +// BeginRestart - Restarts a running workbench resource. +// This is a long-running operation that returns 202 Accepted. +// Returns 204 if the workbench is already in the target state. +// If the operation fails it returns an *azcore.ResponseError type. +// - 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. +// - workbenchName - The name of the workbench associated with the project. +// - options - WorkbenchesClientBeginRestartOptions contains the optional parameters for the WorkbenchesClient.BeginRestart +// method. +func (client *WorkbenchesClient) BeginRestart(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginRestartOptions) (*runtime.Poller[WorkbenchesClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, accountName, projectName, workbenchName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkbenchesClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WorkbenchesClientRestartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Restart - Restarts a running workbench resource. +// This is a long-running operation that returns 202 Accepted. +// Returns 204 if the workbench is already in the target state. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *WorkbenchesClient) restart(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginRestartOptions) (*http.Response, error) { + var err error + const operationName = "WorkbenchesClient.BeginRestart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restartCreateRequest(ctx, resourceGroupName, accountName, projectName, workbenchName, 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 +} + +// restartCreateRequest creates the Restart request. +func (client *WorkbenchesClient) restartCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, _ *WorkbenchesClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}/restart" + 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 workbenchName == "" { + return nil, errors.New("parameter workbenchName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workbenchName}", url.PathEscape(workbenchName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + +// BeginStart - Starts a stopped workbench resource. +// This is a long-running operation that returns 202 Accepted. +// Returns 204 if the workbench is already in the target state. +// If the operation fails it returns an *azcore.ResponseError type. +// - 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. +// - workbenchName - The name of the workbench associated with the project. +// - options - WorkbenchesClientBeginStartOptions contains the optional parameters for the WorkbenchesClient.BeginStart method. +func (client *WorkbenchesClient) BeginStart(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginStartOptions) (*runtime.Poller[WorkbenchesClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, accountName, projectName, workbenchName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkbenchesClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WorkbenchesClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Start - Starts a stopped workbench resource. +// This is a long-running operation that returns 202 Accepted. +// Returns 204 if the workbench is already in the target state. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *WorkbenchesClient) start(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginStartOptions) (*http.Response, error) { + var err error + const operationName = "WorkbenchesClient.BeginStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startCreateRequest(ctx, resourceGroupName, accountName, projectName, workbenchName, 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 +} + +// startCreateRequest creates the Start request. +func (client *WorkbenchesClient) startCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, _ *WorkbenchesClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}/start" + 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 workbenchName == "" { + return nil, errors.New("parameter workbenchName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workbenchName}", url.PathEscape(workbenchName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + +// BeginStop - Stops a running workbench resource. +// This is a long-running operation that returns 202 Accepted. +// Returns 204 if the workbench is already in the target state. +// If the operation fails it returns an *azcore.ResponseError type. +// - 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. +// - workbenchName - The name of the workbench associated with the project. +// - options - WorkbenchesClientBeginStopOptions contains the optional parameters for the WorkbenchesClient.BeginStop method. +func (client *WorkbenchesClient) BeginStop(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginStopOptions) (*runtime.Poller[WorkbenchesClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, accountName, projectName, workbenchName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkbenchesClientStopResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WorkbenchesClientStopResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Stop - Stops a running workbench resource. +// This is a long-running operation that returns 202 Accepted. +// Returns 204 if the workbench is already in the target state. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *WorkbenchesClient) stop(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, options *WorkbenchesClientBeginStopOptions) (*http.Response, error) { + var err error + const operationName = "WorkbenchesClient.BeginStop" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.stopCreateRequest(ctx, resourceGroupName, accountName, projectName, workbenchName, 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 +} + +// stopCreateRequest creates the Stop request. +func (client *WorkbenchesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, _ *WorkbenchesClientBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}/stop" + 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 workbenchName == "" { + return nil, errors.New("parameter workbenchName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workbenchName}", url.PathEscape(workbenchName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + return req, nil +} + +// BeginUpdate - Updates a workbench associated with the project. +// If the operation fails it returns an *azcore.ResponseError type. +// - 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. +// - workbenchName - The name of the workbench associated with the project. +// - properties - The workbench properties to update. +// - options - WorkbenchesClientBeginUpdateOptions contains the optional parameters for the WorkbenchesClient.BeginUpdate method. +func (client *WorkbenchesClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, properties Workbench, options *WorkbenchesClientBeginUpdateOptions) (*runtime.Poller[WorkbenchesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, projectName, workbenchName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WorkbenchesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WorkbenchesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a workbench associated with the project. +// If the operation fails it returns an *azcore.ResponseError type. +func (client *WorkbenchesClient) update(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, properties Workbench, options *WorkbenchesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "WorkbenchesClient.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, workbenchName, properties, 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 *WorkbenchesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, projectName string, workbenchName string, properties Workbench, _ *WorkbenchesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}" + 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 workbenchName == "" { + return nil, errors.New("parameter workbenchName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workbenchName}", url.PathEscape(workbenchName)) + 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", version20260315Preview) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/workbenches_client_example_test.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/workbenches_client_example_test.go new file mode 100644 index 000000000000..09d0817429c5 --- /dev/null +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/workbenches_client_example_test.go @@ -0,0 +1,381 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armcognitiveservices_test + +import ( + "context" + "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/v4" + "log" +) + +// Generated from example definition: 2026-03-15-preview/PutWorkbench.json +func ExampleWorkbenchesClient_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("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewWorkbenchesClient().BeginCreateOrUpdate(ctx, "rgcognitiveservices", "myAccount", "myProject", "myWorkbench", armcognitiveservices.Workbench{ + Properties: &armcognitiveservices.WorkbenchProperties{ + TargetClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster"), + ImageLink: to.Ptr("mcr.microsoft.com/azureml/curated/pytorch-gpu:latest"), + IdleTimeBeforeShutdown: to.Ptr("PT30M"), + DatasetID: to.Ptr("dataset-12345"), + SSHSettings: &armcognitiveservices.SSHSettings{ + SSHPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."), + AdminEnabled: to.Ptr(true), + }, + }, + Location: to.Ptr("eastus"), + Identity: &armcognitiveservices.Identity{ + Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armcognitiveservices.UserAssignedIdentity{ + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {}, + }, + }, + }, 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 poll 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 = armcognitiveservices.WorkbenchesClientCreateOrUpdateResponse{ + // Workbench: armcognitiveservices.Workbench{ + // Properties: &armcognitiveservices.WorkbenchProperties{ + // TargetClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster"), + // ImageLink: to.Ptr("mcr.microsoft.com/azureml/curated/pytorch-gpu:latest"), + // IdleTimeBeforeShutdown: to.Ptr("PT30M"), + // DatasetID: to.Ptr("dataset-12345"), + // SSHSettings: &armcognitiveservices.SSHSettings{ + // SSHPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."), + // AdminEnabled: to.Ptr(true), + // }, + // ConnectivityEndpoints: &armcognitiveservices.ConnectivityEndpoints{ + // PublicIPAddress: to.Ptr("20.42.51.100"), + // SSHPort: to.Ptr[int32](50000), + // }, + // WebEndpoint: to.Ptr("https://myworkbench.eastus.api.azureml.ms"), + // ProvisioningState: to.Ptr(armcognitiveservices.ComputeProvisioningStateAccepted), + // Errors: []*armcognitiveservices.ErrorDetail{ + // }, + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // }, + // Location: to.Ptr("eastus"), + // Identity: &armcognitiveservices.Identity{ + // Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeUserAssigned), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // UserAssignedIdentities: map[string]*armcognitiveservices.UserAssignedIdentity{ + // "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": &armcognitiveservices.UserAssignedIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000002"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/projects/myProject/workbenches/myWorkbench"), + // Name: to.Ptr("myWorkbench"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/workbenches"), + // SystemData: &armcognitiveservices.SystemData{ + // CreatedBy: to.Ptr("xxx@microsoft.com"), + // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("xxx@microsoft.com"), + // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/DeleteWorkbench.json +func ExampleWorkbenchesClient_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("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewWorkbenchesClient().BeginDelete(ctx, "rgcognitiveservices", "myAccount", "myProject", "myWorkbench", 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 poll the result: %v", err) + } +} + +// Generated from example definition: 2026-03-15-preview/GetWorkbench.json +func ExampleWorkbenchesClient_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("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWorkbenchesClient().Get(ctx, "rgcognitiveservices", "myAccount", "myProject", "myWorkbench", 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 = armcognitiveservices.WorkbenchesClientGetResponse{ + // Workbench: armcognitiveservices.Workbench{ + // Properties: &armcognitiveservices.WorkbenchProperties{ + // TargetClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster"), + // ImageLink: to.Ptr("mcr.microsoft.com/azureml/curated/pytorch-gpu:latest"), + // IdleTimeBeforeShutdown: to.Ptr("PT30M"), + // DatasetID: to.Ptr("dataset-12345"), + // SSHSettings: &armcognitiveservices.SSHSettings{ + // SSHPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."), + // AdminEnabled: to.Ptr(true), + // }, + // ConnectivityEndpoints: &armcognitiveservices.ConnectivityEndpoints{ + // PublicIPAddress: to.Ptr("20.42.51.100"), + // SSHPort: to.Ptr[int32](50000), + // }, + // WebEndpoint: to.Ptr("https://myworkbench.eastus.api.azureml.ms"), + // ProvisioningState: to.Ptr(armcognitiveservices.ComputeProvisioningStateSucceeded), + // Errors: []*armcognitiveservices.ErrorDetail{ + // }, + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // }, + // Location: to.Ptr("eastus"), + // Identity: &armcognitiveservices.Identity{ + // Type: to.Ptr(armcognitiveservices.ResourceIdentityTypeUserAssigned), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // UserAssignedIdentities: map[string]*armcognitiveservices.UserAssignedIdentity{ + // "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": &armcognitiveservices.UserAssignedIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000001"), + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000002"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/projects/myProject/workbenches/myWorkbench"), + // Name: to.Ptr("myWorkbench"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/workbenches"), + // SystemData: &armcognitiveservices.SystemData{ + // CreatedBy: to.Ptr("xxx@microsoft.com"), + // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("xxx@microsoft.com"), + // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2026-03-15-preview/ListWorkbenches.json +func ExampleWorkbenchesClient_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("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewWorkbenchesClient().NewListPager("rgcognitiveservices", "myAccount", "myProject", 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 = armcognitiveservices.WorkbenchesClientListResponse{ + // WorkbenchListResult: armcognitiveservices.WorkbenchListResult{ + // Value: []*armcognitiveservices.Workbench{ + // { + // Properties: &armcognitiveservices.WorkbenchProperties{ + // TargetClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster"), + // ImageLink: to.Ptr("mcr.microsoft.com/azureml/curated/pytorch-gpu:latest"), + // IdleTimeBeforeShutdown: to.Ptr("PT30M"), + // DatasetID: to.Ptr("dataset-12345"), + // SSHSettings: &armcognitiveservices.SSHSettings{ + // SSHPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."), + // AdminEnabled: to.Ptr(true), + // }, + // ConnectivityEndpoints: &armcognitiveservices.ConnectivityEndpoints{ + // PublicIPAddress: to.Ptr("20.42.51.100"), + // SSHPort: to.Ptr[int32](50000), + // }, + // WebEndpoint: to.Ptr("https://myworkbench.eastus.api.azureml.ms"), + // ProvisioningState: to.Ptr(armcognitiveservices.ComputeProvisioningStateSucceeded), + // Errors: []*armcognitiveservices.ErrorDetail{ + // }, + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // }, + // Location: to.Ptr("eastus"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/projects/myProject/workbenches/myWorkbench"), + // Name: to.Ptr("myWorkbench"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/workbenches"), + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2026-03-15-preview/RestartWorkbench.json +func ExampleWorkbenchesClient_BeginRestart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewWorkbenchesClient().BeginRestart(ctx, "rgcognitiveservices", "myAccount", "myProject", "myWorkbench", 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 poll the result: %v", err) + } +} + +// Generated from example definition: 2026-03-15-preview/StartWorkbench.json +func ExampleWorkbenchesClient_BeginStart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewWorkbenchesClient().BeginStart(ctx, "rgcognitiveservices", "myAccount", "myProject", "myWorkbench", 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 poll the result: %v", err) + } +} + +// Generated from example definition: 2026-03-15-preview/StopWorkbench.json +func ExampleWorkbenchesClient_BeginStop() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcognitiveservices.NewClientFactory("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewWorkbenchesClient().BeginStop(ctx, "rgcognitiveservices", "myAccount", "myProject", "myWorkbench", 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 poll the result: %v", err) + } +} + +// Generated from example definition: 2026-03-15-preview/UpdateWorkbench.json +func ExampleWorkbenchesClient_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("00000000-1111-2222-3333-444444444444", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewWorkbenchesClient().BeginUpdate(ctx, "rgcognitiveservices", "myAccount", "myProject", "myWorkbench", armcognitiveservices.Workbench{ + Properties: &armcognitiveservices.WorkbenchProperties{ + TargetClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster"), + ImageLink: to.Ptr("mcr.microsoft.com/azureml/curated/pytorch-gpu:v2"), + IdleTimeBeforeShutdown: to.Ptr("PT1H"), + DatasetID: to.Ptr("dataset-67890"), + SSHSettings: &armcognitiveservices.SSHSettings{ + SSHPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."), + AdminEnabled: to.Ptr(true), + }, + }, + Tags: map[string]*string{ + "environment": to.Ptr("production"), + }, + }, 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 poll 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 = armcognitiveservices.WorkbenchesClientUpdateResponse{ + // Workbench: armcognitiveservices.Workbench{ + // Properties: &armcognitiveservices.WorkbenchProperties{ + // TargetClusterID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster"), + // ImageLink: to.Ptr("mcr.microsoft.com/azureml/curated/pytorch-gpu:v2"), + // IdleTimeBeforeShutdown: to.Ptr("PT1H"), + // DatasetID: to.Ptr("dataset-67890"), + // SSHSettings: &armcognitiveservices.SSHSettings{ + // SSHPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."), + // AdminEnabled: to.Ptr(true), + // }, + // ConnectivityEndpoints: &armcognitiveservices.ConnectivityEndpoints{ + // PublicIPAddress: to.Ptr("20.42.51.100"), + // SSHPort: to.Ptr[int32](50000), + // }, + // WebEndpoint: to.Ptr("https://myworkbench.eastus.api.azureml.ms"), + // ProvisioningState: to.Ptr(armcognitiveservices.ComputeProvisioningStateAccepted), + // Errors: []*armcognitiveservices.ErrorDetail{ + // }, + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "environment": to.Ptr("production"), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/projects/myProject/workbenches/myWorkbench"), + // Name: to.Ptr("myWorkbench"), + // Type: to.Ptr("Microsoft.CognitiveServices/accounts/projects/workbenches"), + // SystemData: &armcognitiveservices.SystemData{ + // CreatedBy: to.Ptr("xxx@microsoft.com"), + // CreatedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // LastModifiedBy: to.Ptr("xxx@microsoft.com"), + // LastModifiedByType: to.Ptr(armcognitiveservices.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2026-03-24T12:00:00.000Z"); return t}()), + // }, + // }, + // } +}