From 82e849bf274636c99f04c02e140206be48e1a9b7 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 22 May 2026 16:59:36 +0000 Subject: [PATCH] Configurations: 'specification/cognitiveservices/CognitiveServices.Management/tspconfig.yaml', API Version: 2026-03-15-preview, SDK Release Type: beta, and CommitSHA: '182eacfaa4691f06fb161722f13f4d99e9b26a0a' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6340768 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../azure-mgmt-cognitiveservices/CHANGELOG.md | 59 + .../azure-mgmt-cognitiveservices/README.md | 4 +- .../_metadata.json | 8 +- .../apiview-properties.json | 92 +- .../azure/mgmt/cognitiveservices/_client.py | 42 +- .../mgmt/cognitiveservices/_configuration.py | 7 +- .../azure/mgmt/cognitiveservices/_patch.py | 1 - .../cognitiveservices/_utils/model_base.py | 531 +- .../cognitiveservices/_utils/serialization.py | 29 +- .../azure/mgmt/cognitiveservices/_version.py | 2 +- .../mgmt/cognitiveservices/aio/_client.py | 42 +- .../cognitiveservices/aio/_configuration.py | 7 +- .../mgmt/cognitiveservices/aio/_patch.py | 1 - .../aio/operations/__init__.py | 10 + .../aio/operations/_operations.py | 4963 ++++- .../aio/operations/_patch.py | 1 - .../mgmt/cognitiveservices/models/__init__.py | 70 +- .../mgmt/cognitiveservices/models/_enums.py | 64 +- .../mgmt/cognitiveservices/models/_models.py | 1846 +- .../mgmt/cognitiveservices/models/_patch.py | 1 - .../cognitiveservices/operations/__init__.py | 10 + .../operations/_operations.py | 18485 ++++++++++------ .../cognitiveservices/operations/_patch.py | 1 - .../add_rai_blocklist_items.py | 2 +- .../calculate_model_capacity.py | 2 +- .../check_domain_availability.py | 2 +- .../check_sku_availability.py | 2 +- .../generated_samples/create.py | 2 +- .../generated_samples/create_account.py | 2 +- .../generated_samples/create_account_min.py | 2 +- .../generated_samples/create_or_update.py | 2 +- ...te_or_update_managed_compute_deployment.py | 53 + .../create_or_update_managed_network_v2.py | 2 +- .../create_or_update_quota_tier.py | 2 +- .../create_or_update_rule_v2.py | 2 +- ...or_update_vm_managed_compute_deployment.py | 53 + .../generated_samples/create_project.py | 2 +- .../generated_samples/create_project_min.py | 2 +- .../create_shared_commitment_plan.py | 2 +- ...eate_shared_commitment_plan_association.py | 2 +- .../generated_samples/delete.py | 2 +- .../generated_samples/delete_account.py | 2 +- .../delete_commitment_plan.py | 2 +- .../generated_samples/delete_compute.py | 42 + .../generated_samples/delete_deployment.py | 2 +- .../delete_encryption_scope.py | 2 +- .../delete_managed_compute_deployment.py | 42 + .../delete_managed_network_v2.py | 2 +- .../delete_private_endpoint_connection.py | 2 +- .../generated_samples/delete_project.py | 2 +- .../generated_samples/delete_rai_blocklist.py | 2 +- .../delete_rai_blocklist_item.py | 2 +- .../delete_rai_blocklist_items.py | 2 +- .../delete_rai_external_safety_provider.py | 2 +- .../generated_samples/delete_rai_policy.py | 2 +- .../delete_rai_tool_label.py | 2 +- .../generated_samples/delete_rai_topic.py | 2 +- .../generated_samples/delete_rule_v2.py | 2 +- .../delete_shared_commitment_plan.py | 2 +- ...lete_shared_commitment_plan_association.py | 2 +- .../delete_subscription_rai_policy.py | 2 +- .../generated_samples/delete_workbench.py | 43 + .../generated_samples/disable.py | 2 +- .../generated_samples/enable.py | 2 +- .../evaluate_deployment_policies.py | 57 + .../generated_samples/get.py | 2 +- .../generated_samples/get_account.py | 2 +- .../generated_samples/get_commitment_plan.py | 2 +- .../generated_samples/get_compute.py | 43 + .../get_compute_operation_status.py | 2 +- .../get_container_instance_compute.py | 43 + .../get_defender_for_ai_setting.py | 2 +- .../generated_samples/get_deleted_account.py | 2 +- .../generated_samples/get_deployment.py | 2 +- .../generated_samples/get_encryption_scope.py | 2 +- .../get_managed_compute_deployment.py | 43 + .../get_managed_network_v2.py | 2 +- ...twork_security_perimeter_configurations.py | 2 +- .../generated_samples/get_operations.py | 2 +- .../get_private_endpoint_connection.py | 2 +- .../generated_samples/get_project.py | 2 +- .../generated_samples/get_quota_tier.py | 2 +- .../generated_samples/get_rai_blocklist.py | 2 +- .../get_rai_blocklist_item.py | 2 +- .../get_rai_content_filter.py | 2 +- .../get_rai_external_safety_provider.py | 2 +- .../generated_samples/get_rai_policy.py | 2 +- .../generated_samples/get_rai_tool_label.py | 2 +- .../generated_samples/get_rai_topic.py | 2 +- .../generated_samples/get_rule_v2.py | 2 +- .../get_shared_commitment_plan.py | 2 +- .../get_shared_commitment_plan_association.py | 2 +- .../generated_samples/get_skus.py | 2 +- .../get_subscription_rai_policy.py | 2 +- .../generated_samples/get_usages.py | 2 +- .../get_usages_classic_scope.py | 2 +- .../get_usages_data_zone_scope.py | 2 +- .../get_usages_global_scope.py | 2 +- .../get_vm_managed_compute_deployment.py | 43 + .../generated_samples/get_workbench.py | 44 + .../generated_samples/list.py | 2 +- .../generated_samples/list_account_models.py | 2 +- .../list_accounts_by_resource_group.py | 2 +- .../list_accounts_by_subscription.py | 2 +- .../generated_samples/list_agents.py | 2 +- .../generated_samples/list_blocklist_items.py | 2 +- .../generated_samples/list_blocklists.py | 2 +- .../list_commitment_plans.py | 2 +- .../list_commitment_tiers.py | 2 +- .../generated_samples/list_computes.py | 43 + .../list_defender_for_ai_setting.py | 2 +- .../list_deleted_accounts_by_subscription.py | 2 +- .../generated_samples/list_deployment_skus.py | 2 +- .../generated_samples/list_deployments.py | 2 +- .../list_encryption_scopes.py | 2 +- .../generated_samples/list_keys.py | 2 +- .../list_location_based_model_capacities.py | 2 +- ...on_based_model_capacities_classic_scope.py | 2 +- ..._based_model_capacities_data_zone_scope.py | 2 +- ...ion_based_model_capacities_global_scope.py | 2 +- .../generated_samples/list_location_models.py | 2 +- .../list_managed_compute_capacities.py | 42 + .../list_managed_compute_deployments.py | 43 + .../list_managed_compute_usages.py | 42 + .../list_managed_network_v2.py | 2 +- .../list_model_capacities.py | 2 +- .../list_model_capacities_classic_scope.py | 2 +- .../list_model_capacities_data_zone_scope.py | 2 +- .../list_model_capacities_global_scope.py | 2 +- ...twork_security_perimeter_configurations.py | 2 +- .../list_private_endpoint_connections.py | 2 +- .../list_private_link_resources.py | 2 +- .../generated_samples/list_projects.py | 2 +- .../generated_samples/list_quota_tiers.py | 2 +- .../list_rai_content_filters.py | 2 +- .../list_rai_external_safety_providers.py | 2 +- .../generated_samples/list_rai_policies.py | 2 +- .../generated_samples/list_rai_tool_labels.py | 2 +- .../generated_samples/list_rai_topics.py | 2 +- .../generated_samples/list_rule_v2.py | 2 +- ...ist_shared_commitment_plan_associations.py | 2 +- ...ared_commitment_plans_by_resource_group.py | 2 +- ...shared_commitment_plans_by_subscription.py | 2 +- .../generated_samples/list_skus.py | 2 +- .../generated_samples/list_usages.py | 2 +- .../list_usages_classic_scope.py | 2 +- .../list_usages_data_zone_scope.py | 2 +- .../list_usages_global_scope.py | 2 +- .../list_vm_managed_compute_deployments.py | 43 + .../generated_samples/list_workbenches.py | 44 + .../patch_managed_network_v2.py | 2 +- .../generated_samples/pause_deployment.py | 2 +- .../post_outbound_rules_v2.py | 5 +- .../provision_managed_network.py | 2 +- .../purge_deleted_account.py | 2 +- .../generated_samples/put_commitment_plan.py | 2 +- .../generated_samples/put_compute.py | 55 + .../put_container_instance_compute.py | 60 + .../put_defender_for_ai_setting.py | 2 +- .../generated_samples/put_deployment.py | 2 +- .../generated_samples/put_encryption_scope.py | 2 +- .../put_private_endpoint_connection.py | 2 +- .../generated_samples/put_rai_blocklist.py | 2 +- .../put_rai_blocklist_item.py | 2 +- .../put_rai_external_safety_provider.py | 2 +- .../generated_samples/put_rai_policy.py | 2 +- .../generated_samples/put_rai_tool_label.py | 2 +- .../generated_samples/put_rai_topic.py | 2 +- .../put_subscription_rai_policy.py | 2 +- .../generated_samples/put_workbench.py | 61 + ...twork_security_perimeter_configurations.py | 2 +- .../generated_samples/regenerate_key.py | 2 +- .../restart_container_instance_compute.py | 42 + .../generated_samples/restart_workbench.py | 43 + .../generated_samples/resume_deployment.py | 2 +- .../generated_samples/start.py | 2 +- .../start_container_instance_compute.py | 42 + .../generated_samples/start_workbench.py | 43 + .../generated_samples/stop.py | 2 +- .../stop_container_instance_compute.py | 42 + .../generated_samples/stop_workbench.py | 43 + .../test_rai_external_safety_provider.py | 2 +- .../generated_samples/update.py | 2 +- .../generated_samples/update_account.py | 2 +- .../generated_samples/update_compute.py | 51 + .../update_defender_for_ai_setting.py | 2 +- .../generated_samples/update_deployment.py | 2 +- .../update_managed_compute_deployment.py | 44 + .../generated_samples/update_projects.py | 2 +- .../generated_samples/update_quota_tier.py | 2 +- .../update_shared_commitment_plan.py | 2 +- .../update_vm_managed_compute_deployment.py | 44 + .../generated_samples/update_workbench.py | 55 + ...services_management_accounts_operations.py | 43 + ...es_management_accounts_operations_async.py | 43 + ...services_management_computes_operations.py | 162 + ...es_management_computes_operations_async.py | 175 + ..._management_deleted_accounts_operations.py | 16 +- ...ement_deleted_accounts_operations_async.py | 16 +- ...t_managed_compute_capacities_operations.py | 29 + ...ged_compute_capacities_operations_async.py | 30 + ..._managed_compute_deployments_operations.py | 107 + ...ed_compute_deployments_operations_async.py | 118 + ...mpute_usages_operation_group_operations.py | 29 + ...usages_operation_group_operations_async.py | 30 + ...es_management_outbound_rules_operations.py | 2 +- ...agement_outbound_rules_operations_async.py | 2 +- ...ices_management_rai_policies_operations.py | 1 - ...anagement_rai_policies_operations_async.py | 1 - ...ment_subscription_rai_policy_operations.py | 1 - ...ubscription_rai_policy_operations_async.py | 1 - ...vices_management_workbenches_operations.py | 206 + ...management_workbenches_operations_async.py | 219 + .../pyproject.toml | 3 +- .../tsp-location.yaml | 2 +- 215 files changed, 21579 insertions(+), 7604 deletions(-) create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_managed_compute_deployment.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_vm_managed_compute_deployment.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_compute.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_managed_compute_deployment.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_workbench.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/evaluate_deployment_policies.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_compute.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_container_instance_compute.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_managed_compute_deployment.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_vm_managed_compute_deployment.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_workbench.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_computes.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_capacities.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_deployments.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_usages.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_vm_managed_compute_deployments.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_workbenches.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_compute.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_container_instance_compute.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_workbench.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/restart_container_instance_compute.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/restart_workbench.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start_container_instance_compute.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start_workbench.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop_container_instance_compute.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop_workbench.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_compute.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_managed_compute_deployment.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_vm_managed_compute_deployment.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_workbench.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_computes_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_computes_operations_async.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_capacities_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_capacities_operations_async.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_deployments_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_deployments_operations_async.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_usages_operation_group_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_usages_operation_group_operations_async.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_workbenches_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_workbenches_operations_async.py diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md index 70659061c6d7..4c9c3ff95617 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md @@ -1,5 +1,64 @@ # Release History +## 15.0.0b2 (2026-05-22) + +### Features Added + + - Client `CognitiveServicesManagementClient` added operation group `managed_compute_deployments` + - Client `CognitiveServicesManagementClient` added operation group `managed_compute_usages_operation_group` + - Client `CognitiveServicesManagementClient` added operation group `computes` + - Client `CognitiveServicesManagementClient` added operation group `workbenches` + - Client `CognitiveServicesManagementClient` added operation group `managed_compute_capacities` + - Enum `RoutingMode` added member `QUALITY` + - Added model `ClusterComputeProperties` + - Added model `Compute` + - Added model `ComputeProperties` + - Added enum `ComputeProvisioningState` + - Added enum `ComputeType` + - Added model `ConnectivityEndpoints` + - Added model `ContainerInstanceComputeProperties` + - Added model `DeploymentPolicyEvaluationResult` + - Added model `DeploymentSizeCapacity` + - Added model `EvaluateDeploymentPoliciesDeployment` + - Added model `EvaluateDeploymentPoliciesDeploymentProperties` + - Added model `EvaluateDeploymentPoliciesRequest` + - Added model `EvaluateDeploymentPoliciesResponse` + - Added model `ManagedComputeCapacity` + - Added model `ManagedComputeCapacityProperties` + - Added model `ManagedComputeDeployment` + - Added model `ManagedComputeDeploymentInfo` + - Added model `ManagedComputeDeploymentProperties` + - Added model `ManagedComputeDeploymentProvisioningDetails` + - Added model `ManagedComputeDeploymentRoutes` + - Added model `ManagedComputeUsage` + - Added model `PatchResourceSku` + - Added model `PolicyAssignmentEvaluationDetails` + - Added enum `PolicyEvaluationOutcome` + - Added model `PolicyExpressionEvaluationDetails` + - Added model `Pool` + - Added model `SshSettings` + - Added enum `VmPriority` + - Added model `Workbench` + - Added model `WorkbenchProperties` + - Model `AccountsOperations` added method `evaluate_deployment_policies` + - Added model `ComputesOperations` + - Added model `ManagedComputeCapacitiesOperations` + - Added model `ManagedComputeDeploymentsOperations` + - Added model `ManagedComputeUsagesOperationGroupOperations` + - Added model `WorkbenchesOperations` + +### Breaking Changes + + - Model `RaiPolicyProperties` deleted or renamed its instance variable `custom_topics` + - Deleted or renamed enum value `RoutingMode.ACCURACY` + - Deleted or renamed model `CustomTopicConfig` + - Deleted or renamed model `RaiExternalSafetyProvider` + - Deleted or renamed model `RaiExternalSafetyProviderProperties` + - Deleted or renamed model `RaiTopicConfig` + - Method `OutboundRulesOperations.begin_post` changed return type from `AsyncLROPoller[OutboundRuleListResult]` to `AsyncLROPoller[AsyncItemPaged[_models.OutboundRuleBasicResource]]` + - Method `OutboundRulesOperations.begin_post` changed return type from `LROPoller[OutboundRuleListResult]` to `LROPoller[ItemPaged[_models.OutboundRuleBasicResource]]` + - Method `RaiExternalSafetyProviderOperations.create_or_update` changed return type from `Union[RaiExternalSafetyProviderSchema, RaiExternalSafetyProvider]` to `RaiExternalSafetyProviderSchema` + ## 15.0.0b1 (2026-03-26) ### Features Added diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md index b9e2907e36c8..3cef2dfa2dc6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Cognitive Services Management Client Library. -This package has been tested with Python 3.9+. +This package has been tested with Python 3.10+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.9+ is required to use this package. +- Python 3.10+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_metadata.json b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_metadata.json index 524f92927225..9dba60621134 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_metadata.json +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_metadata.json @@ -1,10 +1,10 @@ { - "apiVersion": "2026-01-15-preview", + "apiVersion": "2026-03-15-preview", "apiVersions": { - "Microsoft.CognitiveServices": "2026-01-15-preview" + "Microsoft.CognitiveServices": "2026-03-15-preview" }, - "commit": "2f2a6cd8118938c1ba3f65d4e09a550d4504620f", + "commit": "182eacfaa4691f06fb161722f13f4d99e9b26a0a", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/cognitiveservices/CognitiveServices.Management", - "emitterVersion": "0.61.1" + "emitterVersion": "0.62.1" } \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/apiview-properties.json b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/apiview-properties.json index d59341126891..642630e34af8 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/apiview-properties.json +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/apiview-properties.json @@ -6,6 +6,7 @@ "azure.mgmt.cognitiveservices.models.AbusePenalty": "Microsoft.CognitiveServices.AbusePenalty", "azure.mgmt.cognitiveservices.models.AccessKeyAuthTypeConnectionProperties": "Microsoft.CognitiveServices.AccessKeyAuthTypeConnectionProperties", "azure.mgmt.cognitiveservices.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.cognitiveservices.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", "azure.mgmt.cognitiveservices.models.Account": "Microsoft.CognitiveServices.Account", "azure.mgmt.cognitiveservices.models.AccountKeyAuthTypeConnectionProperties": "Microsoft.CognitiveServices.AccountKeyAuthTypeConnectionProperties", "azure.mgmt.cognitiveservices.models.DeploymentModel": "Microsoft.CognitiveServices.DeploymentModel", @@ -13,7 +14,6 @@ "azure.mgmt.cognitiveservices.models.AccountProperties": "Microsoft.CognitiveServices.AccountProperties", "azure.mgmt.cognitiveservices.models.AccountSku": "Microsoft.CognitiveServices.AccountSku", "azure.mgmt.cognitiveservices.models.AccountSkuListResult": "Microsoft.CognitiveServices.AccountSkuListResult", - "azure.mgmt.cognitiveservices.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", "azure.mgmt.cognitiveservices.models.AgentApplication": "Microsoft.CognitiveServices.AgentApplication", "azure.mgmt.cognitiveservices.models.AgentDeployment": "Microsoft.CognitiveServices.AgentDeployment", "azure.mgmt.cognitiveservices.models.ResourceBase": "Microsoft.CognitiveServices.ResourceBase", @@ -40,6 +40,8 @@ "azure.mgmt.cognitiveservices.models.ChannelsBuiltInAuthorizationPolicy": "Microsoft.CognitiveServices.ChannelsBuiltInAuthorizationPolicy", "azure.mgmt.cognitiveservices.models.CheckDomainAvailabilityParameter": "Microsoft.CognitiveServices.CheckDomainAvailabilityParameter", "azure.mgmt.cognitiveservices.models.CheckSkuAvailabilityParameter": "Microsoft.CognitiveServices.CheckSkuAvailabilityParameter", + "azure.mgmt.cognitiveservices.models.ComputeProperties": "Microsoft.CognitiveServices.ComputeProperties", + "azure.mgmt.cognitiveservices.models.ClusterComputeProperties": "Microsoft.CognitiveServices.ClusterComputeProperties", "azure.mgmt.cognitiveservices.models.CommitmentCost": "Microsoft.CognitiveServices.CommitmentCost", "azure.mgmt.cognitiveservices.models.CommitmentPeriod": "Microsoft.CognitiveServices.CommitmentPeriod", "azure.mgmt.cognitiveservices.models.CommitmentPlan": "Microsoft.CognitiveServices.CommitmentPlan", @@ -49,6 +51,7 @@ "azure.mgmt.cognitiveservices.models.CommitmentPlanProperties": "Microsoft.CognitiveServices.CommitmentPlanProperties", "azure.mgmt.cognitiveservices.models.CommitmentQuota": "Microsoft.CognitiveServices.CommitmentQuota", "azure.mgmt.cognitiveservices.models.CommitmentTier": "Microsoft.CognitiveServices.CommitmentTier", + "azure.mgmt.cognitiveservices.models.Compute": "Microsoft.CognitiveServices.Compute", "azure.mgmt.cognitiveservices.models.ComputeOperationStatus": "Microsoft.CognitiveServices.ComputeOperationStatus", "azure.mgmt.cognitiveservices.models.ComputeOperationStatusProperties": "Microsoft.CognitiveServices.ComputeOperationStatusProperties", "azure.mgmt.cognitiveservices.models.ConnectionAccessKey": "Microsoft.CognitiveServices.ConnectionAccessKey", @@ -62,19 +65,21 @@ "azure.mgmt.cognitiveservices.models.ConnectionSharedAccessSignature": "Microsoft.CognitiveServices.ConnectionSharedAccessSignature", "azure.mgmt.cognitiveservices.models.ConnectionUpdateContent": "Microsoft.CognitiveServices.ConnectionUpdateContent", "azure.mgmt.cognitiveservices.models.ConnectionUsernamePassword": "Microsoft.CognitiveServices.ConnectionUsernamePassword", + "azure.mgmt.cognitiveservices.models.ConnectivityEndpoints": "Microsoft.CognitiveServices.ConnectivityEndpoints", + "azure.mgmt.cognitiveservices.models.ContainerInstanceComputeProperties": "Microsoft.CognitiveServices.ContainerInstanceComputeProperties", "azure.mgmt.cognitiveservices.models.RaiBlocklistConfig": "Microsoft.CognitiveServices.RaiBlocklistConfig", "azure.mgmt.cognitiveservices.models.CustomBlocklistConfig": "Microsoft.CognitiveServices.CustomBlocklistConfig", "azure.mgmt.cognitiveservices.models.CustomKeys": "Microsoft.CognitiveServices.CustomKeys", "azure.mgmt.cognitiveservices.models.CustomKeysConnectionProperties": "Microsoft.CognitiveServices.CustomKeysConnectionProperties", - "azure.mgmt.cognitiveservices.models.RaiTopicConfig": "Microsoft.CognitiveServices.RaiTopicConfig", - "azure.mgmt.cognitiveservices.models.CustomTopicConfig": "Microsoft.CognitiveServices.CustomTopicConfig", "azure.mgmt.cognitiveservices.models.DefenderForAISetting": "Microsoft.CognitiveServices.DefenderForAISetting", "azure.mgmt.cognitiveservices.models.DefenderForAISettingProperties": "Microsoft.CognitiveServices.DefenderForAISettingProperties", "azure.mgmt.cognitiveservices.models.Deployment": "Microsoft.CognitiveServices.Deployment", "azure.mgmt.cognitiveservices.models.DeploymentCapacitySettings": "Microsoft.CognitiveServices.DeploymentCapacitySettings", + "azure.mgmt.cognitiveservices.models.DeploymentPolicyEvaluationResult": "Microsoft.CognitiveServices.DeploymentPolicyEvaluationResult", "azure.mgmt.cognitiveservices.models.DeploymentProperties": "Microsoft.CognitiveServices.DeploymentProperties", "azure.mgmt.cognitiveservices.models.DeploymentRouting": "Microsoft.CognitiveServices.DeploymentRouting", "azure.mgmt.cognitiveservices.models.DeploymentScaleSettings": "Microsoft.CognitiveServices.DeploymentScaleSettings", + "azure.mgmt.cognitiveservices.models.DeploymentSizeCapacity": "Microsoft.CognitiveServices.DeploymentSizeCapacity", "azure.mgmt.cognitiveservices.models.DomainAvailability": "Microsoft.CognitiveServices.DomainAvailability", "azure.mgmt.cognitiveservices.models.Encryption": "Microsoft.CognitiveServices.Encryption", "azure.mgmt.cognitiveservices.models.EncryptionScope": "Microsoft.CognitiveServices.EncryptionScope", @@ -82,6 +87,10 @@ "azure.mgmt.cognitiveservices.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", "azure.mgmt.cognitiveservices.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", "azure.mgmt.cognitiveservices.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesDeployment": "Microsoft.CognitiveServices.EvaluateDeploymentPoliciesDeployment", + "azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesDeploymentProperties": "Microsoft.CognitiveServices.EvaluateDeploymentPoliciesDeploymentProperties", + "azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesRequest": "Microsoft.CognitiveServices.EvaluateDeploymentPoliciesRequest", + "azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesResponse": "Microsoft.CognitiveServices.EvaluateDeploymentPoliciesResponse", "azure.mgmt.cognitiveservices.models.FoundryAutoUpgrade": "Microsoft.CognitiveServices.FoundryAutoUpgrade", "azure.mgmt.cognitiveservices.models.OutboundRule": "Microsoft.CognitiveServices.OutboundRule", "azure.mgmt.cognitiveservices.models.FqdnOutboundRule": "Microsoft.CognitiveServices.FqdnOutboundRule", @@ -90,6 +99,14 @@ "azure.mgmt.cognitiveservices.models.IpRule": "Microsoft.CognitiveServices.IpRule", "azure.mgmt.cognitiveservices.models.KeyVaultProperties": "Microsoft.CognitiveServices.KeyVaultProperties", "azure.mgmt.cognitiveservices.models.ManagedAgentDeployment": "Microsoft.CognitiveServices.ManagedAgentDeployment", + "azure.mgmt.cognitiveservices.models.ManagedComputeCapacity": "Microsoft.CognitiveServices.ManagedComputeCapacity", + "azure.mgmt.cognitiveservices.models.ManagedComputeCapacityProperties": "Microsoft.CognitiveServices.ManagedComputeCapacityProperties", + "azure.mgmt.cognitiveservices.models.ManagedComputeDeployment": "Microsoft.CognitiveServices.ManagedComputeDeployment", + "azure.mgmt.cognitiveservices.models.ManagedComputeDeploymentInfo": "Microsoft.CognitiveServices.ManagedComputeDeploymentInfo", + "azure.mgmt.cognitiveservices.models.ManagedComputeDeploymentProperties": "Microsoft.CognitiveServices.ManagedComputeDeploymentProperties", + "azure.mgmt.cognitiveservices.models.ManagedComputeDeploymentProvisioningDetails": "Microsoft.CognitiveServices.ManagedComputeDeploymentProvisioningDetails", + "azure.mgmt.cognitiveservices.models.ManagedComputeDeploymentRoutes": "Microsoft.CognitiveServices.ManagedComputeDeploymentRoutes", + "azure.mgmt.cognitiveservices.models.ManagedComputeUsage": "Microsoft.CognitiveServices.ManagedComputeUsage", "azure.mgmt.cognitiveservices.models.ManagedIdentityAuthTypeConnectionProperties": "Microsoft.CognitiveServices.ManagedIdentityAuthTypeConnectionProperties", "azure.mgmt.cognitiveservices.models.ManagedNetworkProvisionOptions": "Microsoft.CognitiveServices.ManagedNetworkProvisionOptions", "azure.mgmt.cognitiveservices.models.ManagedNetworkProvisionStatus": "Microsoft.CognitiveServices.ManagedNetworkProvisionStatus", @@ -123,10 +140,13 @@ "azure.mgmt.cognitiveservices.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", "azure.mgmt.cognitiveservices.models.OrganizationSharedBuiltInAuthorizationPolicy": "Microsoft.CognitiveServices.OrganizationSharedBuiltInAuthorizationPolicy", "azure.mgmt.cognitiveservices.models.OutboundRuleBasicResource": "Microsoft.CognitiveServices.OutboundRuleBasicResource", - "azure.mgmt.cognitiveservices.models.OutboundRuleListResult": "Microsoft.CognitiveServices.OutboundRuleListResult", "azure.mgmt.cognitiveservices.models.PATAuthTypeConnectionProperties": "Microsoft.CognitiveServices.PATAuthTypeConnectionProperties", + "azure.mgmt.cognitiveservices.models.PatchResourceSku": "Microsoft.CognitiveServices.PatchResourceSku", "azure.mgmt.cognitiveservices.models.PatchResourceTags": "Microsoft.CognitiveServices.PatchResourceTags", "azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku": "Microsoft.CognitiveServices.PatchResourceTagsAndSku", + "azure.mgmt.cognitiveservices.models.PolicyAssignmentEvaluationDetails": "Microsoft.CognitiveServices.PolicyAssignmentEvaluationDetails", + "azure.mgmt.cognitiveservices.models.PolicyExpressionEvaluationDetails": "Microsoft.CognitiveServices.PolicyExpressionEvaluationDetails", + "azure.mgmt.cognitiveservices.models.Pool": "Microsoft.CognitiveServices.Pool", "azure.mgmt.cognitiveservices.models.PrivateEndpoint": "Azure.ResourceManager.CommonTypes.PrivateEndpoint", "azure.mgmt.cognitiveservices.models.PrivateEndpointConnection": "Microsoft.CognitiveServices.PrivateEndpointConnection", "azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionListResult": "Microsoft.CognitiveServices.PrivateEndpointConnectionListResult", @@ -154,8 +174,6 @@ "azure.mgmt.cognitiveservices.models.RaiBlocklistProperties": "Microsoft.CognitiveServices.RaiBlocklistProperties", "azure.mgmt.cognitiveservices.models.RaiContentFilter": "Microsoft.CognitiveServices.RaiContentFilter", "azure.mgmt.cognitiveservices.models.RaiContentFilterProperties": "Microsoft.CognitiveServices.RaiContentFilterProperties", - "azure.mgmt.cognitiveservices.models.RaiExternalSafetyProvider": "Microsoft.CognitiveServices.RaiExternalSafetyProvider", - "azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderProperties": "Microsoft.CognitiveServices.RaiExternalSafetyProviderProperties", "azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema": "Microsoft.CognitiveServices.RaiExternalSafetyProviderSchema", "azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchemaProperties": "Microsoft.CognitiveServices.RaiExternalSafetyProviderSchemaProperties", "azure.mgmt.cognitiveservices.models.RaiMonitorConfig": "Microsoft.CognitiveServices.RaiMonitorConfig", @@ -188,6 +206,7 @@ "azure.mgmt.cognitiveservices.models.SkuCapability": "Microsoft.CognitiveServices.SkuCapability", "azure.mgmt.cognitiveservices.models.SkuChangeInfo": "Microsoft.CognitiveServices.SkuChangeInfo", "azure.mgmt.cognitiveservices.models.SkuResource": "Microsoft.CognitiveServices.SkuResource", + "azure.mgmt.cognitiveservices.models.SshSettings": "Microsoft.CognitiveServices.SshSettings", "azure.mgmt.cognitiveservices.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", "azure.mgmt.cognitiveservices.models.ThrottlingRule": "Microsoft.CognitiveServices.ThrottlingRule", "azure.mgmt.cognitiveservices.models.TrafficRoutingRule": "Microsoft.CognitiveServices.TrafficRoutingRule", @@ -199,6 +218,8 @@ "azure.mgmt.cognitiveservices.models.UserOwnedStorage": "Microsoft.CognitiveServices.UserOwnedStorage", "azure.mgmt.cognitiveservices.models.VersionedAgentReference": "Microsoft.CognitiveServices.VersionedAgentReference", "azure.mgmt.cognitiveservices.models.VirtualNetworkRule": "Microsoft.CognitiveServices.VirtualNetworkRule", + "azure.mgmt.cognitiveservices.models.Workbench": "Microsoft.CognitiveServices.Workbench", + "azure.mgmt.cognitiveservices.models.WorkbenchProperties": "Microsoft.CognitiveServices.WorkbenchProperties", "azure.mgmt.cognitiveservices.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", "azure.mgmt.cognitiveservices.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", "azure.mgmt.cognitiveservices.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", @@ -221,6 +242,7 @@ "azure.mgmt.cognitiveservices.models.QuotaScopeType": "Microsoft.CognitiveServices.QuotaScopeType", "azure.mgmt.cognitiveservices.models.DeprecationStatus": "Microsoft.CognitiveServices.DeprecationStatus", "azure.mgmt.cognitiveservices.models.ModelLifecycleStatus": "Microsoft.CognitiveServices.ModelLifecycleStatus", + "azure.mgmt.cognitiveservices.models.PolicyEvaluationOutcome": "Microsoft.CognitiveServices.PolicyEvaluationOutcome", "azure.mgmt.cognitiveservices.models.DeploymentProvisioningState": "Microsoft.CognitiveServices.DeploymentProvisioningState", "azure.mgmt.cognitiveservices.models.DeploymentScaleType": "Microsoft.CognitiveServices.DeploymentScaleType", "azure.mgmt.cognitiveservices.models.DeploymentModelVersionUpgradeOption": "Microsoft.CognitiveServices.DeploymentModelVersionUpgradeOption", @@ -253,6 +275,9 @@ "azure.mgmt.cognitiveservices.models.TrafficRoutingProtocol": "Microsoft.CognitiveServices.TrafficRoutingProtocol", "azure.mgmt.cognitiveservices.models.AgenticApplicationProvisioningState": "Microsoft.CognitiveServices.AgenticApplicationProvisioningState", "azure.mgmt.cognitiveservices.models.ComputeOperationStatusType": "Microsoft.CognitiveServices.ComputeOperationStatusType", + "azure.mgmt.cognitiveservices.models.ComputeType": "Microsoft.CognitiveServices.ComputeType", + "azure.mgmt.cognitiveservices.models.ComputeProvisioningState": "Microsoft.CognitiveServices.ComputeProvisioningState", + "azure.mgmt.cognitiveservices.models.VmPriority": "Microsoft.CognitiveServices.VmPriority", "azure.mgmt.cognitiveservices.models.CapabilityHostKind": "Microsoft.CognitiveServices.CapabilityHostKind", "azure.mgmt.cognitiveservices.models.RuleCategory": "Microsoft.CognitiveServices.RuleCategory", "azure.mgmt.cognitiveservices.models.RuleStatus": "Microsoft.CognitiveServices.RuleStatus", @@ -293,12 +318,14 @@ "azure.mgmt.cognitiveservices.aio.operations.AccountsOperations.list_usages": "Microsoft.CognitiveServices.Accounts.listUsages", "azure.mgmt.cognitiveservices.operations.AccountsOperations.list_models": "Microsoft.CognitiveServices.Accounts.listModels", "azure.mgmt.cognitiveservices.aio.operations.AccountsOperations.list_models": "Microsoft.CognitiveServices.Accounts.listModels", + "azure.mgmt.cognitiveservices.operations.AccountsOperations.evaluate_deployment_policies": "Microsoft.CognitiveServices.Accounts.evaluateDeploymentPolicies", + "azure.mgmt.cognitiveservices.aio.operations.AccountsOperations.evaluate_deployment_policies": "Microsoft.CognitiveServices.Accounts.evaluateDeploymentPolicies", + "azure.mgmt.cognitiveservices.operations.DeletedAccountsOperations.list": "Microsoft.CognitiveServices.DeletedAccounts.list", + "azure.mgmt.cognitiveservices.aio.operations.DeletedAccountsOperations.list": "Microsoft.CognitiveServices.DeletedAccounts.list", "azure.mgmt.cognitiveservices.operations.DeletedAccountsOperations.get": "Microsoft.CognitiveServices.DeletedAccounts.get", "azure.mgmt.cognitiveservices.aio.operations.DeletedAccountsOperations.get": "Microsoft.CognitiveServices.DeletedAccounts.get", "azure.mgmt.cognitiveservices.operations.DeletedAccountsOperations.begin_purge": "Microsoft.CognitiveServices.DeletedAccounts.purge", "azure.mgmt.cognitiveservices.aio.operations.DeletedAccountsOperations.begin_purge": "Microsoft.CognitiveServices.DeletedAccounts.purge", - "azure.mgmt.cognitiveservices.operations.DeletedAccountsOperations.list": "Microsoft.CognitiveServices.DeletedAccountsOperationGroup.list", - "azure.mgmt.cognitiveservices.aio.operations.DeletedAccountsOperations.list": "Microsoft.CognitiveServices.DeletedAccountsOperationGroup.list", "azure.mgmt.cognitiveservices.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.CognitiveServices.PrivateEndpointConnections.get", "azure.mgmt.cognitiveservices.aio.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.CognitiveServices.PrivateEndpointConnections.get", "azure.mgmt.cognitiveservices.operations.PrivateEndpointConnectionsOperations.begin_create_or_update": "Microsoft.CognitiveServices.PrivateEndpointConnections.createOrUpdate", @@ -477,8 +504,54 @@ "azure.mgmt.cognitiveservices.aio.operations.AgentApplicationsOperations.enable": "Microsoft.CognitiveServices.AgentApplications.enable", "azure.mgmt.cognitiveservices.operations.AgentApplicationsOperations.disable": "Microsoft.CognitiveServices.AgentApplications.disable", "azure.mgmt.cognitiveservices.aio.operations.AgentApplicationsOperations.disable": "Microsoft.CognitiveServices.AgentApplications.disable", + "azure.mgmt.cognitiveservices.operations.ManagedComputeDeploymentsOperations.get": "Microsoft.CognitiveServices.ManagedComputeDeployments.get", + "azure.mgmt.cognitiveservices.aio.operations.ManagedComputeDeploymentsOperations.get": "Microsoft.CognitiveServices.ManagedComputeDeployments.get", + "azure.mgmt.cognitiveservices.operations.ManagedComputeDeploymentsOperations.begin_create_or_update": "Microsoft.CognitiveServices.ManagedComputeDeployments.createOrUpdate", + "azure.mgmt.cognitiveservices.aio.operations.ManagedComputeDeploymentsOperations.begin_create_or_update": "Microsoft.CognitiveServices.ManagedComputeDeployments.createOrUpdate", + "azure.mgmt.cognitiveservices.operations.ManagedComputeDeploymentsOperations.begin_update": "Microsoft.CognitiveServices.ManagedComputeDeployments.update", + "azure.mgmt.cognitiveservices.aio.operations.ManagedComputeDeploymentsOperations.begin_update": "Microsoft.CognitiveServices.ManagedComputeDeployments.update", + "azure.mgmt.cognitiveservices.operations.ManagedComputeDeploymentsOperations.begin_delete": "Microsoft.CognitiveServices.ManagedComputeDeployments.delete", + "azure.mgmt.cognitiveservices.aio.operations.ManagedComputeDeploymentsOperations.begin_delete": "Microsoft.CognitiveServices.ManagedComputeDeployments.delete", + "azure.mgmt.cognitiveservices.operations.ManagedComputeDeploymentsOperations.list": "Microsoft.CognitiveServices.ManagedComputeDeployments.list", + "azure.mgmt.cognitiveservices.aio.operations.ManagedComputeDeploymentsOperations.list": "Microsoft.CognitiveServices.ManagedComputeDeployments.list", "azure.mgmt.cognitiveservices.operations.ComputeOperationsOperations.get": "Microsoft.CognitiveServices.ComputeOperations.get", "azure.mgmt.cognitiveservices.aio.operations.ComputeOperationsOperations.get": "Microsoft.CognitiveServices.ComputeOperations.get", + "azure.mgmt.cognitiveservices.operations.ManagedComputeUsagesOperationGroupOperations.list": "Microsoft.CognitiveServices.ManagedComputeUsagesOperationGroup.list", + "azure.mgmt.cognitiveservices.aio.operations.ManagedComputeUsagesOperationGroupOperations.list": "Microsoft.CognitiveServices.ManagedComputeUsagesOperationGroup.list", + "azure.mgmt.cognitiveservices.operations.ComputesOperations.get": "Microsoft.CognitiveServices.Computes.get", + "azure.mgmt.cognitiveservices.aio.operations.ComputesOperations.get": "Microsoft.CognitiveServices.Computes.get", + "azure.mgmt.cognitiveservices.operations.ComputesOperations.begin_create_or_update": "Microsoft.CognitiveServices.Computes.createOrUpdate", + "azure.mgmt.cognitiveservices.aio.operations.ComputesOperations.begin_create_or_update": "Microsoft.CognitiveServices.Computes.createOrUpdate", + "azure.mgmt.cognitiveservices.operations.ComputesOperations.begin_update": "Microsoft.CognitiveServices.Computes.update", + "azure.mgmt.cognitiveservices.aio.operations.ComputesOperations.begin_update": "Microsoft.CognitiveServices.Computes.update", + "azure.mgmt.cognitiveservices.operations.ComputesOperations.begin_delete": "Microsoft.CognitiveServices.Computes.delete", + "azure.mgmt.cognitiveservices.aio.operations.ComputesOperations.begin_delete": "Microsoft.CognitiveServices.Computes.delete", + "azure.mgmt.cognitiveservices.operations.ComputesOperations.list": "Microsoft.CognitiveServices.Computes.list", + "azure.mgmt.cognitiveservices.aio.operations.ComputesOperations.list": "Microsoft.CognitiveServices.Computes.list", + "azure.mgmt.cognitiveservices.operations.ComputesOperations.begin_start": "Microsoft.CognitiveServices.Computes.start", + "azure.mgmt.cognitiveservices.aio.operations.ComputesOperations.begin_start": "Microsoft.CognitiveServices.Computes.start", + "azure.mgmt.cognitiveservices.operations.ComputesOperations.begin_stop": "Microsoft.CognitiveServices.Computes.stop", + "azure.mgmt.cognitiveservices.aio.operations.ComputesOperations.begin_stop": "Microsoft.CognitiveServices.Computes.stop", + "azure.mgmt.cognitiveservices.operations.ComputesOperations.begin_restart": "Microsoft.CognitiveServices.Computes.restart", + "azure.mgmt.cognitiveservices.aio.operations.ComputesOperations.begin_restart": "Microsoft.CognitiveServices.Computes.restart", + "azure.mgmt.cognitiveservices.operations.WorkbenchesOperations.get": "Microsoft.CognitiveServices.Workbenches.get", + "azure.mgmt.cognitiveservices.aio.operations.WorkbenchesOperations.get": "Microsoft.CognitiveServices.Workbenches.get", + "azure.mgmt.cognitiveservices.operations.WorkbenchesOperations.begin_create_or_update": "Microsoft.CognitiveServices.Workbenches.createOrUpdate", + "azure.mgmt.cognitiveservices.aio.operations.WorkbenchesOperations.begin_create_or_update": "Microsoft.CognitiveServices.Workbenches.createOrUpdate", + "azure.mgmt.cognitiveservices.operations.WorkbenchesOperations.begin_update": "Microsoft.CognitiveServices.Workbenches.update", + "azure.mgmt.cognitiveservices.aio.operations.WorkbenchesOperations.begin_update": "Microsoft.CognitiveServices.Workbenches.update", + "azure.mgmt.cognitiveservices.operations.WorkbenchesOperations.begin_delete": "Microsoft.CognitiveServices.Workbenches.delete", + "azure.mgmt.cognitiveservices.aio.operations.WorkbenchesOperations.begin_delete": "Microsoft.CognitiveServices.Workbenches.delete", + "azure.mgmt.cognitiveservices.operations.WorkbenchesOperations.list": "Microsoft.CognitiveServices.Workbenches.list", + "azure.mgmt.cognitiveservices.aio.operations.WorkbenchesOperations.list": "Microsoft.CognitiveServices.Workbenches.list", + "azure.mgmt.cognitiveservices.operations.WorkbenchesOperations.begin_start": "Microsoft.CognitiveServices.Workbenches.start", + "azure.mgmt.cognitiveservices.aio.operations.WorkbenchesOperations.begin_start": "Microsoft.CognitiveServices.Workbenches.start", + "azure.mgmt.cognitiveservices.operations.WorkbenchesOperations.begin_stop": "Microsoft.CognitiveServices.Workbenches.stop", + "azure.mgmt.cognitiveservices.aio.operations.WorkbenchesOperations.begin_stop": "Microsoft.CognitiveServices.Workbenches.stop", + "azure.mgmt.cognitiveservices.operations.WorkbenchesOperations.begin_restart": "Microsoft.CognitiveServices.Workbenches.restart", + "azure.mgmt.cognitiveservices.aio.operations.WorkbenchesOperations.begin_restart": "Microsoft.CognitiveServices.Workbenches.restart", + "azure.mgmt.cognitiveservices.operations.ManagedComputeCapacitiesOperations.list": "Microsoft.CognitiveServices.ManagedComputeCapacities.list", + "azure.mgmt.cognitiveservices.aio.operations.ManagedComputeCapacitiesOperations.list": "Microsoft.CognitiveServices.ManagedComputeCapacities.list", "azure.mgmt.cognitiveservices.operations.PrivateLinkResourcesOperations.list": "Microsoft.CognitiveServices.Accounts.privateLinkResourcesList", "azure.mgmt.cognitiveservices.aio.operations.PrivateLinkResourcesOperations.list": "Microsoft.CognitiveServices.Accounts.privateLinkResourcesList", "azure.mgmt.cognitiveservices.operations.TestRaiExternalSafetyProviderOperations.create_or_update": "Microsoft.CognitiveServices.Accounts.createOrUpdate", @@ -561,5 +634,6 @@ "azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient.check_domain_availability": "Microsoft.CognitiveServices.checkDomainAvailability", "azure.mgmt.cognitiveservices.CognitiveServicesManagementClient.calculate_model_capacity": "Microsoft.CognitiveServices.calculateModelCapacity", "azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient.calculate_model_capacity": "Microsoft.CognitiveServices.calculateModelCapacity" - } + }, + "CrossLanguageVersion": "63628aaa781f" } \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_client.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_client.py index 697680d177d3..3a1560fccac9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_client.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -28,11 +28,15 @@ CommitmentPlansOperations, CommitmentTiersOperations, ComputeOperationsOperations, + ComputesOperations, DefenderForAISettingsOperations, DeletedAccountsOperations, DeploymentsOperations, EncryptionScopesOperations, LocationBasedModelCapacitiesOperations, + ManagedComputeCapacitiesOperations, + ManagedComputeDeploymentsOperations, + ManagedComputeUsagesOperationGroupOperations, ManagedNetworkProvisionsOperations, ManagedNetworkSettingsOperations, ModelCapacitiesOperations, @@ -59,9 +63,15 @@ SubscriptionRaiPolicyOperations, TestRaiExternalSafetyProviderOperations, UsagesOperations, + WorkbenchesOperations, _CognitiveServicesManagementClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential @@ -124,9 +134,23 @@ class CognitiveServicesManagementClient( :ivar agent_applications: AgentApplicationsOperations operations :vartype agent_applications: azure.mgmt.cognitiveservices.operations.AgentApplicationsOperations + :ivar managed_compute_deployments: ManagedComputeDeploymentsOperations operations + :vartype managed_compute_deployments: + azure.mgmt.cognitiveservices.operations.ManagedComputeDeploymentsOperations :ivar compute_operations: ComputeOperationsOperations operations :vartype compute_operations: azure.mgmt.cognitiveservices.operations.ComputeOperationsOperations + :ivar managed_compute_usages_operation_group: ManagedComputeUsagesOperationGroupOperations + operations + :vartype managed_compute_usages_operation_group: + azure.mgmt.cognitiveservices.operations.ManagedComputeUsagesOperationGroupOperations + :ivar computes: ComputesOperations operations + :vartype computes: azure.mgmt.cognitiveservices.operations.ComputesOperations + :ivar workbenches: WorkbenchesOperations operations + :vartype workbenches: azure.mgmt.cognitiveservices.operations.WorkbenchesOperations + :ivar managed_compute_capacities: ManagedComputeCapacitiesOperations operations + :vartype managed_compute_capacities: + azure.mgmt.cognitiveservices.operations.ManagedComputeCapacitiesOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.cognitiveservices.operations.PrivateLinkResourcesOperations @@ -180,8 +204,9 @@ class CognitiveServicesManagementClient( None. :paramtype cloud_setting: ~azure.core.AzureClouds :keyword api_version: The API version to use for this operation. Known values are - "2026-01-15-preview". Default value is "2026-01-15-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-03-15-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -279,9 +304,20 @@ def __init__( self.agent_applications = AgentApplicationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.managed_compute_deployments = ManagedComputeDeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.compute_operations = ComputeOperationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.managed_compute_usages_operation_group = ManagedComputeUsagesOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.computes = ComputesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workbenches = WorkbenchesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_compute_capacities = ManagedComputeCapacitiesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py index 34b853ba58fb..13fd081a0301 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py @@ -34,8 +34,9 @@ class CognitiveServicesManagementClientConfiguration: # pylint: disable=too-man None. :type cloud_setting: ~azure.core.AzureClouds :keyword api_version: The API version to use for this operation. Known values are - "2026-01-15-preview". Default value is "2026-01-15-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-03-15-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -47,7 +48,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2026-01-15-preview") + api_version: str = kwargs.pop("api_version", "2026-03-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_patch.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_patch.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/model_base.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/model_base.py index a75a22adbb97..bd5b9caf1022 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/model_base.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -585,6 +590,239 @@ def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typin return _serialize(value, rf._format) +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param class Model(_MyMutableMapping): _is_model = True # label whether current class's _attr_to_rest_field has been calculated @@ -595,62 +833,10 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } - if args: # pylint: disable=too-many-nested-blocks + dict_to_pass: dict[str, typing.Any] = {} + if args: if isinstance(args[0], ET.Element): - existed_attr_keys = [] - model_meta = getattr(self, "_xml", {}) - - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - if prop_meta.get("itemsName"): - xml_name = prop_meta.get("itemsName") - xml_ns = prop_meta.get("itemNs") - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = args[0].findall(xml_name) # pyright: ignore - if len(items) > 0: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if args[0].text is not None: - dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = args[0].find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) - - # rest thing is additional properties - for e in args[0]: - if e.tag not in existed_attr_keys: - dict_to_pass[e.tag] = _convert_element(e) + dict_to_pass.update(self._init_from_xml(args[0])) else: dict_to_pass.update( {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} @@ -667,8 +853,117 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: if v is not None } ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) super().__init__(dict_to_pass) + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: + """Deserialize an XML element into a dict mapping rest field names to values. + + :param ET.Element element: The XML element to deserialize from. + :returns: A dictionary of rest_name to deserialized value pairs. + :rtype: dict + """ + result: dict[str, typing.Any] = {} + existed_attr_keys: list[str] = [] + + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + model_meta = getattr(self, "_xml", {}) + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in element: + if e.tag not in existed_attr_keys: + result[e.tag] = _convert_element(e) + + return result + def copy(self) -> "Model": return Model(self.__dict__) @@ -697,6 +992,9 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: Model._get_backcompat_attribute_name(cls._attr_to_rest_field, attr): rf for attr, rf in cls._attr_to_rest_field.items() } + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") return super().__new__(cls) @@ -735,7 +1033,7 @@ def _deserialize(cls, data, exist_discriminators): model_meta = getattr(cls, "_xml", {}) prop_meta = getattr(discriminator, "_xml", {}) xml_name = prop_meta.get("name", discriminator._rest_name) - xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) if xml_ns: xml_name = "{" + xml_ns + "}" + xml_name @@ -1081,6 +1379,7 @@ def __init__( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, original_tsp_name: typing.Optional[str] = None, ): self._type = type @@ -1094,6 +1393,7 @@ def __init__( self._format = format self._is_multipart_file_input = is_multipart_file_input self._xml = xml if xml is not None else {} + self._deserializer = deserializer self._original_tsp_name = original_tsp_name @property @@ -1114,7 +1414,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: @@ -1127,7 +1430,11 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # Return the value from _data directly (it's been deserialized in place) return obj._data.get(self._rest_name) - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) # For mutable types, store the deserialized value back in _data # so mutations directly affect _data @@ -1173,6 +1480,7 @@ def rest_field( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, original_tsp_name: typing.Optional[str] = None, ) -> typing.Any: return _RestField( @@ -1183,6 +1491,7 @@ def rest_field( format=format, is_multipart_file_input=is_multipart_file_input, xml=xml, + deserializer=deserializer, original_tsp_name=original_tsp_name, ) @@ -1208,6 +1517,56 @@ def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore +def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: + """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. + + :param dict meta: The metadata dictionary to extract namespace from. + :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. + :rtype: str or None + """ + ns = meta.get("ns") + if ns is None: + ns = meta.get("namespace") + return ns + + +def _resolve_xml_ns( + prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None +) -> typing.Optional[str]: + """Resolve XML namespace for a property, falling back to model namespace when appropriate. + + Checks the property metadata first; if no namespace is found and the model does not declare + an explicit prefix, falls back to the model-level namespace. + + :param dict prop_meta: The property metadata dictionary. + :param dict model_meta: The model metadata dictionary, used as fallback. + :returns: The resolved namespace string, or None. + :rtype: str or None + """ + ns = _get_xml_ns(prop_meta) + if ns is None and model_meta is not None and not model_meta.get("prefix"): + ns = _get_xml_ns(model_meta) + return ns + + +def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: + """Set an XML attribute on an element, handling namespace prefix registration. + + :param ET.Element element: The element to set the attribute on. + :param str name: The default attribute name (wire name). + :param any value: The attribute value. + :param dict prop_meta: The property metadata dictionary. + """ + xml_name = prop_meta.get("name", name) + _attr_ns = _get_xml_ns(prop_meta) + if _attr_ns: + _attr_prefix = prop_meta.get("prefix") + if _attr_prefix: + _safe_register_namespace(_attr_prefix, _attr_ns) + xml_name = "{" + _attr_ns + "}" + xml_name + element.set(xml_name, _get_primitive_type_value(value)) + + def _get_element( o: typing.Any, exclude_readonly: bool = False, @@ -1219,10 +1578,16 @@ def _get_element( # if prop is a model, then use the prop element directly, else generate a wrapper of model if wrapped_element is None: + # When serializing as an array item (parent_meta is set), check if the parent has an + # explicit itemsName. This ensures correct element names for unwrapped arrays (where + # the element tag is the property/items name, not the model type name). + _items_name = parent_meta.get("itemsName") if parent_meta is not None else None + element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) + _model_ns = _get_xml_ns(model_meta) wrapped_element = _create_xml_element( - model_meta.get("name", o.__class__.__name__), + element_name, model_meta.get("prefix"), - model_meta.get("ns"), + _model_ns, ) readonly_props = [] @@ -1244,7 +1609,9 @@ def _get_element( # additional properties will not have rest field, use the wire name as xml name prop_meta = {"name": k} - # if no ns for prop, use model's + # Propagate model namespace to properties only for old-style "ns"-keyed models. + # DPG-generated models use the "namespace" key and explicitly declare namespace on + # each property that needs it, so propagation is intentionally skipped for them. if prop_meta.get("ns") is None and model_meta.get("ns"): prop_meta["ns"] = model_meta.get("ns") prop_meta["prefix"] = model_meta.get("prefix") @@ -1256,12 +1623,7 @@ def _get_element( # text could only set on primitive type wrapped_element.text = _get_primitive_type_value(v) elif prop_meta.get("attribute", False): - xml_name = prop_meta.get("name", k) - if prop_meta.get("ns"): - ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore - xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore - # attribute should be primitive type - wrapped_element.set(xml_name, _get_primitive_type_value(v)) + _set_xml_attribute(wrapped_element, k, v, prop_meta) else: # other wrapped prop element wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) @@ -1270,6 +1632,7 @@ def _get_element( return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore if isinstance(o, dict): result = [] + _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None for k, v in o.items(): result.append( _get_wrapped_element( @@ -1277,7 +1640,7 @@ def _get_element( exclude_readonly, { "name": k, - "ns": parent_meta.get("ns") if parent_meta else None, + "ns": _dict_ns, "prefix": parent_meta.get("prefix") if parent_meta else None, }, ) @@ -1286,13 +1649,16 @@ def _get_element( # primitive case need to create element based on parent_meta if parent_meta: + _items_ns = parent_meta.get("itemsNs") + if _items_ns is None: + _items_ns = _get_xml_ns(parent_meta) return _get_wrapped_element( o, exclude_readonly, { "name": parent_meta.get("itemsName", parent_meta.get("name")), "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), - "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + "ns": _items_ns, }, ) @@ -1304,8 +1670,9 @@ def _get_wrapped_element( exclude_readonly: bool, meta: typing.Optional[dict[str, typing.Any]], ) -> ET.Element: + _meta_ns = _get_xml_ns(meta) if meta else None wrapped_element = _create_xml_element( - meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns ) if isinstance(v, (dict, list)): wrapped_element.extend(_get_element(v, exclude_readonly, meta)) @@ -1326,11 +1693,29 @@ def _get_primitive_type_value(v) -> str: return str(v) +def _safe_register_namespace(prefix: str, ns: str) -> None: + """Register an XML namespace prefix, handling reserved prefix patterns. + + Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for + auto-generated prefixes, causing register_namespace to raise ValueError. + Falls back to directly registering in the internal namespace map. + + :param str prefix: The namespace prefix to register. + :param str ns: The namespace URI. + """ + try: + ET.register_namespace(prefix, ns) + except ValueError: + _ns_map = getattr(ET, "_namespace_map", None) + if _ns_map is not None: + _ns_map[ns] = prefix + + def _create_xml_element( tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None ) -> ET.Element: if prefix and ns: - ET.register_namespace(prefix, ns) + _safe_register_namespace(prefix, ns) if ns: return ET.Element("{" + ns + "}" + tag) return ET.Element(tag) @@ -1341,6 +1726,8 @@ def _deserialize_xml( value: str, ) -> typing.Any: element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) return _deserialize(deserializer, element) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/serialization.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/serialization.py index 81ec1de5922b..a088671e9c51 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/serialization.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] @@ -1401,7 +1405,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. @@ -1411,6 +1415,27 @@ def __call__(self, target_obj, response_data, content_type=None): :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py index f5ed26eeaf5d..0068a9979d9d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "15.0.0b1" +VERSION = "15.0.0b2" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_client.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_client.py index a7302bf48a58..cca5a5ac521f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_client.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -28,11 +28,15 @@ CommitmentPlansOperations, CommitmentTiersOperations, ComputeOperationsOperations, + ComputesOperations, DefenderForAISettingsOperations, DeletedAccountsOperations, DeploymentsOperations, EncryptionScopesOperations, LocationBasedModelCapacitiesOperations, + ManagedComputeCapacitiesOperations, + ManagedComputeDeploymentsOperations, + ManagedComputeUsagesOperationGroupOperations, ManagedNetworkProvisionsOperations, ManagedNetworkSettingsOperations, ModelCapacitiesOperations, @@ -59,9 +63,15 @@ SubscriptionRaiPolicyOperations, TestRaiExternalSafetyProviderOperations, UsagesOperations, + WorkbenchesOperations, _CognitiveServicesManagementClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential @@ -127,9 +137,23 @@ class CognitiveServicesManagementClient( :ivar agent_applications: AgentApplicationsOperations operations :vartype agent_applications: azure.mgmt.cognitiveservices.aio.operations.AgentApplicationsOperations + :ivar managed_compute_deployments: ManagedComputeDeploymentsOperations operations + :vartype managed_compute_deployments: + azure.mgmt.cognitiveservices.aio.operations.ManagedComputeDeploymentsOperations :ivar compute_operations: ComputeOperationsOperations operations :vartype compute_operations: azure.mgmt.cognitiveservices.aio.operations.ComputeOperationsOperations + :ivar managed_compute_usages_operation_group: ManagedComputeUsagesOperationGroupOperations + operations + :vartype managed_compute_usages_operation_group: + azure.mgmt.cognitiveservices.aio.operations.ManagedComputeUsagesOperationGroupOperations + :ivar computes: ComputesOperations operations + :vartype computes: azure.mgmt.cognitiveservices.aio.operations.ComputesOperations + :ivar workbenches: WorkbenchesOperations operations + :vartype workbenches: azure.mgmt.cognitiveservices.aio.operations.WorkbenchesOperations + :ivar managed_compute_capacities: ManagedComputeCapacitiesOperations operations + :vartype managed_compute_capacities: + azure.mgmt.cognitiveservices.aio.operations.ManagedComputeCapacitiesOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.cognitiveservices.aio.operations.PrivateLinkResourcesOperations @@ -186,8 +210,9 @@ class CognitiveServicesManagementClient( None. :paramtype cloud_setting: ~azure.core.AzureClouds :keyword api_version: The API version to use for this operation. Known values are - "2026-01-15-preview". Default value is "2026-01-15-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-03-15-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -287,9 +312,20 @@ def __init__( self.agent_applications = AgentApplicationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.managed_compute_deployments = ManagedComputeDeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.compute_operations = ComputeOperationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.managed_compute_usages_operation_group = ManagedComputeUsagesOperationGroupOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.computes = ComputesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workbenches = WorkbenchesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_compute_capacities = ManagedComputeCapacitiesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py index 408769991db9..486027f30e51 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py @@ -34,8 +34,9 @@ class CognitiveServicesManagementClientConfiguration: # pylint: disable=too-man None. :type cloud_setting: ~azure.core.AzureClouds :keyword api_version: The API version to use for this operation. Known values are - "2026-01-15-preview". Default value is "2026-01-15-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-03-15-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -47,7 +48,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2026-01-15-preview") + api_version: str = kwargs.pop("api_version", "2026-03-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_patch.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_patch.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py index 7610047333eb..27f40ab3440c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py @@ -34,7 +34,12 @@ from ._operations import ProjectCapabilityHostsOperations # type: ignore from ._operations import QuotaTiersOperations # type: ignore from ._operations import AgentApplicationsOperations # type: ignore +from ._operations import ManagedComputeDeploymentsOperations # type: ignore from ._operations import ComputeOperationsOperations # type: ignore +from ._operations import ManagedComputeUsagesOperationGroupOperations # type: ignore +from ._operations import ComputesOperations # type: ignore +from ._operations import WorkbenchesOperations # type: ignore +from ._operations import ManagedComputeCapacitiesOperations # type: ignore from ._operations import PrivateLinkResourcesOperations # type: ignore from ._operations import TestRaiExternalSafetyProviderOperations # type: ignore from ._operations import RaiExternalSafetyProviderOperations # type: ignore @@ -80,7 +85,12 @@ "ProjectCapabilityHostsOperations", "QuotaTiersOperations", "AgentApplicationsOperations", + "ManagedComputeDeploymentsOperations", "ComputeOperationsOperations", + "ManagedComputeUsagesOperationGroupOperations", + "ComputesOperations", + "WorkbenchesOperations", + "ManagedComputeCapacitiesOperations", "PrivateLinkResourcesOperations", "TestRaiExternalSafetyProviderOperations", "RaiExternalSafetyProviderOperations", diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_operations.py index 1636aafb2744..8e8aafb9aebd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_operations.py @@ -50,6 +50,7 @@ build_account_connections_update_request, build_accounts_create_request, build_accounts_delete_request, + build_accounts_evaluate_deployment_policies_request, build_accounts_get_request, build_accounts_list_by_resource_group_request, build_accounts_list_keys_request, @@ -91,6 +92,14 @@ build_commitment_plans_update_plan_request, build_commitment_tiers_list_request, build_compute_operations_get_request, + build_computes_create_or_update_request, + build_computes_delete_request, + build_computes_get_request, + build_computes_list_request, + build_computes_restart_request, + build_computes_start_request, + build_computes_stop_request, + build_computes_update_request, build_defender_for_ai_settings_create_or_update_request, build_defender_for_ai_settings_get_request, build_defender_for_ai_settings_list_request, @@ -111,6 +120,13 @@ build_encryption_scopes_get_request, build_encryption_scopes_list_request, build_location_based_model_capacities_list_request, + build_managed_compute_capacities_list_request, + build_managed_compute_deployments_create_or_update_request, + build_managed_compute_deployments_delete_request, + build_managed_compute_deployments_get_request, + build_managed_compute_deployments_list_request, + build_managed_compute_deployments_update_request, + build_managed_compute_usages_operation_group_list_request, build_managed_network_provisions_provision_managed_network_request, build_managed_network_settings_delete_request, build_managed_network_settings_get_request, @@ -185,6 +201,14 @@ build_subscription_rai_policy_get_request, build_test_rai_external_safety_provider_create_or_update_request, build_usages_list_request, + build_workbenches_create_or_update_request, + build_workbenches_delete_request, + build_workbenches_get_request, + build_workbenches_list_request, + build_workbenches_restart_request, + build_workbenches_start_request, + build_workbenches_stop_request, + build_workbenches_update_request, ) from .._configuration import CognitiveServicesManagementClientConfiguration @@ -260,7 +284,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1035,7 +1062,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1125,7 +1155,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1615,7 +1648,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1657,6 +1693,195 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + @overload + async def evaluate_deployment_policies( + self, + resource_group_name: str, + account_name: str, + body: _models.EvaluateDeploymentPoliciesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluateDeploymentPoliciesResponse: + """Evaluate Azure Policy compliance for a set of hypothetical deployments without creating them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluateDeploymentPoliciesResponse. The EvaluateDeploymentPoliciesResponse is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def evaluate_deployment_policies( + self, + resource_group_name: str, + account_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluateDeploymentPoliciesResponse: + """Evaluate Azure Policy compliance for a set of hypothetical deployments without creating them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param body: The content of the action request. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluateDeploymentPoliciesResponse. The EvaluateDeploymentPoliciesResponse is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def evaluate_deployment_policies( + self, + resource_group_name: str, + account_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluateDeploymentPoliciesResponse: + """Evaluate Azure Policy compliance for a set of hypothetical deployments without creating them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluateDeploymentPoliciesResponse. The EvaluateDeploymentPoliciesResponse is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def evaluate_deployment_policies( + self, + resource_group_name: str, + account_name: str, + body: Union[_models.EvaluateDeploymentPoliciesRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.EvaluateDeploymentPoliciesResponse: + """Evaluate Azure Policy compliance for a set of hypothetical deployments without creating them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param body: The content of the action request. Is one of the following types: + EvaluateDeploymentPoliciesRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesRequest or JSON or + IO[bytes] + :return: EvaluateDeploymentPoliciesResponse. The EvaluateDeploymentPoliciesResponse is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluateDeploymentPoliciesResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_accounts_evaluate_deployment_policies_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluateDeploymentPoliciesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + class DeletedAccountsOperations: """ @@ -1677,6 +1902,99 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Account"]: + """Returns all the resources of a particular type belonging to a subscription. + + :return: An iterator like instance of Account + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Account]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deleted_accounts_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Account], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + @distributed_trace_async async def get(self, location: str, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.Account: """Returns a Cognitive Services account specified by the parameters. @@ -1874,96 +2192,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Account"]: - """Returns all the resources of a particular type belonging to a subscription. - - :return: An iterator like instance of Account - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.Account] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Account]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_deleted_accounts_list_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Account], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - class PrivateEndpointConnectionsOperations: """ @@ -3308,7 +3536,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -3412,7 +3643,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -4081,7 +4315,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -4851,7 +5088,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -4942,7 +5182,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -5511,7 +5754,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -6020,7 +6266,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -6525,7 +6774,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -7418,7 +7670,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -8259,7 +8514,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -8764,7 +9022,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9266,7 +9527,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9449,7 +9713,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9645,7 +9912,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9789,14 +10059,10 @@ async def begin_reconcile( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -10343,7 +10609,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -11022,7 +11291,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [202, 204]: + if response.status_code not in [200, 202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -11163,7 +11432,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -11883,7 +12155,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -12507,7 +12782,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -12984,7 +13262,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -13634,7 +13915,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -13892,14 +14176,4037 @@ async def disable( return cls(pipeline_response, None, {}) # type: ignore -class ComputeOperationsOperations: +class ManagedComputeDeploymentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`managed_compute_deployments` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def get( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> _models.ManagedComputeDeployment: + """Gets the specified managed compute deployment associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :return: ManagedComputeDeployment. The ManagedComputeDeployment is compatible with + MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ManagedComputeDeployment] = kwargs.pop("cls", None) + + _request = build_managed_compute_deployments_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ManagedComputeDeployment, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + resource: Union[_models.ManagedComputeDeployment, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_managed_compute_deployments_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + resource: _models.ManagedComputeDeployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedComputeDeployment]: + """Creates or updates a managed compute deployment associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param resource: The managed compute deployment properties. Required. + :type resource: ~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedComputeDeployment]: + """Creates or updates a managed compute deployment associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param resource: The managed compute deployment properties. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedComputeDeployment]: + """Creates or updates a managed compute deployment associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param resource: The managed compute deployment properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + resource: Union[_models.ManagedComputeDeployment, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedComputeDeployment]: + """Creates or updates a managed compute deployment associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param resource: The managed compute deployment properties. Is one of the following types: + ManagedComputeDeployment, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedComputeDeployment] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ManagedComputeDeployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ManagedComputeDeployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ManagedComputeDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + properties: Union[_models.PatchResourceSku, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_managed_compute_deployments_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + properties: _models.PatchResourceSku, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedComputeDeployment]: + """Updates the specified managed compute deployment associated with the Cognitive Services + account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param properties: The managed compute deployment patch properties. Required. + :type properties: ~azure.mgmt.cognitiveservices.models.PatchResourceSku + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedComputeDeployment]: + """Updates the specified managed compute deployment associated with the Cognitive Services + account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param properties: The managed compute deployment patch properties. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedComputeDeployment]: + """Updates the specified managed compute deployment associated with the Cognitive Services + account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param properties: The managed compute deployment patch properties. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + properties: Union[_models.PatchResourceSku, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedComputeDeployment]: + """Updates the specified managed compute deployment associated with the Cognitive Services + account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param properties: The managed compute deployment patch properties. Is one of the following + types: PatchResourceSku, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.cognitiveservices.models.PatchResourceSku or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedComputeDeployment] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ManagedComputeDeployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ManagedComputeDeployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ManagedComputeDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _delete_initial( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_managed_compute_deployments_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_delete( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified managed compute deployment associated with the Cognitive Services + account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-03-15-preview"], + ) + def list( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ManagedComputeDeployment"]: + """Gets the managed compute deployments associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An iterator like instance of ManagedComputeDeployment + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedComputeDeployment]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_compute_deployments_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ManagedComputeDeployment], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ComputeOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`compute_operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-01-15-preview", + params_added_on={ + "2026-01-15-preview": ["api_version", "subscription_id", "location", "operation_id", "accept"] + }, + api_versions_list=["2026-01-15-preview", "2026-03-15-preview"], + ) + async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.ComputeOperationStatus: + """Gets the status of a compute operation. + + :param location: The name of the Azure region. Required. + :type location: str + :param operation_id: The ID of the compute operation. Required. + :type operation_id: str + :return: ComputeOperationStatus. The ComputeOperationStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ComputeOperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ComputeOperationStatus] = kwargs.pop("cls", None) + + _request = build_compute_operations_get_request( + location=location, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ComputeOperationStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ManagedComputeUsagesOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`managed_compute_usages_operation_group` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={"2026-03-15-preview": ["api_version", "subscription_id", "location", "accept"]}, + api_versions_list=["2026-03-15-preview"], + ) + def list(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.ManagedComputeUsage"]: + """List managed compute quota usages for a subscription and location. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of ManagedComputeUsage + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.ManagedComputeUsage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedComputeUsage]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_compute_usages_operation_group_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ManagedComputeUsage], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ComputesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`computes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def get( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> _models.Compute: + """Gets the specified compute associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :return: Compute. The Compute is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.Compute + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Compute] = kwargs.pop("cls", None) + + _request = build_computes_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Compute, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + resource: Union[_models.Compute, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_computes_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + resource: _models.Compute, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Compute]: + """Creates or updates a compute associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param resource: The compute properties. Required. + :type resource: ~azure.mgmt.cognitiveservices.models.Compute + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Compute] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Compute]: + """Creates or updates a compute associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param resource: The compute properties. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Compute] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Compute]: + """Creates or updates a compute associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param resource: The compute properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Compute] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + resource: Union[_models.Compute, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Compute]: + """Creates or updates a compute associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param resource: The compute properties. Is one of the following types: Compute, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.cognitiveservices.models.Compute or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Compute] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Compute] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Compute, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Compute].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Compute]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + properties: Union[_models.Compute, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_computes_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + properties: _models.Compute, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Compute]: + """Updates a compute associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param properties: The compute properties to update. Required. + :type properties: ~azure.mgmt.cognitiveservices.models.Compute + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Compute] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Compute]: + """Updates a compute associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param properties: The compute properties to update. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Compute] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Compute]: + """Updates a compute associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param properties: The compute properties to update. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Compute] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_update( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + properties: Union[_models.Compute, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Compute]: + """Updates a compute associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param properties: The compute properties to update. Is one of the following types: Compute, + JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.cognitiveservices.models.Compute or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Compute] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Compute] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Compute, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Compute].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Compute]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _delete_initial( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_computes_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_delete( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified compute associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-03-15-preview"], + ) + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Compute"]: + """Gets the computes associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An iterator like instance of Compute + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.Compute] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Compute]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_computes_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Compute], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _start_initial( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_computes_start_request( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_start( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts a stopped ContainerInstance compute resource. This is a long-running operation that + returns 202 Accepted. Only applicable when computeType is ContainerInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _stop_initial( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_computes_stop_request( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_stop( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stops a running ContainerInstance compute resource. This is a long-running operation that + returns 202 Accepted. Only applicable when computeType is ContainerInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _restart_initial( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_computes_restart_request( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_restart( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts a running ContainerInstance compute resource. This is a long-running operation that + returns 202 Accepted. Only applicable when computeType is ContainerInstance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class WorkbenchesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`workbenches` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def get( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> _models.Workbench: + """Gets the specified workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :return: Workbench. The Workbench is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.Workbench + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Workbench] = kwargs.pop("cls", None) + + _request = build_workbenches_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workbench, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + resource: Union[_models.Workbench, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_workbenches_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + resource: _models.Workbench, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Workbench]: + """Creates or updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param resource: The workbench properties. Required. + :type resource: ~azure.mgmt.cognitiveservices.models.Workbench + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Workbench]: + """Creates or updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param resource: The workbench properties. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Workbench]: + """Creates or updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param resource: The workbench properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + resource: Union[_models.Workbench, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Workbench]: + """Creates or updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param resource: The workbench properties. Is one of the following types: Workbench, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.cognitiveservices.models.Workbench or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbench] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Workbench, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Workbench].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Workbench]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + properties: Union[_models.Workbench, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_workbenches_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + properties: _models.Workbench, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Workbench]: + """Updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param properties: The workbench properties to update. Required. + :type properties: ~azure.mgmt.cognitiveservices.models.Workbench + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Workbench]: + """Updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param properties: The workbench properties to update. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Workbench]: + """Updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param properties: The workbench properties to update. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + properties: Union[_models.Workbench, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Workbench]: + """Updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param properties: The workbench properties to update. Is one of the following types: + Workbench, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.cognitiveservices.models.Workbench or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbench] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + properties=properties, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Workbench, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Workbench].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Workbench]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _delete_initial( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_workbenches_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_delete( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def list( + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Workbench"]: + """Gets the workbenches associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :return: An iterator like instance of Workbench + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Workbench]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_workbenches_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Workbench], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _start_initial( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_workbenches_start_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_start( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _stop_initial( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_workbenches_stop_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_stop( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def _restart_initial( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_workbenches_restart_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + async def begin_restart( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ManagedComputeCapacitiesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s - :attr:`compute_operations` attribute. + :attr:`managed_compute_capacities` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -13911,25 +18218,46 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async + @distributed_trace @api_version_validation( - method_added_on="2026-01-15-preview", + method_added_on="2026-03-15-preview", params_added_on={ - "2026-01-15-preview": ["api_version", "subscription_id", "location", "operation_id", "accept"] + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "offer", + "accelerator_type", + "deployment_id", + "accept", + ] }, - api_versions_list=["2026-01-15-preview"], + api_versions_list=["2026-03-15-preview"], ) - async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.ComputeOperationStatus: - """Gets the status of a compute operation. - - :param location: The name of the Azure region. Required. - :type location: str - :param operation_id: The ID of the compute operation. Required. - :type operation_id: str - :return: ComputeOperationStatus. The ComputeOperationStatus is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ComputeOperationStatus + def list( + self, *, offer: str, accelerator_type: Optional[str] = None, deployment_id: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.ManagedComputeCapacity"]: + """Gets the managed compute capacities for a subscription. Returns available capacity per + accelerator type, including deployment size information. + + :keyword offer: The offer name to query capacity for (required). Required. + :paramtype offer: str + :keyword accelerator_type: Optional accelerator type filter to narrow results to a specific + accelerator type. Default value is None. + :paramtype accelerator_type: str + :keyword deployment_id: Optional deployment resource ID. When provided, returns capacity for + the specific region + where the deployment is hosted rather than the best available region. Default value is None. + :paramtype deployment_id: str + :return: An iterator like instance of ManagedComputeCapacity + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.ManagedComputeCapacity] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedComputeCapacity]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13938,54 +18266,80 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.ComputeOperationStatus] = kwargs.pop("cls", None) + _request = build_managed_compute_capacities_list_request( + subscription_id=self._config.subscription_id, + offer=offer, + accelerator_type=accelerator_type, + deployment_id=deployment_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_compute_operations_get_request( - location=location, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ManagedComputeCapacity], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ComputeOperationStatus, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) class PrivateLinkResourcesOperations: @@ -14388,7 +18742,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[_models.RaiExternalSafetyProviderSchema, _models.RaiExternalSafetyProvider]: + ) -> _models.RaiExternalSafetyProviderSchema: """Create the rai safety provider associated with the subscription. :param safety_provider_name: The name of the Rai External Safety Provider associated with the @@ -14399,17 +18753,16 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiExternalSafetyProviderSchema or RaiExternalSafetyProvider. The - RaiExternalSafetyProviderSchema is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema or - ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProvider + :return: RaiExternalSafetyProviderSchema. The RaiExternalSafetyProviderSchema is compatible + with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def create_or_update( self, safety_provider_name: str, safety_provider: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> Union[_models.RaiExternalSafetyProviderSchema, _models.RaiExternalSafetyProvider]: + ) -> _models.RaiExternalSafetyProviderSchema: """Create the rai safety provider associated with the subscription. :param safety_provider_name: The name of the Rai External Safety Provider associated with the @@ -14420,10 +18773,9 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiExternalSafetyProviderSchema or RaiExternalSafetyProvider. The - RaiExternalSafetyProviderSchema is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema or - ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProvider + :return: RaiExternalSafetyProviderSchema. The RaiExternalSafetyProviderSchema is compatible + with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema :raises ~azure.core.exceptions.HttpResponseError: """ @@ -14435,7 +18787,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[_models.RaiExternalSafetyProviderSchema, _models.RaiExternalSafetyProvider]: + ) -> _models.RaiExternalSafetyProviderSchema: """Create the rai safety provider associated with the subscription. :param safety_provider_name: The name of the Rai External Safety Provider associated with the @@ -14446,10 +18798,9 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RaiExternalSafetyProviderSchema or RaiExternalSafetyProvider. The - RaiExternalSafetyProviderSchema is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema or - ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProvider + :return: RaiExternalSafetyProviderSchema. The RaiExternalSafetyProviderSchema is compatible + with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema :raises ~azure.core.exceptions.HttpResponseError: """ @@ -14459,7 +18810,7 @@ async def create_or_update( safety_provider_name: str, safety_provider: Union[_models.RaiExternalSafetyProviderSchema, JSON, IO[bytes]], **kwargs: Any - ) -> Union[_models.RaiExternalSafetyProviderSchema, _models.RaiExternalSafetyProvider]: + ) -> _models.RaiExternalSafetyProviderSchema: """Create the rai safety provider associated with the subscription. :param safety_provider_name: The name of the Rai External Safety Provider associated with the @@ -14469,10 +18820,9 @@ async def create_or_update( following types: RaiExternalSafetyProviderSchema, JSON, IO[bytes] Required. :type safety_provider: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema or JSON or IO[bytes] - :return: RaiExternalSafetyProviderSchema or RaiExternalSafetyProvider. The - RaiExternalSafetyProviderSchema is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema or - ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProvider + :return: RaiExternalSafetyProviderSchema. The RaiExternalSafetyProviderSchema is compatible + with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14487,9 +18837,7 @@ async def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Union[_models.RaiExternalSafetyProviderSchema, _models.RaiExternalSafetyProvider]] = kwargs.pop( - "cls", None - ) + cls: ClsType[_models.RaiExternalSafetyProviderSchema] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -14533,17 +18881,10 @@ async def create_or_update( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.RaiExternalSafetyProviderSchema, response.json()) - - if response.status_code == 201: - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.RaiExternalSafetyProvider, response.json()) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RaiExternalSafetyProviderSchema, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14731,7 +19072,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -15413,7 +19757,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -16007,7 +20354,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -16646,7 +20996,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -17343,7 +21696,7 @@ def get_long_running_output(pipeline_response): "managed_network_name", ] }, - api_versions_list=["2026-01-15-preview"], + api_versions_list=["2026-01-15-preview", "2026-03-01", "2026-03-15-preview"], ) async def _delete_initial( self, resource_group_name: str, account_name: str, managed_network_name: str, **kwargs: Any @@ -17419,7 +21772,7 @@ async def _delete_initial( "managed_network_name", ] }, - api_versions_list=["2026-01-15-preview"], + api_versions_list=["2026-01-15-preview", "2026-03-01", "2026-03-15-preview"], ) async def begin_delete( self, resource_group_name: str, account_name: str, managed_network_name: str, **kwargs: Any @@ -17545,7 +21898,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -17694,7 +22050,7 @@ async def begin_post( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OutboundRuleListResult]: + ) -> AsyncLROPoller[AsyncItemPaged["_models.OutboundRuleBasicResource"]]: """The POST API for updating the outbound rules of the managed network associated with the cognitive services account. @@ -17714,10 +22070,10 @@ async def begin_post( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OutboundRuleListResult. The - OutboundRuleListResult is compatible with MutableMapping + :return: An instance of LROPoller that returns an iterator like instance of list of + OutboundRuleBasicResource :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.OutboundRuleListResult] + ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.OutboundRuleBasicResource]] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17731,7 +22087,7 @@ async def begin_post( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OutboundRuleListResult]: + ) -> AsyncLROPoller[AsyncItemPaged["_models.OutboundRuleBasicResource"]]: """The POST API for updating the outbound rules of the managed network associated with the cognitive services account. @@ -17751,10 +22107,10 @@ async def begin_post( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OutboundRuleListResult. The - OutboundRuleListResult is compatible with MutableMapping + :return: An instance of LROPoller that returns an iterator like instance of list of + OutboundRuleBasicResource :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.OutboundRuleListResult] + ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.OutboundRuleBasicResource]] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17768,7 +22124,7 @@ async def begin_post( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.OutboundRuleListResult]: + ) -> AsyncLROPoller[AsyncItemPaged["_models.OutboundRuleBasicResource"]]: """The POST API for updating the outbound rules of the managed network associated with the cognitive services account. @@ -17788,10 +22144,10 @@ async def begin_post( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns OutboundRuleListResult. The - OutboundRuleListResult is compatible with MutableMapping + :return: An instance of LROPoller that returns an iterator like instance of list of + OutboundRuleBasicResource :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.OutboundRuleListResult] + ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.OutboundRuleBasicResource]] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -17803,7 +22159,7 @@ async def begin_post( managed_network_name: str, body: Union[_models.ManagedNetworkSettingsBasicResource, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.OutboundRuleListResult]: + ) -> AsyncLROPoller[AsyncItemPaged["_models.OutboundRuleBasicResource"]]: """The POST API for updating the outbound rules of the managed network associated with the cognitive services account. @@ -17822,17 +22178,108 @@ async def begin_post( ManagedNetworkSettingsBasicResource, JSON, IO[bytes] Required. :type body: ~azure.mgmt.cognitiveservices.models.ManagedNetworkSettingsBasicResource or JSON or IO[bytes] - :return: An instance of AsyncLROPoller that returns OutboundRuleListResult. The - OutboundRuleListResult is compatible with MutableMapping + :return: An instance of LROPoller that returns an iterator like instance of list of + OutboundRuleBasicResource :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.OutboundRuleListResult] + ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.OutboundRuleBasicResource]] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OutboundRuleListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.OutboundRuleBasicResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + def prepare_request(next_link=None): + if not next_link: + + _request = build_outbound_rules_post_request( + resource_group_name=resource_group_name, + account_name=account_name, + managed_network_name=managed_network_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.OutboundRuleBasicResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -17852,15 +22299,12 @@ async def begin_post( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + async def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + return await get_next(next_link) - deserialized = _deserialize(_models.OutboundRuleListResult, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return AsyncItemPaged(internal_get_next, extract_data) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -17875,13 +22319,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.OutboundRuleListResult].from_continuation_token( + return AsyncLROPoller[AsyncItemPaged["_models.OutboundRuleBasicResource"]].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.OutboundRuleListResult]( + return AsyncLROPoller[AsyncItemPaged["_models.OutboundRuleBasicResource"]]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -18840,7 +23284,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -19107,7 +23554,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -19225,7 +23675,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -19339,7 +23792,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -19452,7 +23908,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -19577,7 +24036,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -19699,7 +24161,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_patch.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_patch.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py index 07446a8a56a7..0a1996068f94 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py @@ -48,6 +48,7 @@ ChannelsBuiltInAuthorizationPolicy, CheckDomainAvailabilityParameter, CheckSkuAvailabilityParameter, + ClusterComputeProperties, CommitmentCost, CommitmentPeriod, CommitmentPlan, @@ -57,8 +58,10 @@ CommitmentPlanProperties, CommitmentQuota, CommitmentTier, + Compute, ComputeOperationStatus, ComputeOperationStatusProperties, + ComputeProperties, ConnectionAccessKey, ConnectionAccountKey, ConnectionApiKey, @@ -71,18 +74,21 @@ ConnectionSharedAccessSignature, ConnectionUpdateContent, ConnectionUsernamePassword, + ConnectivityEndpoints, + ContainerInstanceComputeProperties, CustomBlocklistConfig, CustomKeys, CustomKeysConnectionProperties, - CustomTopicConfig, DefenderForAISetting, DefenderForAISettingProperties, Deployment, DeploymentCapacitySettings, DeploymentModel, + DeploymentPolicyEvaluationResult, DeploymentProperties, DeploymentRouting, DeploymentScaleSettings, + DeploymentSizeCapacity, DomainAvailability, Encryption, EncryptionScope, @@ -90,6 +96,10 @@ ErrorAdditionalInfo, ErrorDetail, ErrorResponse, + EvaluateDeploymentPoliciesDeployment, + EvaluateDeploymentPoliciesDeploymentProperties, + EvaluateDeploymentPoliciesRequest, + EvaluateDeploymentPoliciesResponse, FoundryAutoUpgrade, FqdnOutboundRule, HostedAgentDeployment, @@ -97,6 +107,14 @@ IpRule, KeyVaultProperties, ManagedAgentDeployment, + ManagedComputeCapacity, + ManagedComputeCapacityProperties, + ManagedComputeDeployment, + ManagedComputeDeploymentInfo, + ManagedComputeDeploymentProperties, + ManagedComputeDeploymentProvisioningDetails, + ManagedComputeDeploymentRoutes, + ManagedComputeUsage, ManagedIdentityAuthTypeConnectionProperties, ManagedNetworkProvisionOptions, ManagedNetworkProvisionStatus, @@ -131,10 +149,13 @@ OrganizationSharedBuiltInAuthorizationPolicy, OutboundRule, OutboundRuleBasicResource, - OutboundRuleListResult, PATAuthTypeConnectionProperties, + PatchResourceSku, PatchResourceTags, PatchResourceTagsAndSku, + PolicyAssignmentEvaluationDetails, + PolicyExpressionEvaluationDetails, + Pool, PrivateEndpoint, PrivateEndpointConnection, PrivateEndpointConnectionListResult, @@ -164,8 +185,6 @@ RaiBlocklistProperties, RaiContentFilter, RaiContentFilterProperties, - RaiExternalSafetyProvider, - RaiExternalSafetyProviderProperties, RaiExternalSafetyProviderSchema, RaiExternalSafetyProviderSchemaProperties, RaiMonitorConfig, @@ -178,7 +197,6 @@ RaiToolLabelPropertiesAccountScope, RaiToolLabelPropertiesProjectScopesItem, RaiTopic, - RaiTopicConfig, RaiTopicProperties, RegenerateKeyParameters, RegionSetting, @@ -201,6 +219,7 @@ SkuCapability, SkuChangeInfo, SkuResource, + SshSettings, SystemData, ThrottlingRule, TrafficRoutingRule, @@ -212,6 +231,8 @@ UsernamePasswordAuthTypeConnectionProperties, VersionedAgentReference, VirtualNetworkRule, + Workbench, + WorkbenchProperties, ) from ._enums import ( # type: ignore @@ -228,6 +249,8 @@ CapabilityHostProvisioningState, CommitmentPlanProvisioningState, ComputeOperationStatusType, + ComputeProvisioningState, + ComputeType, ConnectionAuthType, ConnectionCategory, ConnectionGroup, @@ -259,6 +282,7 @@ NetworkRuleAction, NspAccessRuleDirection, Origin, + PolicyEvaluationOutcome, PrivateEndpointConnectionProvisioningState, PrivateEndpointServiceConnectionStatus, ProvisioningState, @@ -285,6 +309,7 @@ TrafficRoutingProtocol, UnitType, UpgradeAvailabilityStatus, + VmPriority, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -325,6 +350,7 @@ "ChannelsBuiltInAuthorizationPolicy", "CheckDomainAvailabilityParameter", "CheckSkuAvailabilityParameter", + "ClusterComputeProperties", "CommitmentCost", "CommitmentPeriod", "CommitmentPlan", @@ -334,8 +360,10 @@ "CommitmentPlanProperties", "CommitmentQuota", "CommitmentTier", + "Compute", "ComputeOperationStatus", "ComputeOperationStatusProperties", + "ComputeProperties", "ConnectionAccessKey", "ConnectionAccountKey", "ConnectionApiKey", @@ -348,18 +376,21 @@ "ConnectionSharedAccessSignature", "ConnectionUpdateContent", "ConnectionUsernamePassword", + "ConnectivityEndpoints", + "ContainerInstanceComputeProperties", "CustomBlocklistConfig", "CustomKeys", "CustomKeysConnectionProperties", - "CustomTopicConfig", "DefenderForAISetting", "DefenderForAISettingProperties", "Deployment", "DeploymentCapacitySettings", "DeploymentModel", + "DeploymentPolicyEvaluationResult", "DeploymentProperties", "DeploymentRouting", "DeploymentScaleSettings", + "DeploymentSizeCapacity", "DomainAvailability", "Encryption", "EncryptionScope", @@ -367,6 +398,10 @@ "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", + "EvaluateDeploymentPoliciesDeployment", + "EvaluateDeploymentPoliciesDeploymentProperties", + "EvaluateDeploymentPoliciesRequest", + "EvaluateDeploymentPoliciesResponse", "FoundryAutoUpgrade", "FqdnOutboundRule", "HostedAgentDeployment", @@ -374,6 +409,14 @@ "IpRule", "KeyVaultProperties", "ManagedAgentDeployment", + "ManagedComputeCapacity", + "ManagedComputeCapacityProperties", + "ManagedComputeDeployment", + "ManagedComputeDeploymentInfo", + "ManagedComputeDeploymentProperties", + "ManagedComputeDeploymentProvisioningDetails", + "ManagedComputeDeploymentRoutes", + "ManagedComputeUsage", "ManagedIdentityAuthTypeConnectionProperties", "ManagedNetworkProvisionOptions", "ManagedNetworkProvisionStatus", @@ -408,10 +451,13 @@ "OrganizationSharedBuiltInAuthorizationPolicy", "OutboundRule", "OutboundRuleBasicResource", - "OutboundRuleListResult", "PATAuthTypeConnectionProperties", + "PatchResourceSku", "PatchResourceTags", "PatchResourceTagsAndSku", + "PolicyAssignmentEvaluationDetails", + "PolicyExpressionEvaluationDetails", + "Pool", "PrivateEndpoint", "PrivateEndpointConnection", "PrivateEndpointConnectionListResult", @@ -441,8 +487,6 @@ "RaiBlocklistProperties", "RaiContentFilter", "RaiContentFilterProperties", - "RaiExternalSafetyProvider", - "RaiExternalSafetyProviderProperties", "RaiExternalSafetyProviderSchema", "RaiExternalSafetyProviderSchemaProperties", "RaiMonitorConfig", @@ -455,7 +499,6 @@ "RaiToolLabelPropertiesAccountScope", "RaiToolLabelPropertiesProjectScopesItem", "RaiTopic", - "RaiTopicConfig", "RaiTopicProperties", "RegenerateKeyParameters", "RegionSetting", @@ -478,6 +521,7 @@ "SkuCapability", "SkuChangeInfo", "SkuResource", + "SshSettings", "SystemData", "ThrottlingRule", "TrafficRoutingRule", @@ -489,6 +533,8 @@ "UsernamePasswordAuthTypeConnectionProperties", "VersionedAgentReference", "VirtualNetworkRule", + "Workbench", + "WorkbenchProperties", "AbusePenaltyAction", "ActionType", "AgentDeploymentProvisioningState", @@ -502,6 +548,8 @@ "CapabilityHostProvisioningState", "CommitmentPlanProvisioningState", "ComputeOperationStatusType", + "ComputeProvisioningState", + "ComputeType", "ConnectionAuthType", "ConnectionCategory", "ConnectionGroup", @@ -533,6 +581,7 @@ "NetworkRuleAction", "NspAccessRuleDirection", "Origin", + "PolicyEvaluationOutcome", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", "ProvisioningState", @@ -559,6 +608,7 @@ "TrafficRoutingProtocol", "UnitType", "UpgradeAvailabilityStatus", + "VmPriority", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_enums.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_enums.py index 958ad83096a6..c6e228797b6a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_enums.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_enums.py @@ -186,6 +186,42 @@ class ComputeOperationStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation has been canceled.""" +class ComputeProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of a compute resource.""" + + ACCEPTED = "Accepted" + """The resource provisioning request has been accepted.""" + SUCCEEDED = "Succeeded" + """The resource has been fully provisioned.""" + FAILED = "Failed" + """The resource provisioning has failed.""" + CANCELED = "Canceled" + """The resource provisioning was canceled.""" + DELETING = "Deleting" + """The resource is being deleted.""" + SCALING = "Scaling" + """The resource is scaling.""" + DISABLED = "Disabled" + """The resource is disabled.""" + STARTING = "Starting" + """The compute resource is starting.""" + STOPPING = "Stopping" + """The compute resource is stopping.""" + RESTARTING = "Restarting" + """The compute resource is restarting.""" + STOPPED = "Stopped" + """The compute resource is stopped.""" + + +class ComputeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of compute resource.""" + + CLUSTER = "Cluster" + """Cluster (AKS-backed) compute type.""" + CONTAINER_INSTANCE = "ContainerInstance" + """Container Instance compute type.""" + + class ConnectionAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Authentication type of the connection target.""" @@ -835,6 +871,17 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the operation is initiated by a user or system.""" +class PolicyEvaluationOutcome(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The outcome of a policy evaluation.""" + + COMPLIANT = "Compliant" + """The deployment is compliant with all policies.""" + NON_COMPLIANT = "NonCompliant" + """The deployment violates one or more policies.""" + ERROR = "Error" + """An error occurred during evaluation.""" + + class PrivateEndpointConnectionProvisioningState( # pylint: disable=name-too-long str, Enum, metaclass=CaseInsensitiveEnumMeta ): @@ -1017,14 +1064,14 @@ class RoutingMethods(str, Enum, metaclass=CaseInsensitiveEnumMeta): class RoutingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The routing mode that determines how requests are distributed across models.""" + """The model-router routing mode that determines how requests are distributed across models.""" COST = "cost" """Route requests to minimize cost while meeting performance requirements.""" BALANCED = "balanced" - """Balance cost and accuracy when routing requests across models.""" - ACCURACY = "accuracy" - """Route requests to maximize accuracy regardless of cost.""" + """Balance cost and quality when routing requests across models.""" + QUALITY = "quality" + """Route requests to maximize quality regardless of cost.""" class RuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1162,3 +1209,12 @@ class UpgradeAvailabilityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AVAILABLE.""" NOT_AVAILABLE = "NotAvailable" """NOT_AVAILABLE.""" + + +class VmPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """VM priority for a compute pool.""" + + REGULAR = "Regular" + """Regular VM priority.""" + LOW_PRIORITY = "LowPriority" + """Low-priority VM.""" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py index 9a5f2b57974c..972d2786bf7f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py @@ -12,7 +12,7 @@ from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload from .._utils.model_base import Model as _Model, rest_discriminator, rest_field -from ._enums import AgentDeploymentType, BuiltInAuthorizationScheme, ConnectionAuthType, RuleType +from ._enums import AgentDeploymentType, BuiltInAuthorizationScheme, ComputeType, ConnectionAuthType, RuleType if TYPE_CHECKING: from .. import models as _models @@ -433,7 +433,24 @@ class Resource(_Model): """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" -class Account(Resource): +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + """ + + +class Account(ProxyResource): """Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU. @@ -1093,23 +1110,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ProxyResource(Resource): - """Proxy Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData - """ - - class AgentApplication(ProxyResource): """Agent Application resource. @@ -2420,6 +2420,111 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ComputeProperties(_Model): + """Base properties for all compute resource types. The computeType discriminator determines the + concrete property shape. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ClusterComputeProperties, ContainerInstanceComputeProperties + + :ivar compute_type: The type of compute resource. Required. Known values are: "Cluster" and + "ContainerInstance". + :vartype compute_type: str or ~azure.mgmt.cognitiveservices.models.ComputeType + :ivar provisioning_state: Provisioning state of the compute resource. Known values are: + "Accepted", "Succeeded", "Failed", "Canceled", "Deleting", "Scaling", "Disabled", "Starting", + "Stopping", "Restarting", and "Stopped". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.ComputeProvisioningState + :ivar errors: Error details for the compute resource. + :vartype errors: list[~azure.mgmt.cognitiveservices.models.ErrorDetail] + :ivar creation_time: Creation time of the compute resource. + :vartype creation_time: ~datetime.datetime + """ + + __mapping__: dict[str, _Model] = {} + compute_type: str = rest_discriminator( + name="computeType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of compute resource. Required. Known values are: \"Cluster\" and + \"ContainerInstance\".""" + provisioning_state: Optional[Union[str, "_models.ComputeProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the compute resource. Known values are: \"Accepted\", \"Succeeded\", + \"Failed\", \"Canceled\", \"Deleting\", \"Scaling\", \"Disabled\", \"Starting\", \"Stopping\", + \"Restarting\", and \"Stopped\".""" + errors: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """Error details for the compute resource.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Creation time of the compute resource.""" + + @overload + def __init__( + self, + *, + compute_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ClusterComputeProperties(ComputeProperties, discriminator="Cluster"): + """Properties for a Cluster (AKS-backed) compute resource. + + :ivar provisioning_state: Provisioning state of the compute resource. Known values are: + "Accepted", "Succeeded", "Failed", "Canceled", "Deleting", "Scaling", "Disabled", "Starting", + "Stopping", "Restarting", and "Stopped". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.ComputeProvisioningState + :ivar errors: Error details for the compute resource. + :vartype errors: list[~azure.mgmt.cognitiveservices.models.ErrorDetail] + :ivar creation_time: Creation time of the compute resource. + :vartype creation_time: ~datetime.datetime + :ivar compute_type: The type of compute resource. Required. Cluster (AKS-backed) compute type. + :vartype compute_type: str or ~azure.mgmt.cognitiveservices.models.CLUSTER + :ivar pools: Pools attached to this compute cluster. Required. + :vartype pools: list[~azure.mgmt.cognitiveservices.models.Pool] + :ivar subnet_arm_id: ARM ID of the subnet used for compute. + :vartype subnet_arm_id: str + """ + + compute_type: Literal[ComputeType.CLUSTER] = rest_discriminator(name="computeType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of compute resource. Required. Cluster (AKS-backed) compute type.""" + pools: list["_models.Pool"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Pools attached to this compute cluster. Required.""" + subnet_arm_id: Optional[str] = rest_field( + name="subnetArmId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM ID of the subnet used for compute.""" + + @overload + def __init__( + self, + *, + pools: list["_models.Pool"], + subnet_arm_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.compute_type = ComputeType.CLUSTER # type: ignore + + class CommitmentCost(_Model): """Cognitive Services account commitment cost. @@ -2502,7 +2607,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CommitmentPlan(Resource): +class CommitmentPlan(ProxyResource): """Cognitive Services account commitment plan. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -2885,6 +2990,72 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class Compute(ProxyResource): + """Cognitive Services compute resource. Supports polymorphic compute types (Cluster, + ContainerInstance) via the computeType discriminator in properties. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar properties: Polymorphic properties of the compute resource. Use computeType to select + Cluster or ContainerInstance. Required. + :vartype properties: ~azure.mgmt.cognitiveservices.models.ComputeProperties + :ivar etag: Resource Etag. + :vartype etag: str + :ivar location: The location of the compute resource. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar kind: The kind (type) of compute resource. + :vartype kind: str + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cognitiveservices.models.Identity + """ + + properties: "_models.ComputeProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Polymorphic properties of the compute resource. Use computeType to select Cluster or + ContainerInstance. Required.""" + etag: Optional[str] = rest_field(visibility=["read"]) + """Resource Etag.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The location of the compute resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + kind: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The kind (type) of compute resource.""" + identity: Optional["_models.Identity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Identity for the resource.""" + + @overload + def __init__( + self, + *, + properties: "_models.ComputeProperties", + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + kind: Optional[str] = None, + identity: Optional["_models.Identity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ComputeOperationStatus(ProxyResource): """The status of an async compute operation. @@ -3367,6 +3538,94 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ConnectivityEndpoints(_Model): + """Network connectivity endpoints for a Container Instance compute. + + :ivar public_ip_address: The public IP address of the compute instance. + :vartype public_ip_address: str + :ivar ssh_port: The SSH port for the compute instance. + :vartype ssh_port: int + """ + + public_ip_address: Optional[str] = rest_field(name="publicIpAddress", visibility=["read"]) + """The public IP address of the compute instance.""" + ssh_port: Optional[int] = rest_field(name="sshPort", visibility=["read"]) + """The SSH port for the compute instance.""" + + +class ContainerInstanceComputeProperties(ComputeProperties, discriminator="ContainerInstance"): + """Properties for a Container Instance compute resource. + + :ivar provisioning_state: Provisioning state of the compute resource. Known values are: + "Accepted", "Succeeded", "Failed", "Canceled", "Deleting", "Scaling", "Disabled", "Starting", + "Stopping", "Restarting", and "Stopped". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.ComputeProvisioningState + :ivar errors: Error details for the compute resource. + :vartype errors: list[~azure.mgmt.cognitiveservices.models.ErrorDetail] + :ivar creation_time: Creation time of the compute resource. + :vartype creation_time: ~datetime.datetime + :ivar compute_type: The type of compute resource. Required. Container Instance compute type. + :vartype compute_type: str or ~azure.mgmt.cognitiveservices.models.CONTAINER_INSTANCE + :ivar target_cluster_id: ARM resource ID of the parent cluster that hosts this container + instance. Required. + :vartype target_cluster_id: str + :ivar image_link: Container image URI (e.g., MCR or ACR image path) for the container instance. + Required. + :vartype image_link: str + :ivar idle_time_before_shutdown: ISO 8601 duration before the idle instance is automatically + shut down (e.g., 'PT30M'). + :vartype idle_time_before_shutdown: str + :ivar ssh_settings: SSH configuration for remote access to the container instance. + :vartype ssh_settings: ~azure.mgmt.cognitiveservices.models.SshSettings + :ivar connectivity_endpoints: Network connectivity endpoints assigned to the container + instance. + :vartype connectivity_endpoints: ~azure.mgmt.cognitiveservices.models.ConnectivityEndpoints + """ + + compute_type: Literal[ComputeType.CONTAINER_INSTANCE] = rest_discriminator(name="computeType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of compute resource. Required. Container Instance compute type.""" + target_cluster_id: str = rest_field( + name="targetClusterId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM resource ID of the parent cluster that hosts this container instance. Required.""" + image_link: str = rest_field(name="imageLink", visibility=["read", "create", "update", "delete", "query"]) + """Container image URI (e.g., MCR or ACR image path) for the container instance. Required.""" + idle_time_before_shutdown: Optional[str] = rest_field( + name="idleTimeBeforeShutdown", visibility=["read", "create", "update", "delete", "query"] + ) + """ISO 8601 duration before the idle instance is automatically shut down (e.g., 'PT30M').""" + ssh_settings: Optional["_models.SshSettings"] = rest_field( + name="sshSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """SSH configuration for remote access to the container instance.""" + connectivity_endpoints: Optional["_models.ConnectivityEndpoints"] = rest_field( + name="connectivityEndpoints", visibility=["read"] + ) + """Network connectivity endpoints assigned to the container instance.""" + + @overload + def __init__( + self, + *, + target_cluster_id: str, + image_link: str, + idle_time_before_shutdown: Optional[str] = None, + ssh_settings: Optional["_models.SshSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.compute_type = ComputeType.CONTAINER_INSTANCE # type: ignore + + class RaiBlocklistConfig(_Model): """Azure OpenAI blocklist config. @@ -3564,77 +3823,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.auth_type = ConnectionAuthType.CUSTOM_KEYS # type: ignore -class RaiTopicConfig(_Model): - """Azure OpenAI RAI topic config. - - :ivar topic_name: Name of RAI topic. - :vartype topic_name: str - :ivar blocking: If blocking would occur. - :vartype blocking: bool - """ - - topic_name: Optional[str] = rest_field(name="topicName", visibility=["read", "create", "update", "delete", "query"]) - """Name of RAI topic.""" - blocking: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """If blocking would occur.""" - - @overload - def __init__( - self, - *, - topic_name: Optional[str] = None, - blocking: Optional[bool] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class CustomTopicConfig(RaiTopicConfig): - """Gets or sets the source to which filter applies. - - :ivar topic_name: Name of RAI topic. - :vartype topic_name: str - :ivar blocking: If blocking would occur. - :vartype blocking: bool - :ivar source: Content source to apply the Content Filters. Known values are: "Prompt", - "Completion", "PreToolCall", "PostToolCall", "PreRun", and "PostRun". - :vartype source: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyContentSource - """ - - source: Optional[Union[str, "_models.RaiPolicyContentSource"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Content source to apply the Content Filters. Known values are: \"Prompt\", \"Completion\", - \"PreToolCall\", \"PostToolCall\", \"PreRun\", and \"PostRun\".""" - - @overload - def __init__( - self, - *, - topic_name: Optional[str] = None, - blocking: Optional[bool] = None, - source: Optional[Union[str, "_models.RaiPolicyContentSource"]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - class DefenderForAISetting(ProxyResource): """The Defender for AI resource. @@ -3826,26 +4014,73 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DeploymentProperties(_Model): - """Properties of Cognitive Services account deployment. +class DeploymentPolicyEvaluationResult(_Model): + """Policy evaluation result for a single deployment. - :ivar provisioning_state: Gets the status of the resource at the time the operation was called. - Known values are: "Accepted", "Creating", "Deleting", "Moving", "Failed", "Succeeded", - "Disabled", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.cognitiveservices.models.DeploymentProvisioningState - :ivar model: Properties of Cognitive Services account deployment model. - :vartype model: ~azure.mgmt.cognitiveservices.models.DeploymentModel - :ivar scale_settings: Properties of Cognitive Services account deployment model. (Deprecated, - please use Deployment.sku instead.). - :vartype scale_settings: ~azure.mgmt.cognitiveservices.models.DeploymentScaleSettings - :ivar capabilities: The capabilities. - :vartype capabilities: dict[str, str] - :ivar rai_policy_name: The name of RAI policy. - :vartype rai_policy_name: str - :ivar call_rate_limit: The call rate limit Cognitive Services account. - :vartype call_rate_limit: ~azure.mgmt.cognitiveservices.models.CallRateLimit - :ivar rate_limits: + :ivar evaluation_outcome: The evaluation outcome. Known values are: "Compliant", + "NonCompliant", and "Error". + :vartype evaluation_outcome: str or + ~azure.mgmt.cognitiveservices.models.PolicyEvaluationOutcome + :ivar error_message: Error message if the evaluation outcome is Error. + :vartype error_message: str + :ivar non_compliant_assignments: Details of non-compliant policy assignments. + :vartype non_compliant_assignments: + list[~azure.mgmt.cognitiveservices.models.PolicyAssignmentEvaluationDetails] + """ + + evaluation_outcome: Optional[Union[str, "_models.PolicyEvaluationOutcome"]] = rest_field( + name="evaluationOutcome", visibility=["read", "create", "update", "delete", "query"] + ) + """The evaluation outcome. Known values are: \"Compliant\", \"NonCompliant\", and \"Error\".""" + error_message: Optional[str] = rest_field( + name="errorMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Error message if the evaluation outcome is Error.""" + non_compliant_assignments: Optional[list["_models.PolicyAssignmentEvaluationDetails"]] = rest_field( + name="nonCompliantAssignments", visibility=["read", "create", "update", "delete", "query"] + ) + """Details of non-compliant policy assignments.""" + + @overload + def __init__( + self, + *, + evaluation_outcome: Optional[Union[str, "_models.PolicyEvaluationOutcome"]] = None, + error_message: Optional[str] = None, + non_compliant_assignments: Optional[list["_models.PolicyAssignmentEvaluationDetails"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeploymentProperties(_Model): + """Properties of Cognitive Services account deployment. + + :ivar provisioning_state: Gets the status of the resource at the time the operation was called. + Known values are: "Accepted", "Creating", "Deleting", "Moving", "Failed", "Succeeded", + "Disabled", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.DeploymentProvisioningState + :ivar model: Properties of Cognitive Services account deployment model. + :vartype model: ~azure.mgmt.cognitiveservices.models.DeploymentModel + :ivar scale_settings: Properties of Cognitive Services account deployment model. (Deprecated, + please use Deployment.sku instead.). + :vartype scale_settings: ~azure.mgmt.cognitiveservices.models.DeploymentScaleSettings + :ivar capabilities: The capabilities. + :vartype capabilities: dict[str, str] + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar call_rate_limit: The call rate limit Cognitive Services account. + :vartype call_rate_limit: ~azure.mgmt.cognitiveservices.models.CallRateLimit + :ivar rate_limits: :vartype rate_limits: list[~azure.mgmt.cognitiveservices.models.ThrottlingRule] :ivar version_upgrade_option: Deployment model version upgrade option. Known values are: "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", and "NoAutoUpgrade". @@ -3874,10 +4109,10 @@ class DeploymentProperties(_Model): 'Paused' to temporarily stop inference while preserving the deployment configuration. Known values are: "Running" and "Paused". :vartype deployment_state: str or ~azure.mgmt.cognitiveservices.models.DeploymentState - :ivar routing: 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. + :ivar routing: 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. :vartype routing: ~azure.mgmt.cognitiveservices.models.DeploymentRouting """ @@ -3944,10 +4179,10 @@ class DeploymentProperties(_Model): routing: Optional["_models.DeploymentRouting"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """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.""" @overload def __init__( @@ -3978,29 +4213,29 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class DeploymentRouting(_Model): - """Routing configuration for the deployment. Specifies how requests are routed across multiple - models. + """Routing configuration for the model-router deployment. Specifies how requests are routed across + multiple models. - :ivar mode: The routing mode that determines how requests are distributed across models. Known - values are: "cost", "balanced", and "accuracy". + :ivar mode: The model-router routing mode that determines how requests are distributed across + models. Known values are: "cost", "balanced", and "quality". :vartype mode: str or ~azure.mgmt.cognitiveservices.models.RoutingMode - :ivar models: 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. + :ivar models: 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. :vartype models: list[~azure.mgmt.cognitiveservices.models.DeploymentModel] """ mode: Optional[Union[str, "_models.RoutingMode"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The routing mode that determines how requests are distributed across models. Known values are: - \"cost\", \"balanced\", and \"accuracy\".""" + """The model-router routing mode that determines how requests are distributed across models. Known + values are: \"cost\", \"balanced\", and \"quality\".""" models: Optional[list["_models.DeploymentModel"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """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.""" @overload def __init__( @@ -4063,6 +4298,28 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class DeploymentSizeCapacity(_Model): + """Capacity information for a specific deployment size. + + :ivar model_instance_accelerator_count: The number of accelerators required per model instance. + :vartype model_instance_accelerator_count: int + :ivar total_available_capacity: The total available capacity for this deployment size. + :vartype total_available_capacity: int + :ivar largest_deployment_capacity: The largest contiguous deployment capacity available for + this deployment size. + :vartype largest_deployment_capacity: int + """ + + model_instance_accelerator_count: Optional[int] = rest_field( + name="modelInstanceAcceleratorCount", visibility=["read"] + ) + """The number of accelerators required per model instance.""" + total_available_capacity: Optional[int] = rest_field(name="totalAvailableCapacity", visibility=["read"]) + """The total available capacity for this deployment size.""" + largest_deployment_capacity: Optional[int] = rest_field(name="largestDeploymentCapacity", visibility=["read"]) + """The largest contiguous deployment capacity available for this deployment size.""" + + class DomainAvailability(_Model): """Domain availability. @@ -4324,6 +4581,140 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class EvaluateDeploymentPoliciesDeployment(_Model): + """A hypothetical deployment definition used for policy dry-run evaluation. + + :ivar name: The name of the hypothetical deployment. Required. + :vartype name: str + :ivar properties: Properties of the hypothetical deployment. Required. + :vartype properties: + ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesDeploymentProperties + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the hypothetical deployment. Required.""" + properties: "_models.EvaluateDeploymentPoliciesDeploymentProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the hypothetical deployment. Required.""" + + @overload + def __init__( + self, + *, + name: str, + properties: "_models.EvaluateDeploymentPoliciesDeploymentProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluateDeploymentPoliciesDeploymentProperties(_Model): # pylint: disable=name-too-long + """Properties of a hypothetical deployment for policy evaluation. + + :ivar model: The model to evaluate. Required. + :vartype model: ~azure.mgmt.cognitiveservices.models.DeploymentModel + :ivar rai_policy_name: The name of the RAI policy to evaluate. + :vartype rai_policy_name: str + """ + + model: "_models.DeploymentModel" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The model to evaluate. Required.""" + rai_policy_name: Optional[str] = rest_field( + name="raiPolicyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the RAI policy to evaluate.""" + + @overload + def __init__( + self, + *, + model: "_models.DeploymentModel", + rai_policy_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluateDeploymentPoliciesRequest(_Model): + """Request body for the evaluateDeploymentPolicies action. + + :ivar deployments: The list of hypothetical deployments to evaluate against Azure Policy. + Required. + :vartype deployments: + list[~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesDeployment] + """ + + deployments: list["_models.EvaluateDeploymentPoliciesDeployment"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of hypothetical deployments to evaluate against Azure Policy. Required.""" + + @overload + def __init__( + self, + *, + deployments: list["_models.EvaluateDeploymentPoliciesDeployment"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EvaluateDeploymentPoliciesResponse(_Model): + """Response body for the evaluateDeploymentPolicies action. + + :ivar results: Per-deployment policy evaluation results, keyed by deployment name. + :vartype results: dict[str, + ~azure.mgmt.cognitiveservices.models.DeploymentPolicyEvaluationResult] + """ + + results: Optional[dict[str, "_models.DeploymentPolicyEvaluationResult"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Per-deployment policy evaluation results, keyed by deployment name.""" + + @overload + def __init__( + self, + *, + results: Optional[dict[str, "_models.DeploymentPolicyEvaluationResult"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class FoundryAutoUpgrade(_Model): """Represents the foundry auto-upgrade configuration for a Cognitive Services account. Customers can opt out of auto-upgrade by setting mode to Disabled. @@ -4586,16 +4977,431 @@ class Identity(_Model): user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = rest_field( name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] ) - """The list of user assigned identities associated with the resource. The user identity dictionary - key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.""" + """The list of user assigned identities associated with the resource. The user identity dictionary + key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IpRule(_Model): + """A rule governing the accessibility from a specific ip address or ip range. + + :ivar value: An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) + or '124.56.78.0/24' (all addresses that start with 124.56.78). Required. + :vartype value: str + """ + + value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or + '124.56.78.0/24' (all addresses that start with 124.56.78). Required.""" + + @overload + def __init__( + self, + *, + value: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultProperties(_Model): + """Properties to configure keyVault Properties. + + :ivar key_name: Name of the Key from KeyVault. + :vartype key_name: str + :ivar key_version: Version of the Key from KeyVault. + :vartype key_version: str + :ivar key_vault_uri: Uri of KeyVault. + :vartype key_vault_uri: str + :ivar identity_client_id: + :vartype identity_client_id: str + """ + + key_name: Optional[str] = rest_field(name="keyName", visibility=["read", "create", "update", "delete", "query"]) + """Name of the Key from KeyVault.""" + key_version: Optional[str] = rest_field( + name="keyVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Version of the Key from KeyVault.""" + key_vault_uri: Optional[str] = rest_field( + name="keyVaultUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Uri of KeyVault.""" + identity_client_id: Optional[str] = rest_field( + name="identityClientId", visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + key_name: Optional[str] = None, + key_version: Optional[str] = None, + key_vault_uri: Optional[str] = None, + identity_client_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedAgentDeployment(AgentDeploymentProperties, discriminator="Managed"): + """Represents a managed agent deployment where the underlying infrastructure is managed by the + platform in the deployer's subscription. + + :ivar description: The asset description text. + :vartype description: str + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar display_name: Gets or sets the display name of the deployment. + :vartype display_name: str + :ivar deployment_id: Gets or sets the unique identifier of the deployment. + :vartype deployment_id: str + :ivar state: Gets or sets the current operational state of the deployment (and, intrinsically, + of the comprising agents). Known values are: "Starting", "Running", "Stopping", "Stopped", + "Failed", "Deleting", "Deleted", and "Updating". + :vartype state: str or ~azure.mgmt.cognitiveservices.models.AgentDeploymentState + :ivar protocols: Gets or sets the supported protocol types and versions exposed by this + deployment. + :vartype protocols: list[~azure.mgmt.cognitiveservices.models.AgentProtocolVersion] + :ivar agents: Returns a flat list of agent:version deployed in this deployment. + :vartype agents: list[~azure.mgmt.cognitiveservices.models.VersionedAgentReference] + :ivar provisioning_state: Gets or sets the provisioning state of the agent deployment. Known + values are: "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.AgentDeploymentProvisioningState + :ivar deployment_type: Gets or sets the type of deployment for the agent. Required. The + underlying infra is managed by the platform in the deployer's subscription. + :vartype deployment_type: str or ~azure.mgmt.cognitiveservices.models.MANAGED + """ + + deployment_type: Literal[AgentDeploymentType.MANAGED] = rest_discriminator(name="deploymentType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Gets or sets the type of deployment for the agent. Required. The underlying infra is managed by + the platform in the deployer's subscription.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + display_name: Optional[str] = None, + deployment_id: Optional[str] = None, + state: Optional[Union[str, "_models.AgentDeploymentState"]] = None, + protocols: Optional[list["_models.AgentProtocolVersion"]] = None, + agents: Optional[list["_models.VersionedAgentReference"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.deployment_type = AgentDeploymentType.MANAGED # type: ignore + + +class ManagedComputeCapacity(ProxyResource): + """Managed compute capacity information for Cognitive Services managed compute deployments. + Provides available accelerator capacity per type and region at the subscription level. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar properties: Properties of the managed compute capacity resource. + :vartype properties: ~azure.mgmt.cognitiveservices.models.ManagedComputeCapacityProperties + """ + + properties: Optional["_models.ManagedComputeCapacityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the managed compute capacity resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ManagedComputeCapacityProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedComputeCapacityProperties(_Model): + """Properties of a managed compute capacity resource. + + :ivar accelerator_type: The type of accelerator (e.g., Azure.A100, Azure.H100). + :vartype accelerator_type: str + :ivar location: The Azure region where the capacity is available. + :vartype location: str + :ivar available_accelerators: The number of available accelerators in the region. + :vartype available_accelerators: int + :ivar deployment_size_capacities: Capacity information broken down by deployment size. + :vartype deployment_size_capacities: + list[~azure.mgmt.cognitiveservices.models.DeploymentSizeCapacity] + """ + + accelerator_type: Optional[str] = rest_field(name="acceleratorType", visibility=["read"]) + """The type of accelerator (e.g., Azure.A100, Azure.H100).""" + location: Optional[str] = rest_field(visibility=["read"]) + """The Azure region where the capacity is available.""" + available_accelerators: Optional[int] = rest_field(name="availableAccelerators", visibility=["read"]) + """The number of available accelerators in the region.""" + deployment_size_capacities: Optional[list["_models.DeploymentSizeCapacity"]] = rest_field( + name="deploymentSizeCapacities", visibility=["read"] + ) + """Capacity information broken down by deployment size.""" + + +class ManagedComputeDeployment(ProxyResource): + """Cognitive Services account managed compute deployment, backed by managed compute (GPU) + resources. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar properties: Properties of the Cognitive Services managed compute deployment. + :vartype properties: ~azure.mgmt.cognitiveservices.models.ManagedComputeDeploymentProperties + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.cognitiveservices.models.Sku + :ivar etag: Resource Etag. + :vartype etag: str + """ + + properties: Optional["_models.ManagedComputeDeploymentProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the Cognitive Services managed compute deployment.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource model definition representing SKU.""" + etag: Optional[str] = rest_field(visibility=["read"]) + """Resource Etag.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ManagedComputeDeploymentProperties"] = None, + sku: Optional["_models.Sku"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedComputeDeploymentInfo(_Model): + """Deployment detail within a managed compute usage entry. + + :ivar deployment_id: Full ARM resource ID of the deployment. + :vartype deployment_id: str + :ivar project_id: Full ARM resource ID of the account/project. + :vartype project_id: str + :ivar model_id: Model name (e.g., 'azureml://registries//models//versions/gpt-4o'). + :vartype model_id: str + :ivar accelerator_count: Number of GPUs consumed by this deployment. + :vartype accelerator_count: int + :ivar instance_count: Number of instances for this deployment. + :vartype instance_count: int + """ + + deployment_id: Optional[str] = rest_field( + name="deploymentId", visibility=["read", "create", "update", "delete", "query"] + ) + """Full ARM resource ID of the deployment.""" + project_id: Optional[str] = rest_field(name="projectId", visibility=["read", "create", "update", "delete", "query"]) + """Full ARM resource ID of the account/project.""" + model_id: Optional[str] = rest_field(name="modelId", visibility=["read", "create", "update", "delete", "query"]) + """Model name (e.g., 'azureml://registries//models//versions/gpt-4o').""" + accelerator_count: Optional[int] = rest_field( + name="acceleratorCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of GPUs consumed by this deployment.""" + instance_count: Optional[int] = rest_field( + name="instanceCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of instances for this deployment.""" + + @overload + def __init__( + self, + *, + deployment_id: Optional[str] = None, + project_id: Optional[str] = None, + model_id: Optional[str] = None, + accelerator_count: Optional[int] = None, + instance_count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedComputeDeploymentProperties(_Model): + """Properties of a Cognitive Services managed compute deployment. + + :ivar model: AzureML Registry model asset URI. Required on creation; immutable after creation. + Example: azureml://registries/{registry}/models/{model}/versions/{version}. Required. + :vartype model: str + :ivar deployment_template: 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}. + :vartype deployment_template: str + :ivar accelerator_type: Accelerator type (e.g., H100_80GB). Optional on creation; immutable + after creation. + :vartype accelerator_type: str + :ivar version_upgrade_option: Template auto-upgrade policy. Defaults to + OnceNewDefaultVersionAvailable. Known values are: "OnceNewDefaultVersionAvailable", + "OnceCurrentVersionExpired", and "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.cognitiveservices.models.DeploymentModelVersionUpgradeOption + :ivar compute_id: Foundry compute ARM resource ID for VM-backed managed compute deployments. + Required when sku.name is VmManagedCompute; immutable after creation. + :vartype compute_id: str + :ivar priority: Scheduling priority for VM-backed managed compute deployments. Immutable after + creation. + :vartype priority: str + :ivar accelerators_per_instance: Read-only. Number of accelerators (GPUs) consumed by each + model instance, sourced from the deployment template. + :vartype accelerators_per_instance: int + :ivar total_accelerators: Read-only. Total accelerators allocated: sku.capacity (instances) x + acceleratorsPerInstance. + :vartype total_accelerators: int + :ivar provisioning_state: Read-only. Current provisioning state. Known values are: "Accepted", + "Creating", "Deleting", "Moving", "Failed", "Succeeded", "Canceled", and "ResolvingDNS". + :vartype provisioning_state: str or ~azure.mgmt.cognitiveservices.models.ProvisioningState + :ivar provisioning_details: Read-only. Status message and timestamp from the last provisioning + operation. + :vartype provisioning_details: + ~azure.mgmt.cognitiveservices.models.ManagedComputeDeploymentProvisioningDetails + :ivar routes: Read-only. Inference route paths relative to the account endpoint. Populated when + provisioningState is Succeeded. + :vartype routes: ~azure.mgmt.cognitiveservices.models.ManagedComputeDeploymentRoutes + """ + + model: str = rest_field(visibility=["read", "create"]) + """AzureML Registry model asset URI. Required on creation; immutable after creation. Example: + azureml://registries/{registry}/models/{model}/versions/{version}. Required.""" + deployment_template: Optional[str] = rest_field(name="deploymentTemplate", visibility=["read", "create"]) + """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}.""" + accelerator_type: Optional[str] = rest_field(name="acceleratorType", visibility=["read", "create"]) + """Accelerator type (e.g., H100_80GB). Optional on creation; immutable after creation.""" + version_upgrade_option: Optional[Union[str, "_models.DeploymentModelVersionUpgradeOption"]] = rest_field( + name="versionUpgradeOption", visibility=["read", "create"] + ) + """Template auto-upgrade policy. Defaults to OnceNewDefaultVersionAvailable. Known values are: + \"OnceNewDefaultVersionAvailable\", \"OnceCurrentVersionExpired\", and \"NoAutoUpgrade\".""" + compute_id: Optional[str] = rest_field(name="computeId", visibility=["read", "create"]) + """Foundry compute ARM resource ID for VM-backed managed compute deployments. Required when + sku.name is VmManagedCompute; immutable after creation.""" + priority: Optional[str] = rest_field(visibility=["read", "create"]) + """Scheduling priority for VM-backed managed compute deployments. Immutable after creation.""" + accelerators_per_instance: Optional[int] = rest_field(name="acceleratorsPerInstance", visibility=["read"]) + """Read-only. Number of accelerators (GPUs) consumed by each model instance, sourced from the + deployment template.""" + total_accelerators: Optional[int] = rest_field(name="totalAccelerators", visibility=["read"]) + """Read-only. Total accelerators allocated: sku.capacity (instances) x acceleratorsPerInstance.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Read-only. Current provisioning state. Known values are: \"Accepted\", \"Creating\", + \"Deleting\", \"Moving\", \"Failed\", \"Succeeded\", \"Canceled\", and \"ResolvingDNS\".""" + provisioning_details: Optional["_models.ManagedComputeDeploymentProvisioningDetails"] = rest_field( + name="provisioningDetails", visibility=["read"] + ) + """Read-only. Status message and timestamp from the last provisioning operation.""" + routes: Optional["_models.ManagedComputeDeploymentRoutes"] = rest_field(visibility=["read"]) + """Read-only. Inference route paths relative to the account endpoint. Populated when + provisioningState is Succeeded.""" @overload def __init__( self, *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, + model: str, + deployment_template: Optional[str] = None, + accelerator_type: Optional[str] = None, + version_upgrade_option: Optional[Union[str, "_models.DeploymentModelVersionUpgradeOption"]] = None, + compute_id: Optional[str] = None, + priority: Optional[str] = None, ) -> None: ... @overload @@ -4609,23 +5415,28 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IpRule(_Model): - """A rule governing the accessibility from a specific ip address or ip range. +class ManagedComputeDeploymentProvisioningDetails(_Model): # pylint: disable=name-too-long + """Provisioning status details for a managed compute deployment. - :ivar value: An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) - or '124.56.78.0/24' (all addresses that start with 124.56.78). Required. - :vartype value: str + :ivar message: A human-readable status message from the last provisioning operation. + :vartype message: str + :ivar last_operation_timestamp: Timestamp of the last provisioning operation. + :vartype last_operation_timestamp: ~datetime.datetime """ - value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or - '124.56.78.0/24' (all addresses that start with 124.56.78). Required.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A human-readable status message from the last provisioning operation.""" + last_operation_timestamp: Optional[datetime.datetime] = rest_field( + name="lastOperationTimestamp", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Timestamp of the last provisioning operation.""" @overload def __init__( self, *, - value: str, + message: Optional[str] = None, + last_operation_timestamp: Optional[datetime.datetime] = None, ) -> None: ... @overload @@ -4639,41 +5450,36 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KeyVaultProperties(_Model): - """Properties to configure keyVault Properties. +class ManagedComputeDeploymentRoutes(_Model): + """Inference route paths for a managed compute deployment, relative to the account endpoint. + Populated when provisioningState is Succeeded. - :ivar key_name: Name of the Key from KeyVault. - :vartype key_name: str - :ivar key_version: Version of the Key from KeyVault. - :vartype key_version: str - :ivar key_vault_uri: Uri of KeyVault. - :vartype key_vault_uri: str - :ivar identity_client_id: - :vartype identity_client_id: str + :ivar chat_completions_scoring_path: Relative path to the chat completions scoring endpoint. + :vartype chat_completions_scoring_path: str + :ivar swagger: Relative path to the Swagger/OpenAPI endpoint. + :vartype swagger: str + :ivar messages_api_scoring_path: Relative path to the messages API scoring endpoint. + :vartype messages_api_scoring_path: str """ - key_name: Optional[str] = rest_field(name="keyName", visibility=["read", "create", "update", "delete", "query"]) - """Name of the Key from KeyVault.""" - key_version: Optional[str] = rest_field( - name="keyVersion", visibility=["read", "create", "update", "delete", "query"] - ) - """Version of the Key from KeyVault.""" - key_vault_uri: Optional[str] = rest_field( - name="keyVaultUri", visibility=["read", "create", "update", "delete", "query"] + chat_completions_scoring_path: Optional[str] = rest_field( + name="chatCompletionsScoringPath", visibility=["read", "create", "update", "delete", "query"] ) - """Uri of KeyVault.""" - identity_client_id: Optional[str] = rest_field( - name="identityClientId", visibility=["read", "create", "update", "delete", "query"] + """Relative path to the chat completions scoring endpoint.""" + swagger: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Relative path to the Swagger/OpenAPI endpoint.""" + messages_api_scoring_path: Optional[str] = rest_field( + name="messagesApiScoringPath", visibility=["read", "create", "update", "delete", "query"] ) + """Relative path to the messages API scoring endpoint.""" @overload def __init__( self, *, - key_name: Optional[str] = None, - key_version: Optional[str] = None, - key_vault_uri: Optional[str] = None, - identity_client_id: Optional[str] = None, + chat_completions_scoring_path: Optional[str] = None, + swagger: Optional[str] = None, + messages_api_scoring_path: Optional[str] = None, ) -> None: ... @overload @@ -4687,51 +5493,63 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ManagedAgentDeployment(AgentDeploymentProperties, discriminator="Managed"): - """Represents a managed agent deployment where the underlying infrastructure is managed by the - platform in the deployer's subscription. +class ManagedComputeUsage(_Model): + """Managed compute quota usage for a specific SKU. - :ivar description: The asset description text. - :vartype description: str - :ivar tags: Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar display_name: Gets or sets the display name of the deployment. - :vartype display_name: str - :ivar deployment_id: Gets or sets the unique identifier of the deployment. - :vartype deployment_id: str - :ivar state: Gets or sets the current operational state of the deployment (and, intrinsically, - of the comprising agents). Known values are: "Starting", "Running", "Stopping", "Stopped", - "Failed", "Deleting", "Deleted", and "Updating". - :vartype state: str or ~azure.mgmt.cognitiveservices.models.AgentDeploymentState - :ivar protocols: Gets or sets the supported protocol types and versions exposed by this - deployment. - :vartype protocols: list[~azure.mgmt.cognitiveservices.models.AgentProtocolVersion] - :ivar agents: Returns a flat list of agent:version deployed in this deployment. - :vartype agents: list[~azure.mgmt.cognitiveservices.models.VersionedAgentReference] - :ivar provisioning_state: Gets or sets the provisioning state of the agent deployment. Known - values are: "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.cognitiveservices.models.AgentDeploymentProvisioningState - :ivar deployment_type: Gets or sets the type of deployment for the agent. Required. The - underlying infra is managed by the platform in the deployer's subscription. - :vartype deployment_type: str or ~azure.mgmt.cognitiveservices.models.MANAGED + :ivar id: Fully qualified resource ID for the managed compute usage. + :vartype id: str + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cognitiveservices.models.MetricName + :ivar type: The resource type. + :vartype type: str + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", and "Milliseconds". + :vartype unit: str or ~azure.mgmt.cognitiveservices.models.UnitType + :ivar limit: Maximum value for this metric. + :vartype limit: float + :ivar current_value: Current value for this metric. + :vartype current_value: float + :ivar offer_scope: Offer scope (e.g., 'Global', 'Datazone-US'). + :vartype offer_scope: str + :ivar deployments: Deployments consuming this managed compute quota. + :vartype deployments: list[~azure.mgmt.cognitiveservices.models.ManagedComputeDeploymentInfo] """ - deployment_type: Literal[AgentDeploymentType.MANAGED] = rest_discriminator(name="deploymentType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Gets or sets the type of deployment for the agent. Required. The underlying infra is managed by - the platform in the deployer's subscription.""" + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the managed compute usage.""" + name: Optional["_models.MetricName"] = rest_field(visibility=["read"]) + """The name information for the metric.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The resource type.""" + unit: Optional[Union[str, "_models.UnitType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", + \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" + limit: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Maximum value for this metric.""" + current_value: Optional[float] = rest_field( + name="currentValue", visibility=["read", "create", "update", "delete", "query"] + ) + """Current value for this metric.""" + offer_scope: Optional[str] = rest_field( + name="offerScope", visibility=["read", "create", "update", "delete", "query"] + ) + """Offer scope (e.g., 'Global', 'Datazone-US').""" + deployments: Optional[list["_models.ManagedComputeDeploymentInfo"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Deployments consuming this managed compute quota.""" @overload def __init__( self, *, - description: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - display_name: Optional[str] = None, - deployment_id: Optional[str] = None, - state: Optional[Union[str, "_models.AgentDeploymentState"]] = None, - protocols: Optional[list["_models.AgentProtocolVersion"]] = None, - agents: Optional[list["_models.VersionedAgentReference"]] = None, + unit: Optional[Union[str, "_models.UnitType"]] = None, + limit: Optional[float] = None, + current_value: Optional[float] = None, + offer_scope: Optional[str] = None, + deployments: Optional[list["_models.ManagedComputeDeploymentInfo"]] = None, ) -> None: ... @overload @@ -4743,7 +5561,6 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.deployment_type = AgentDeploymentType.MANAGED # type: ignore class ManagedIdentityAuthTypeConnectionProperties( @@ -6344,45 +7161,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class OutboundRuleListResult(_Model): - """List of outbound rules for the managed network of a cognitive services account. - - :ivar next_link: The link to the next page constructed using the continuationToken. If null, - there are no additional pages. - :vartype next_link: str - :ivar value: The list of cognitive services accounts. Since this list may be incomplete, the - nextLink field should be used to request the next list of cognitive services accounts. - :vartype value: list[~azure.mgmt.cognitiveservices.models.OutboundRuleBasicResource] - """ - - next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) - """The link to the next page constructed using the continuationToken. If null, there are no - additional pages.""" - value: Optional[list["_models.OutboundRuleBasicResource"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The list of cognitive services accounts. Since this list may be incomplete, the nextLink field - should be used to request the next list of cognitive services accounts.""" - - @overload - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[list["_models.OutboundRuleBasicResource"]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - class PATAuthTypeConnectionProperties(ConnectionPropertiesV2, discriminator="PAT"): """PATAuthTypeConnectionProperties. @@ -6441,27 +7219,190 @@ class PATAuthTypeConnectionProperties(ConnectionPropertiesV2, discriminator="PAT :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.PAT """ - credentials: Optional["_models.ConnectionPersonalAccessToken"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + credentials: Optional["_models.ConnectionPersonalAccessToken"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + auth_type: Literal[ConnectionAuthType.PAT] = rest_discriminator(name="authType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Authentication type of the connection target. Required. PAT.""" + + @overload + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[list[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.ConnectionPersonalAccessToken"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.auth_type = ConnectionAuthType.PAT # type: ignore + + +class PatchResourceSku(_Model): + """The object being used to update sku of a resource, in general used for PATCH operations. + + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.cognitiveservices.models.Sku + """ + + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource model definition representing SKU.""" + + @overload + def __init__( + self, + *, + sku: Optional["_models.Sku"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PatchResourceTags(_Model): + """The object being used to update tags of a resource, in general used for PATCH operations. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PatchResourceTagsAndSku(PatchResourceTags): + """The object being used to update tags and sku of a resource, in general used for PATCH + operations. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.cognitiveservices.models.Sku + """ + + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource model definition representing SKU.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PolicyAssignmentEvaluationDetails(_Model): + """Details of a non-compliant policy assignment. + + :ivar assignment_id: The policy assignment ID. + :vartype assignment_id: str + :ivar policy_definition_id: The policy definition ID. + :vartype policy_definition_id: str + :ivar policy_set_definition_id: The policy set definition ID. + :vartype policy_set_definition_id: str + :ivar evaluation_outcome: The evaluation outcome for this assignment. Known values are: + "Compliant", "NonCompliant", and "Error". + :vartype evaluation_outcome: str or + ~azure.mgmt.cognitiveservices.models.PolicyEvaluationOutcome + :ivar non_compliance_reason: The reason for non-compliance. + :vartype non_compliance_reason: str + :ivar effect: The policy effect (e.g., Deny, Audit). + :vartype effect: str + :ivar expression_evaluations: Expression-level evaluation details. + :vartype expression_evaluations: + list[~azure.mgmt.cognitiveservices.models.PolicyExpressionEvaluationDetails] + """ + + assignment_id: Optional[str] = rest_field( + name="assignmentId", visibility=["read", "create", "update", "delete", "query"] ) - auth_type: Literal[ConnectionAuthType.PAT] = rest_discriminator(name="authType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Authentication type of the connection target. Required. PAT.""" + """The policy assignment ID.""" + policy_definition_id: Optional[str] = rest_field( + name="policyDefinitionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The policy definition ID.""" + policy_set_definition_id: Optional[str] = rest_field( + name="policySetDefinitionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The policy set definition ID.""" + evaluation_outcome: Optional[Union[str, "_models.PolicyEvaluationOutcome"]] = rest_field( + name="evaluationOutcome", visibility=["read", "create", "update", "delete", "query"] + ) + """The evaluation outcome for this assignment. Known values are: \"Compliant\", \"NonCompliant\", + and \"Error\".""" + non_compliance_reason: Optional[str] = rest_field( + name="nonComplianceReason", visibility=["read", "create", "update", "delete", "query"] + ) + """The reason for non-compliance.""" + effect: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The policy effect (e.g., Deny, Audit).""" + expression_evaluations: Optional[list["_models.PolicyExpressionEvaluationDetails"]] = rest_field( + name="expressionEvaluations", visibility=["read", "create", "update", "delete", "query"] + ) + """Expression-level evaluation details.""" @overload def __init__( self, *, - category: Optional[Union[str, "_models.ConnectionCategory"]] = None, - error: Optional[str] = None, - expiry_time: Optional[datetime.datetime] = None, - is_shared_to_all: Optional[bool] = None, - metadata: Optional[dict[str, str]] = None, - pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, - pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, - shared_user_list: Optional[list[str]] = None, - target: Optional[str] = None, - use_workspace_managed_identity: Optional[bool] = None, - credentials: Optional["_models.ConnectionPersonalAccessToken"] = None, + assignment_id: Optional[str] = None, + policy_definition_id: Optional[str] = None, + policy_set_definition_id: Optional[str] = None, + evaluation_outcome: Optional[Union[str, "_models.PolicyEvaluationOutcome"]] = None, + non_compliance_reason: Optional[str] = None, + effect: Optional[str] = None, + expression_evaluations: Optional[list["_models.PolicyExpressionEvaluationDetails"]] = None, ) -> None: ... @overload @@ -6473,24 +7414,54 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.auth_type = ConnectionAuthType.PAT # type: ignore -class PatchResourceTags(_Model): - """The object being used to update tags of a resource, in general used for PATCH operations. +class PolicyExpressionEvaluationDetails(_Model): + """Details of a policy expression evaluation. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + :ivar expression: The policy expression. + :vartype expression: str + :ivar expression_kind: The kind of expression. + :vartype expression_kind: str + :ivar operator: The operator used in evaluation. + :vartype operator: str + :ivar result: The evaluation result. + :vartype result: str + :ivar target_value: The target value of the expression. + :vartype target_value: str + :ivar expression_value: The actual value of the expression. + :vartype expression_value: str """ - tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update"]) - """Resource tags.""" + expression: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The policy expression.""" + expression_kind: Optional[str] = rest_field( + name="expressionKind", visibility=["read", "create", "update", "delete", "query"] + ) + """The kind of expression.""" + operator: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The operator used in evaluation.""" + result: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The evaluation result.""" + target_value: Optional[str] = rest_field( + name="targetValue", visibility=["read", "create", "update", "delete", "query"] + ) + """The target value of the expression.""" + expression_value: Optional[str] = rest_field( + name="expressionValue", visibility=["read", "create", "update", "delete", "query"] + ) + """The actual value of the expression.""" @overload def __init__( self, *, - tags: Optional[dict[str, str]] = None, + expression: Optional[str] = None, + expression_kind: Optional[str] = None, + operator: Optional[str] = None, + result: Optional[str] = None, + target_value: Optional[str] = None, + expression_value: Optional[str] = None, ) -> None: ... @overload @@ -6504,25 +7475,39 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PatchResourceTagsAndSku(PatchResourceTags): - """The object being used to update tags and sku of a resource, in general used for PATCH - operations. +class Pool(_Model): + """A compute pool configuration. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar sku: The resource model definition representing SKU. - :vartype sku: ~azure.mgmt.cognitiveservices.models.Sku + :ivar name: The name of the pool. Required. + :vartype name: str + :ivar vm_priority: The VM priority of the pool. Required. Known values are: "Regular" and + "LowPriority". + :vartype vm_priority: str or ~azure.mgmt.cognitiveservices.models.VmPriority + :ivar instance_type: The instance type (VM SKU) used in the pool. Required. + :vartype instance_type: str + :ivar node_count: The number of nodes in the pool. Required. + :vartype node_count: int """ - sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The resource model definition representing SKU.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the pool. Required.""" + vm_priority: Union[str, "_models.VmPriority"] = rest_field( + name="vmPriority", visibility=["read", "create", "update", "delete", "query"] + ) + """The VM priority of the pool. Required. Known values are: \"Regular\" and \"LowPriority\".""" + instance_type: str = rest_field(name="instanceType", visibility=["read", "create", "update", "delete", "query"]) + """The instance type (VM SKU) used in the pool. Required.""" + node_count: int = rest_field(name="nodeCount", visibility=["read", "create", "update", "delete", "query"]) + """The number of nodes in the pool. Required.""" @overload def __init__( self, *, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, + name: str, + vm_priority: Union[str, "_models.VmPriority"], + instance_type: str, + node_count: int, ) -> None: ... @overload @@ -6936,7 +7921,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Project(Resource): +class Project(ProxyResource): """Cognitive Services project is an Azure resource representing the provisioned account's project, it's type, location and SKU. @@ -7715,116 +8700,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RaiExternalSafetyProvider(ProxyResource): - """Cognitive Services Rai External Safety provider. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData - :ivar etag: Resource Etag. - :vartype etag: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: Properties of Cognitive Services Rai External Safety provider. - :vartype properties: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderProperties - """ - - etag: Optional[str] = rest_field(visibility=["read"]) - """Resource Etag.""" - tags: Optional[dict[str, str]] = rest_field(visibility=["read"]) - """Resource tags.""" - properties: Optional["_models.RaiExternalSafetyProviderProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Properties of Cognitive Services Rai External Safety provider.""" - - @overload - def __init__( - self, - *, - properties: Optional["_models.RaiExternalSafetyProviderProperties"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class RaiExternalSafetyProviderProperties(_Model): - """RAI External SafetyProvider properties. - - :ivar provider_id: The unique identifier of the safety provider. - :vartype provider_id: str - :ivar provider_name: Name of the safety provider. - :vartype provider_name: str - :ivar mode: Safety provider mode sync/async. - :vartype mode: str - :ivar url: Webhook URL for the safety provider. - :vartype url: str - :ivar created_at: Creation time of the safety provider. - :vartype created_at: ~datetime.datetime - :ivar last_modified_at: Last modified time of the safety provider. - :vartype last_modified_at: ~datetime.datetime - """ - - provider_id: Optional[str] = rest_field( - name="providerId", visibility=["read", "create", "update", "delete", "query"] - ) - """The unique identifier of the safety provider.""" - provider_name: Optional[str] = rest_field( - name="providerName", visibility=["read", "create", "update", "delete", "query"] - ) - """Name of the safety provider.""" - mode: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Safety provider mode sync/async.""" - url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Webhook URL for the safety provider.""" - created_at: Optional[datetime.datetime] = rest_field( - name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """Creation time of the safety provider.""" - last_modified_at: Optional[datetime.datetime] = rest_field( - name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """Last modified time of the safety provider.""" - - @overload - def __init__( - self, - *, - provider_id: Optional[str] = None, - provider_name: Optional[str] = None, - mode: Optional[str] = None, - url: Optional[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_at: Optional[datetime.datetime] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - class RaiExternalSafetyProviderSchema(ProxyResource): """Cognitive Services Rai External Safety provider Schema. @@ -8121,8 +8996,6 @@ class RaiPolicyProperties(_Model): :vartype content_filters: list[~azure.mgmt.cognitiveservices.models.RaiPolicyContentFilter] :ivar custom_blocklists: The list of custom Blocklist. :vartype custom_blocklists: list[~azure.mgmt.cognitiveservices.models.CustomBlocklistConfig] - :ivar custom_topics: The list of custom rai topics. - :vartype custom_topics: list[~azure.mgmt.cognitiveservices.models.CustomTopicConfig] :ivar safety_providers: The list of Safety Providers. :vartype safety_providers: list[~azure.mgmt.cognitiveservices.models.SafetyProviderConfig] """ @@ -8148,10 +9021,6 @@ class RaiPolicyProperties(_Model): name="customBlocklists", visibility=["read", "create", "update", "delete", "query"] ) """The list of custom Blocklist.""" - custom_topics: Optional[list["_models.CustomTopicConfig"]] = rest_field( - name="customTopics", visibility=["read", "create", "update", "delete", "query"] - ) - """The list of custom rai topics.""" safety_providers: Optional[list["_models.SafetyProviderConfig"]] = rest_field( name="safetyProviders", visibility=["read", "create", "update", "delete", "query"] ) @@ -8165,7 +9034,6 @@ def __init__( base_policy_name: Optional[str] = None, content_filters: Optional[list["_models.RaiPolicyContentFilter"]] = None, custom_blocklists: Optional[list["_models.CustomBlocklistConfig"]] = None, - custom_topics: Optional[list["_models.CustomTopicConfig"]] = None, safety_providers: Optional[list["_models.SafetyProviderConfig"]] = None, ) -> None: ... @@ -9422,6 +10290,43 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class SshSettings(_Model): + """SSH configuration for a Container Instance compute. + + :ivar ssh_public_key: The SSH public key for authenticating to the compute instance. + :vartype ssh_public_key: str + :ivar admin_enabled: Whether SSH admin access is enabled. + :vartype admin_enabled: bool + """ + + ssh_public_key: Optional[str] = rest_field( + name="sshPublicKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The SSH public key for authenticating to the compute instance.""" + admin_enabled: Optional[bool] = rest_field( + name="adminEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether SSH admin access is enabled.""" + + @overload + def __init__( + self, + *, + ssh_public_key: Optional[str] = None, + admin_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class SystemData(_Model): """Metadata pertaining to creation and last modification of the resource. @@ -9970,3 +10875,148 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + + +class Workbench(ProxyResource): + """Workbench resource under a Cognitive Services project. Provides interactive compute with data + access for AI development. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar properties: Properties of the workbench resource. Required. + :vartype properties: ~azure.mgmt.cognitiveservices.models.WorkbenchProperties + :ivar etag: Resource Etag. + :vartype etag: str + :ivar location: The location of the workbench resource. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cognitiveservices.models.Identity + """ + + properties: "_models.WorkbenchProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Properties of the workbench resource. Required.""" + etag: Optional[str] = rest_field(visibility=["read"]) + """Resource Etag.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The location of the workbench resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + identity: Optional["_models.Identity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Identity for the resource.""" + + @overload + def __init__( + self, + *, + properties: "_models.WorkbenchProperties", + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.Identity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkbenchProperties(_Model): + """Properties for a Workbench resource. + + :ivar target_cluster_id: ARM resource ID of the parent cluster that hosts this workbench. + Required. + :vartype target_cluster_id: str + :ivar image_link: Container image URI (e.g., MCR or ACR image path) for the workbench. + Required. + :vartype image_link: str + :ivar idle_time_before_shutdown: ISO 8601 duration before the idle workbench is automatically + shut down (e.g., 'PT30M'). + :vartype idle_time_before_shutdown: str + :ivar dataset_id: The dataset ID to mount for the workbench. + :vartype dataset_id: str + :ivar ssh_settings: SSH configuration for remote access to the workbench. + :vartype ssh_settings: ~azure.mgmt.cognitiveservices.models.SshSettings + :ivar connectivity_endpoints: Network connectivity endpoints assigned to the workbench. + :vartype connectivity_endpoints: ~azure.mgmt.cognitiveservices.models.ConnectivityEndpoints + :ivar web_endpoint: The web endpoint URL for accessing the workbench. + :vartype web_endpoint: str + :ivar provisioning_state: Provisioning state of the workbench resource. Known values are: + "Accepted", "Succeeded", "Failed", "Canceled", "Deleting", "Scaling", "Disabled", "Starting", + "Stopping", "Restarting", and "Stopped". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.ComputeProvisioningState + :ivar errors: Error details for the workbench resource. + :vartype errors: list[~azure.mgmt.cognitiveservices.models.ErrorDetail] + :ivar creation_time: Creation time of the workbench resource. + :vartype creation_time: ~datetime.datetime + """ + + target_cluster_id: str = rest_field( + name="targetClusterId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM resource ID of the parent cluster that hosts this workbench. Required.""" + image_link: str = rest_field(name="imageLink", visibility=["read", "create", "update", "delete", "query"]) + """Container image URI (e.g., MCR or ACR image path) for the workbench. Required.""" + idle_time_before_shutdown: Optional[str] = rest_field( + name="idleTimeBeforeShutdown", visibility=["read", "create", "update", "delete", "query"] + ) + """ISO 8601 duration before the idle workbench is automatically shut down (e.g., 'PT30M').""" + dataset_id: Optional[str] = rest_field(name="datasetId", visibility=["read", "create", "update", "delete", "query"]) + """The dataset ID to mount for the workbench.""" + ssh_settings: Optional["_models.SshSettings"] = rest_field( + name="sshSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """SSH configuration for remote access to the workbench.""" + connectivity_endpoints: Optional["_models.ConnectivityEndpoints"] = rest_field( + name="connectivityEndpoints", visibility=["read"] + ) + """Network connectivity endpoints assigned to the workbench.""" + web_endpoint: Optional[str] = rest_field(name="webEndpoint", visibility=["read"]) + """The web endpoint URL for accessing the workbench.""" + provisioning_state: Optional[Union[str, "_models.ComputeProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the workbench resource. Known values are: \"Accepted\", \"Succeeded\", + \"Failed\", \"Canceled\", \"Deleting\", \"Scaling\", \"Disabled\", \"Starting\", \"Stopping\", + \"Restarting\", and \"Stopped\".""" + errors: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """Error details for the workbench resource.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Creation time of the workbench resource.""" + + @overload + def __init__( + self, + *, + target_cluster_id: str, + image_link: str, + idle_time_before_shutdown: Optional[str] = None, + dataset_id: Optional[str] = None, + ssh_settings: Optional["_models.SshSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_patch.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_patch.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py index 7610047333eb..27f40ab3440c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py @@ -34,7 +34,12 @@ from ._operations import ProjectCapabilityHostsOperations # type: ignore from ._operations import QuotaTiersOperations # type: ignore from ._operations import AgentApplicationsOperations # type: ignore +from ._operations import ManagedComputeDeploymentsOperations # type: ignore from ._operations import ComputeOperationsOperations # type: ignore +from ._operations import ManagedComputeUsagesOperationGroupOperations # type: ignore +from ._operations import ComputesOperations # type: ignore +from ._operations import WorkbenchesOperations # type: ignore +from ._operations import ManagedComputeCapacitiesOperations # type: ignore from ._operations import PrivateLinkResourcesOperations # type: ignore from ._operations import TestRaiExternalSafetyProviderOperations # type: ignore from ._operations import RaiExternalSafetyProviderOperations # type: ignore @@ -80,7 +85,12 @@ "ProjectCapabilityHostsOperations", "QuotaTiersOperations", "AgentApplicationsOperations", + "ManagedComputeDeploymentsOperations", "ComputeOperationsOperations", + "ManagedComputeUsagesOperationGroupOperations", + "ComputesOperations", + "WorkbenchesOperations", + "ManagedComputeCapacitiesOperations", "PrivateLinkResourcesOperations", "TestRaiExternalSafetyProviderOperations", "RaiExternalSafetyProviderOperations", diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py index 4fe9214f26ce..2770ed8380c9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py @@ -52,7 +52,7 @@ def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +73,7 @@ def build_accounts_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +102,7 @@ def build_accounts_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +133,7 @@ def build_accounts_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +162,7 @@ def build_accounts_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}" path_format_arguments = { @@ -185,7 +185,7 @@ def build_accounts_list_by_resource_group_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +210,7 @@ def build_accounts_list_request(subscription_id: str, **kwargs: Any) -> HttpRequ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +236,7 @@ def build_accounts_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -265,7 +265,7 @@ def build_accounts_regenerate_key_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -295,7 +295,7 @@ def build_accounts_list_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -323,7 +323,7 @@ def build_accounts_list_usages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -353,7 +353,7 @@ def build_accounts_list_models_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -375,20 +375,20 @@ def build_accounts_list_models_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_deleted_accounts_get_request( - location: str, resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +def build_accounts_evaluate_deployment_policies_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/evaluateDeploymentPolicies" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), } @@ -399,24 +399,24 @@ def build_deleted_accounts_get_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_deleted_accounts_purge_request( - location: str, resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_deleted_accounts_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -424,20 +424,28 @@ def build_deleted_accounts_purge_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_deleted_accounts_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_deleted_accounts_get_request( + location: str, resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -451,6 +459,29 @@ def build_deleted_accounts_list_request(subscription_id: str, **kwargs: Any) -> return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_deleted_accounts_purge_request( + location: str, resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + def build_private_endpoint_connections_get_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, @@ -461,7 +492,7 @@ def build_private_endpoint_connections_get_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -497,7 +528,7 @@ def build_private_endpoint_connections_create_or_update_request( # pylint: disa _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -533,7 +564,7 @@ def build_private_endpoint_connections_delete_request( # pylint: disable=name-t ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" path_format_arguments = { @@ -559,7 +590,7 @@ def build_private_endpoint_connections_list_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -587,7 +618,7 @@ def build_deployments_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -617,7 +648,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -649,7 +680,7 @@ def build_deployments_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -679,7 +710,7 @@ def build_deployments_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}" path_format_arguments = { @@ -703,7 +734,7 @@ def build_deployments_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -731,7 +762,7 @@ def build_deployments_list_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -760,7 +791,7 @@ def build_deployments_pause_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -789,7 +820,7 @@ def build_deployments_resume_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -818,7 +849,7 @@ def build_commitment_plans_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -848,7 +879,7 @@ def build_commitment_plans_create_or_update_request( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -878,7 +909,7 @@ def build_commitment_plans_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}" path_format_arguments = { @@ -902,7 +933,7 @@ def build_commitment_plans_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -930,7 +961,7 @@ def build_commitment_plans_get_plan_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -959,7 +990,7 @@ def build_commitment_plans_create_or_update_plan_request( # pylint: disable=nam _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -990,7 +1021,7 @@ def build_commitment_plans_update_plan_request( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1019,7 +1050,7 @@ def build_commitment_plans_delete_plan_request( # pylint: disable=name-too-long ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}" path_format_arguments = { @@ -1042,7 +1073,7 @@ def build_commitment_plans_list_plans_by_resource_group_request( # pylint: disa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1069,7 +1100,7 @@ def build_commitment_plans_list_plans_by_subscription_request( # pylint: disabl _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1099,7 +1130,7 @@ def build_commitment_plans_get_association_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1135,7 +1166,7 @@ def build_commitment_plans_create_or_update_association_request( # pylint: disa _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1171,7 +1202,7 @@ def build_commitment_plans_delete_association_request( # pylint: disable=name-t ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName}" path_format_arguments = { @@ -1197,7 +1228,7 @@ def build_commitment_plans_list_associations_request( # pylint: disable=name-to _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1225,7 +1256,7 @@ def build_encryption_scopes_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1255,7 +1286,7 @@ def build_encryption_scopes_create_or_update_request( # pylint: disable=name-to _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1285,7 +1316,7 @@ def build_encryption_scopes_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}" path_format_arguments = { @@ -1309,7 +1340,7 @@ def build_encryption_scopes_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1337,7 +1368,7 @@ def build_rai_policies_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1367,7 +1398,7 @@ def build_rai_policies_create_or_update_request( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1397,7 +1428,7 @@ def build_rai_policies_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}" path_format_arguments = { @@ -1421,7 +1452,7 @@ def build_rai_policies_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1449,7 +1480,7 @@ def build_subscription_rai_policy_get_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1477,7 +1508,7 @@ def build_subscription_rai_policy_create_or_update_request( # pylint: disable=n _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1505,7 +1536,7 @@ def build_subscription_rai_policy_delete_request( # pylint: disable=name-too-lo ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/raiPolicy/{raiPolicyName}" path_format_arguments = { @@ -1532,7 +1563,7 @@ def build_rai_blocklist_items_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1568,7 +1599,7 @@ def build_rai_blocklist_items_create_or_update_request( # pylint: disable=name- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1604,7 +1635,7 @@ def build_rai_blocklist_items_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}" path_format_arguments = { @@ -1629,7 +1660,7 @@ def build_rai_blocklist_items_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1659,7 +1690,7 @@ def build_rai_blocklist_items_batch_add_request( # pylint: disable=name-too-lon _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1691,7 +1722,7 @@ def build_rai_blocklist_items_batch_delete_request( # pylint: disable=name-too- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems" path_format_arguments = { @@ -1719,7 +1750,7 @@ def build_rai_blocklists_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1749,7 +1780,7 @@ def build_rai_blocklists_create_or_update_request( # pylint: disable=name-too-l _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1779,7 +1810,7 @@ def build_rai_blocklists_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}" path_format_arguments = { @@ -1803,7 +1834,7 @@ def build_rai_blocklists_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1831,7 +1862,7 @@ def build_rai_topics_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1861,7 +1892,7 @@ def build_rai_topics_create_or_update_request( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1891,7 +1922,7 @@ def build_rai_topics_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raitopics/{raiTopicName}" path_format_arguments = { @@ -1915,7 +1946,7 @@ def build_rai_topics_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1943,7 +1974,7 @@ def build_rai_tool_labels_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1973,7 +2004,7 @@ def build_rai_tool_labels_create_or_update_request( # pylint: disable=name-too- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2003,7 +2034,7 @@ def build_rai_tool_labels_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiToolLabels/{raiToolConnectionName}" path_format_arguments = { @@ -2027,7 +2058,7 @@ def build_rai_tool_labels_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2055,7 +2086,7 @@ def build_rai_content_filters_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2081,7 +2112,7 @@ def build_rai_content_filters_list_request(location: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2110,7 +2141,7 @@ def build_network_security_perimeter_configurations_get_request( # pylint: disa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2139,7 +2170,7 @@ def build_network_security_perimeter_configurations_list_request( # pylint: dis _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2167,7 +2198,7 @@ def build_network_security_perimeter_configurations_reconcile_request( # pylint _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2196,7 +2227,7 @@ def build_defender_for_ai_settings_get_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2228,7 +2259,7 @@ def build_defender_for_ai_settings_create_or_update_request( # pylint: disable= _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2262,7 +2293,7 @@ def build_defender_for_ai_settings_update_request( # pylint: disable=name-too-l _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2295,7 +2326,7 @@ def build_defender_for_ai_settings_list_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2323,7 +2354,7 @@ def build_projects_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2353,7 +2384,7 @@ def build_projects_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2385,7 +2416,7 @@ def build_projects_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2415,7 +2446,7 @@ def build_projects_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}" path_format_arguments = { @@ -2439,7 +2470,7 @@ def build_projects_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2472,7 +2503,7 @@ def build_project_connections_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2508,7 +2539,7 @@ def build_project_connections_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2546,7 +2577,7 @@ def build_project_connections_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2582,7 +2613,7 @@ def build_project_connections_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}" path_format_arguments = { @@ -2615,7 +2646,7 @@ def build_project_connections_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2655,7 +2686,7 @@ def build_project_capability_hosts_get_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2691,7 +2722,7 @@ def build_project_capability_hosts_create_or_update_request( # pylint: disable= _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2727,7 +2758,7 @@ def build_project_capability_hosts_delete_request( # pylint: disable=name-too-l ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/capabilityHosts/{capabilityHostName}" path_format_arguments = { @@ -2752,7 +2783,7 @@ def build_project_capability_hosts_list_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2779,7 +2810,7 @@ def build_quota_tiers_get_request(default: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2807,7 +2838,7 @@ def build_quota_tiers_create_or_update_request( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2835,7 +2866,7 @@ def build_quota_tiers_update_request(default: str, subscription_id: str, **kwarg _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2864,7 +2895,7 @@ def build_quota_tiers_list_by_subscription_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2890,7 +2921,7 @@ def build_agent_applications_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2921,7 +2952,7 @@ def build_agent_applications_create_or_update_request( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2952,7 +2983,7 @@ def build_agent_applications_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{name}" path_format_arguments = { @@ -2989,7 +3020,7 @@ def build_agent_applications_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3032,7 +3063,7 @@ def build_agent_applications_list_agents_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3061,7 +3092,7 @@ def build_agent_applications_enable_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{name}/enable" path_format_arguments = { @@ -3085,7 +3116,7 @@ def build_agent_applications_disable_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{name}/disable" path_format_arguments = { @@ -3104,21 +3135,22 @@ def build_agent_applications_disable_request( return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_compute_operations_get_request( - location: str, operation_id: str, subscription_id: str, **kwargs: Any +def build_managed_compute_deployments_get_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/computeOperations/{operationId}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedComputeDeployments/{deploymentName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3132,21 +3164,23 @@ def build_compute_operations_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_private_link_resources_list_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +def build_managed_compute_deployments_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateLinkResources" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedComputeDeployments/{deploymentName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3155,28 +3189,30 @@ def build_private_link_resources_list_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_test_rai_external_safety_provider_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, safety_provider_name: str, subscription_id: str, **kwargs: Any +def build_managed_compute_deployments_update_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/testRaiExternalSafetyProvider/{safetyProviderName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedComputeDeployments/{deploymentName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "safetyProviderName": _SERIALIZER.url("safety_provider_name", safety_provider_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3189,23 +3225,22 @@ def build_test_rai_external_safety_provider_create_or_update_request( # pylint: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_rai_external_safety_provider_get_request( # pylint: disable=name-too-long - safety_provider_name: str, subscription_id: str, **kwargs: Any +def build_managed_compute_deployments_delete_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, deployment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/raiExternalSafetyProviders/{safetyProviderName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedComputeDeployments/{deploymentName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "safetyProviderName": _SERIALIZER.url("safety_provider_name", safety_provider_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3213,27 +3248,24 @@ def build_rai_external_safety_provider_get_request( # pylint: disable=name-too- # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_rai_external_safety_provider_create_or_update_request( # pylint: disable=name-too-long - safety_provider_name: str, subscription_id: str, **kwargs: Any +def build_managed_compute_deployments_list_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/raiExternalSafetyProviders/{safetyProviderName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedComputeDeployments" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "safetyProviderName": _SERIALIZER.url("safety_provider_name", safety_provider_name, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3242,24 +3274,26 @@ def build_rai_external_safety_provider_create_or_update_request( # pylint: disa _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_rai_external_safety_provider_delete_request( # pylint: disable=name-too-long - safety_provider_name: str, subscription_id: str, **kwargs: Any +def build_compute_operations_get_request( + location: str, operation_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/raiExternalSafetyProviders/{safetyProviderName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/computeOperations/{operationId}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "safetyProviderName": _SERIALIZER.url("safety_provider_name", safety_provider_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3267,22 +3301,26 @@ def build_rai_external_safety_provider_delete_request( # pylint: disable=name-t # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_rai_external_safety_providers_list_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any + +def build_managed_compute_usages_operation_group_list_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/raiExternalSafetyProviders" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/managedComputeUsages" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3296,22 +3334,22 @@ def build_rai_external_safety_providers_list_request( # pylint: disable=name-to return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_account_connections_get_request( - resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +def build_computes_get_request( + resource_group_name: str, account_name: str, compute_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3325,23 +3363,23 @@ def build_account_connections_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_account_connections_create_request( - resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +def build_computes_create_or_update_request( + resource_group_name: str, account_name: str, compute_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3357,23 +3395,23 @@ def build_account_connections_create_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_account_connections_update_request( - resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +def build_computes_update_request( + resource_group_name: str, account_name: str, compute_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3389,19 +3427,19 @@ def build_account_connections_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_account_connections_delete_request( - resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +def build_computes_delete_request( + resource_group_name: str, account_name: str, compute_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3412,24 +3450,17 @@ def build_account_connections_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_account_connections_list_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - *, - target: Optional[str] = None, - category: Optional[str] = None, - include_all: bool = False, - **kwargs: Any +def build_computes_list_request( + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -3440,12 +3471,6 @@ def build_account_connections_list_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if target is not None: - _params["target"] = _SERIALIZER.query("target", target, "str") - if category is not None: - _params["category"] = _SERIALIZER.query("category", category, "str") - if include_all is not None: - _params["includeAll"] = _SERIALIZER.query("include_all", include_all, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -3453,22 +3478,19 @@ def build_account_connections_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_account_capability_hosts_get_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, capability_host_name: str, subscription_id: str, **kwargs: Any +def build_computes_start_request( + resource_group_name: str, account_name: str, compute_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}/start" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "capabilityHostName": _SERIALIZER.url("capability_host_name", capability_host_name, "str"), + "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3476,29 +3498,22 @@ def build_account_capability_hosts_get_request( # pylint: disable=name-too-long # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_account_capability_hosts_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, capability_host_name: str, subscription_id: str, **kwargs: Any +def build_computes_stop_request( + resource_group_name: str, account_name: str, compute_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}/stop" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "capabilityHostName": _SERIALIZER.url("capability_host_name", capability_host_name, "str"), + "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3506,27 +3521,22 @@ def build_account_capability_hosts_create_or_update_request( # pylint: disable= # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_account_capability_hosts_delete_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, capability_host_name: str, subscription_id: str, **kwargs: Any +def build_computes_restart_request( + resource_group_name: str, account_name: str, compute_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/computes/{computeName}/restart" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "capabilityHostName": _SERIALIZER.url("capability_host_name", capability_host_name, "str"), + "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3534,24 +3544,31 @@ def build_account_capability_hosts_delete_request( # pylint: disable=name-too-l # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_account_capability_hosts_list_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +def build_workbenches_get_request( + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "workbenchName": _SERIALIZER.url("workbench_name", workbench_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3565,28 +3582,29 @@ def build_account_capability_hosts_list_request( # pylint: disable=name-too-lon return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_outbound_rule_get_request( +def build_workbenches_create_or_update_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, - managed_network_name: str, - rule_name: str, + project_name: str, + workbench_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/outboundRules/{ruleName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), - "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "workbenchName": _SERIALIZER.url("workbench_name", workbench_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3595,16 +3613,18 @@ def build_outbound_rule_get_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_outbound_rule_create_or_update_request( # pylint: disable=name-too-long +def build_workbenches_update_request( resource_group_name: str, account_name: str, - managed_network_name: str, - rule_name: str, + project_name: str, + workbench_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: @@ -3612,17 +3632,17 @@ def build_outbound_rule_create_or_update_request( # pylint: disable=name-too-lo _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/outboundRules/{ruleName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), - "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "workbenchName": _SERIALIZER.url("workbench_name", workbench_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3635,28 +3655,28 @@ def build_outbound_rule_create_or_update_request( # pylint: disable=name-too-lo _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_outbound_rule_delete_request( +def build_workbenches_delete_request( resource_group_name: str, account_name: str, - managed_network_name: str, - rule_name: str, + project_name: str, + workbench_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/outboundRules/{ruleName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), - "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "workbenchName": _SERIALIZER.url("workbench_name", workbench_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3667,22 +3687,22 @@ def build_outbound_rule_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_outbound_rule_list_request( - resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any +def build_workbenches_list_request( + resource_group_name: str, account_name: str, project_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/outboundRules" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3696,52 +3716,25 @@ def build_outbound_rule_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_managed_network_settings_get_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any +def build_workbenches_start_request( + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_managed_network_settings_put_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}/start" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "workbenchName": _SERIALIZER.url("workbench_name", workbench_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3749,31 +3742,28 @@ def build_managed_network_settings_put_request( # pylint: disable=name-too-long # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_managed_network_settings_patch_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any +def build_workbenches_stop_request( + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}/stop" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "workbenchName": _SERIALIZER.url("workbench_name", workbench_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3781,27 +3771,28 @@ def build_managed_network_settings_patch_request( # pylint: disable=name-too-lo # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_managed_network_settings_delete_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any +def build_workbenches_restart_request( + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/workbenches/{workbenchName}/restart" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "workbenchName": _SERIALIZER.url("workbench_name", workbench_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3809,30 +3800,38 @@ def build_managed_network_settings_delete_request( # pylint: disable=name-too-l # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_managed_network_settings_list_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +def build_managed_compute_capacities_list_request( # pylint: disable=name-too-long + subscription_id: str, + *, + offer: str, + accelerator_type: Optional[str] = None, + deployment_id: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/managedComputeCapacities" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["offer"] = _SERIALIZER.query("offer", offer, "str") + if accelerator_type is not None: + _params["acceleratorType"] = _SERIALIZER.query("accelerator_type", accelerator_type, "str") + if deployment_id is not None: + _params["deploymentId"] = _SERIALIZER.query("deployment_id", deployment_id, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -3840,23 +3839,21 @@ def build_managed_network_settings_list_request( # pylint: disable=name-too-lon return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_outbound_rules_post_request( - resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any +def build_private_link_resources_list_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/batchOutboundRules" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateLinkResources" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3865,30 +3862,28 @@ def build_outbound_rules_post_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_managed_network_provisions_provision_managed_network_request( # pylint: disable=name-too-long - resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any +def build_test_rai_external_safety_provider_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, safety_provider_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/provision" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/testRaiExternalSafetyProvider/{safetyProviderName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + "safetyProviderName": _SERIALIZER.url("safety_provider_name", safety_provider_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3901,33 +3896,23 @@ def build_managed_network_provisions_provision_managed_network_request( # pylin _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_agent_deployments_get_request( - resource_group_name: str, - account_name: str, - project_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any +def build_rai_external_safety_provider_get_request( # pylint: disable=name-too-long + safety_provider_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments/{deploymentName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/raiExternalSafetyProviders/{safetyProviderName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "projectName": _SERIALIZER.url("project_name", project_name, "str"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "safetyProviderName": _SERIALIZER.url("safety_provider_name", safety_provider_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3941,31 +3926,21 @@ def build_agent_deployments_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_agent_deployments_create_or_update_request( # pylint: disable=name-too-long - resource_group_name: str, - account_name: str, - project_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any +def build_rai_external_safety_provider_create_or_update_request( # pylint: disable=name-too-long + safety_provider_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments/{deploymentName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/raiExternalSafetyProviders/{safetyProviderName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "projectName": _SERIALIZER.url("project_name", project_name, "str"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "safetyProviderName": _SERIALIZER.url("safety_provider_name", safety_provider_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3981,27 +3956,17 @@ def build_agent_deployments_create_or_update_request( # pylint: disable=name-to return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_agent_deployments_delete_request( - resource_group_name: str, - account_name: str, - project_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any +def build_rai_external_safety_provider_delete_request( # pylint: disable=name-too-long + safety_provider_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments/{deploymentName}" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/raiExternalSafetyProviders/{safetyProviderName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "projectName": _SERIALIZER.url("project_name", project_name, "str"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "safetyProviderName": _SERIALIZER.url("safety_provider_name", safety_provider_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4012,50 +3977,25 @@ def build_agent_deployments_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) -def build_agent_deployments_list_request( - resource_group_name: str, - account_name: str, - project_name: str, - app_name: str, - subscription_id: str, - *, - count: int = 30, - skip_token: Optional[str] = None, - names: Optional[List[str]] = None, - order_by: Optional[str] = None, - order_by_asc: bool = False, - **kwargs: Any +def build_rai_external_safety_providers_list_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments" + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/raiExternalSafetyProviders" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "projectName": _SERIALIZER.url("project_name", project_name, "str"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if count is not None: - _params["count"] = _SERIALIZER.query("count", count, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") - if names is not None: - _params["names"] = [_SERIALIZER.query("names", q, "str") if q is not None else "" for q in names] - if order_by is not None: - _params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str") - if order_by_asc is not None: - _params["orderByAsc"] = _SERIALIZER.query("order_by_asc", order_by_asc, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4063,27 +4003,22 @@ def build_agent_deployments_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_agent_deployments_start_request( - resource_group_name: str, - account_name: str, - project_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any +def build_account_connections_get_request( + resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments/{deploymentName}/start" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "projectName": _SERIALIZER.url("project_name", project_name, "str"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4091,30 +4026,29 @@ def build_agent_deployments_start_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_agent_deployments_stop_request( - resource_group_name: str, - account_name: str, - project_name: str, - app_name: str, - deployment_name: str, - subscription_id: str, - **kwargs: Any + +def build_account_connections_create_request( + resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments/{deploymentName}/stop" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "accountName": _SERIALIZER.url("account_name", account_name, "str"), - "projectName": _SERIALIZER.url("project_name", project_name, "str"), - "appName": _SERIALIZER.url("app_name", app_name, "str"), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4122,20 +4056,31 @@ def build_agent_deployments_stop_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_resource_skus_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_account_connections_update_request( + resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/skus" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4144,33 +4089,70 @@ def build_resource_skus_list_request(subscription_id: str, **kwargs: Any) -> Htt _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_usages_list_request( - location: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_account_connections_delete_request( + resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_account_connections_list_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/usages" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if target is not None: + _params["target"] = _SERIALIZER.query("target", target, "str") + if category is not None: + _params["category"] = _SERIALIZER.query("category", category, "str") + if include_all is not None: + _params["includeAll"] = _SERIALIZER.query("include_all", include_all, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4178,18 +4160,22 @@ def build_usages_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_commitment_tiers_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_account_capability_hosts_get_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, capability_host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/commitmentTiers" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "capabilityHostName": _SERIALIZER.url("capability_host_name", capability_host_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4203,18 +4189,23 @@ def build_commitment_tiers_list_request(location: str, subscription_id: str, **k return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_models_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_account_capability_hosts_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, capability_host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/models" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "capabilityHostName": _SERIALIZER.url("capability_host_name", capability_host_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4223,34 +4214,57 @@ def build_models_list_request(location: str, subscription_id: str, **kwargs: Any _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_location_based_model_capacities_list_request( # pylint: disable=name-too-long - location: str, subscription_id: str, *, model_format: str, model_name: str, model_version: str, **kwargs: Any +def build_account_capability_hosts_delete_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, capability_host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "capabilityHostName": _SERIALIZER.url("capability_host_name", capability_host_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_account_capability_hosts_list_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/modelCapacities" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _params["modelFormat"] = _SERIALIZER.query("model_format", model_format, "str") - _params["modelName"] = _SERIALIZER.query("model_name", model_name, "str") - _params["modelVersion"] = _SERIALIZER.query("model_version", model_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4258,28 +4272,34 @@ def build_location_based_model_capacities_list_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_model_capacities_list_request( - subscription_id: str, *, model_format: str, model_name: str, model_version: str, **kwargs: Any +def build_outbound_rule_get_request( + resource_group_name: str, + account_name: str, + managed_network_name: str, + rule_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/modelCapacities" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/outboundRules/{ruleName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _params["modelFormat"] = _SERIALIZER.query("model_format", model_format, "str") - _params["modelName"] = _SERIALIZER.query("model_name", model_name, "str") - _params["modelVersion"] = _SERIALIZER.query("model_version", model_version, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4287,21 +4307,29 @@ def build_model_capacities_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_cognitive_services_management_check_sku_availability_request( # pylint: disable=name-too-long - location: str, subscription_id: str, **kwargs: Any +def build_outbound_rule_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + account_name: str, + managed_network_name: str, + rule_name: str, + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/outboundRules/{ruleName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4314,23 +4342,54 @@ def build_cognitive_services_management_check_sku_availability_request( # pylin _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_cognitive_services_management_check_domain_availability_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any +def build_outbound_rule_delete_request( + resource_group_name: str, + account_name: str, + managed_network_name: str, + rule_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/outboundRules/{ruleName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_outbound_rule_list_request( + resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/outboundRules" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4339,27 +4398,27 @@ def build_cognitive_services_management_check_domain_availability_request( # py _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_cognitive_services_management_calculate_model_capacity_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any +def build_managed_network_settings_get_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-01-15-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/calculateModelCapacity" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4368,264 +4427,2548 @@ def build_cognitive_services_management_calculate_model_capacity_request( # pyl _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. +def build_managed_network_settings_put_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`operations` attribute. - """ + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + } - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: - """Lists all the available Cognitive Services account operations. + _url: str = _url.format(**path_format_arguments) # type: ignore - :return: An iterator like instance of Operation - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - def prepare_request(next_link=None): - if not next_link: - _request = build_operations_list_request( - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) +def build_managed_network_settings_patch_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - return _request + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Operation], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + } - def get_next(next_link=None): - _request = prepare_request(next_link) + _url: str = _url.format(**path_format_arguments) # type: ignore - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return pipeline_response + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - return ItemPaged(get_next, extract_data) +def build_managed_network_settings_delete_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -class AccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + } - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`accounts` attribute. - """ + _url: str = _url.format(**path_format_arguments) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - @distributed_trace - def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.Account: - """Returns a Cognitive Services account specified by the parameters. + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :return: Account. The Account is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.Account - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} +def build_managed_network_settings_list_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - cls: ClsType[_models.Account] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") - _request = build_accounts_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + _url: str = _url.format(**path_format_arguments) # type: ignore - response = pipeline_response.http_response + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Account, response.json()) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized # type: ignore +def build_outbound_rules_post_request( + resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - def _create_initial( - self, - resource_group_name: str, - account_name: str, - account: Union[_models.Account, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/batchOutboundRules" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + } - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _url: str = _url.format(**path_format_arguments) # type: ignore - content_type = content_type or "application/json" - _content = None - if isinstance(account, (IOBase, bytes)): - _content = account - else: - _content = json.dumps(account, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _request = build_accounts_create_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: - try: +def build_managed_network_provisions_provision_managed_network_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, managed_network_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/managedNetworks/{managedNetworkName}/provision" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "managedNetworkName": _SERIALIZER.url("managed_network_name", managed_network_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_agent_deployments_get_request( + resource_group_name: str, + account_name: str, + project_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments/{deploymentName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_agent_deployments_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + account_name: str, + project_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments/{deploymentName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_agent_deployments_delete_request( + resource_group_name: str, + account_name: str, + project_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments/{deploymentName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_agent_deployments_list_request( + resource_group_name: str, + account_name: str, + project_name: str, + app_name: str, + subscription_id: str, + *, + count: int = 30, + skip_token: Optional[str] = None, + names: Optional[List[str]] = None, + order_by: Optional[str] = None, + order_by_asc: bool = False, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if count is not None: + _params["count"] = _SERIALIZER.query("count", count, "int") + if skip_token is not None: + _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "str") + if names is not None: + _params["names"] = [_SERIALIZER.query("names", q, "str") if q is not None else "" for q in names] + if order_by is not None: + _params["orderBy"] = _SERIALIZER.query("order_by", order_by, "str") + if order_by_asc is not None: + _params["orderByAsc"] = _SERIALIZER.query("order_by_asc", order_by_asc, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_agent_deployments_start_request( + resource_group_name: str, + account_name: str, + project_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments/{deploymentName}/start" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_agent_deployments_stop_request( + resource_group_name: str, + account_name: str, + project_name: str, + app_name: str, + deployment_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/applications/{appName}/agentDeployments/{deploymentName}/stop" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "projectName": _SERIALIZER.url("project_name", project_name, "str"), + "appName": _SERIALIZER.url("app_name", app_name, "str"), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_resource_skus_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/skus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_usages_list_request( + location: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/usages" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_commitment_tiers_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/commitmentTiers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_models_list_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/models" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_location_based_model_capacities_list_request( # pylint: disable=name-too-long + location: str, subscription_id: str, *, model_format: str, model_name: str, model_version: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/modelCapacities" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["modelFormat"] = _SERIALIZER.query("model_format", model_format, "str") + _params["modelName"] = _SERIALIZER.query("model_name", model_name, "str") + _params["modelVersion"] = _SERIALIZER.query("model_version", model_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_model_capacities_list_request( + subscription_id: str, *, model_format: str, model_name: str, model_version: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/modelCapacities" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["modelFormat"] = _SERIALIZER.query("model_format", model_format, "str") + _params["modelName"] = _SERIALIZER.query("model_name", model_name, "str") + _params["modelVersion"] = _SERIALIZER.query("model_version", model_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cognitive_services_management_check_sku_availability_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cognitive_services_management_check_domain_availability_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cognitive_services_management_calculate_model_capacity_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/calculateModelCapacity" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """Lists all the available Cognitive Services account operations. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class AccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`accounts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.Account: + """Returns a Cognitive Services account specified by the parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: Account. The Account is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.Account + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Account] = kwargs.pop("cls", None) + + _request = build_accounts_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Account, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + account_name: str, + account: Union[_models.Account, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(account, (IOBase, bytes)): + _content = account + else: + _content = json.dumps(account, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_accounts_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + account_name: str, + account: _models.Account, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Account]: + """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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param account: The parameters to provide for the created account. Required. + :type account: ~azure.mgmt.cognitiveservices.models.Account + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Account. The Account is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + account_name: str, + account: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Account]: + """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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param account: The parameters to provide for the created account. Required. + :type account: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Account. The Account is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + account_name: str, + account: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Account]: + """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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param account: The parameters to provide for the created account. Required. + :type account: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Account. The Account is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + account_name: str, + account: Union[_models.Account, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Account]: + """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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param account: The parameters to provide for the created account. Is one of the following + types: Account, JSON, IO[bytes] Required. + :type account: ~azure.mgmt.cognitiveservices.models.Account or JSON or IO[bytes] + :return: An instance of LROPoller that returns Account. The Account is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Account] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + account=account, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Account, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Account].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Account]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + account_name: str, + account: Union[_models.Account, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(account, (IOBase, bytes)): + _content = account + else: + _content = json.dumps(account, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_accounts_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + account_name: str, + account: _models.Account, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Account]: + """Updates a Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param account: The parameters to provide for the created account. Required. + :type account: ~azure.mgmt.cognitiveservices.models.Account + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Account. The Account is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + account_name: str, + account: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Account]: + """Updates a Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param account: The parameters to provide for the created account. Required. + :type account: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Account. The Account is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + account_name: str, + account: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Account]: + """Updates a Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param account: The parameters to provide for the created account. Required. + :type account: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Account. The Account is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + account_name: str, + account: Union[_models.Account, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Account]: + """Updates a Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param account: The parameters to provide for the created account. Is one of the following + types: Account, JSON, IO[bytes] Required. + :type account: ~azure.mgmt.cognitiveservices.models.Account or JSON or IO[bytes] + :return: An instance of LROPoller that returns Account. The Account is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Account] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + account=account, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Account, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Account].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Account]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_accounts_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a Cognitive Services account from the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Account"]: + """Returns all the resources of a particular type belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Account + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Account]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_accounts_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Account], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Account"]: + """Returns all the resources of a particular type belonging to a subscription. + + :return: An iterator like instance of Account + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Account]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_accounts_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Account], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.ApiKeys: + """Lists the account keys for the specified Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: ApiKeys. The ApiKeys is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ApiKeys] = kwargs.pop("cls", None) + + _request = build_accounts_list_keys_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApiKeys, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def regenerate_key( + self, + resource_group_name: str, + account_name: str, + parameters: _models.RegenerateKeyParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKeys: + """Regenerates the specified account key for the specified Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param parameters: regenerate key parameters. Required. + :type parameters: ~azure.mgmt.cognitiveservices.models.RegenerateKeyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApiKeys. The ApiKeys is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_key( + self, + resource_group_name: str, + account_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKeys: + """Regenerates the specified account key for the specified Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param parameters: regenerate key parameters. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApiKeys. The ApiKeys is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_key( + self, + resource_group_name: str, + account_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApiKeys: + """Regenerates the specified account key for the specified Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param parameters: regenerate key parameters. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApiKeys. The ApiKeys is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_key( + self, + resource_group_name: str, + account_name: str, + parameters: Union[_models.RegenerateKeyParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApiKeys: + """Regenerates the specified account key for the specified Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param parameters: regenerate key parameters. Is one of the following types: + RegenerateKeyParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.cognitiveservices.models.RegenerateKeyParameters or JSON or + IO[bytes] + :return: ApiKeys. The ApiKeys is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApiKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_accounts_regenerate_key_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApiKeys, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_skus(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountSkuListResult: + """List available SKUs for the requested Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: AccountSkuListResult. The AccountSkuListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.AccountSkuListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AccountSkuListResult] = kwargs.pop("cls", None) + + _request = build_accounts_list_skus_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AccountSkuListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_usages( + self, resource_group_name: str, account_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> _models.UsageListResult: + """Get usages for the requested Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :keyword filter: An OData filter expression that describes a subset of usages to return. The + supported parameter is name.value (name of the metric, can have an or of multiple names). + Default value is None. + :paramtype filter: str + :return: UsageListResult. The UsageListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.UsageListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) + + _request = build_accounts_list_usages_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.UsageListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_models( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.AccountModel"]: + """List available Models for the requested Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An iterator like instance of AccountModel + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.AccountModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AccountModel]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_accounts_list_models_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AccountModel], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def evaluate_deployment_policies( + self, + resource_group_name: str, + account_name: str, + body: _models.EvaluateDeploymentPoliciesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluateDeploymentPoliciesResponse: + """Evaluate Azure Policy compliance for a set of hypothetical deployments without creating them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param body: The content of the action request. Required. + :type body: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluateDeploymentPoliciesResponse. The EvaluateDeploymentPoliciesResponse is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def evaluate_deployment_policies( + self, + resource_group_name: str, + account_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluateDeploymentPoliciesResponse: + """Evaluate Azure Policy compliance for a set of hypothetical deployments without creating them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param body: The content of the action request. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluateDeploymentPoliciesResponse. The EvaluateDeploymentPoliciesResponse is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def evaluate_deployment_policies( + self, + resource_group_name: str, + account_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EvaluateDeploymentPoliciesResponse: + """Evaluate Azure Policy compliance for a set of hypothetical deployments without creating them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param body: The content of the action request. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EvaluateDeploymentPoliciesResponse. The EvaluateDeploymentPoliciesResponse is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def evaluate_deployment_policies( + self, + resource_group_name: str, + account_name: str, + body: Union[_models.EvaluateDeploymentPoliciesRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.EvaluateDeploymentPoliciesResponse: + """Evaluate Azure Policy compliance for a set of hypothetical deployments without creating them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param body: The content of the action request. Is one of the following types: + EvaluateDeploymentPoliciesRequest, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesRequest or JSON or + IO[bytes] + :return: EvaluateDeploymentPoliciesResponse. The EvaluateDeploymentPoliciesResponse is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EvaluateDeploymentPoliciesResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EvaluateDeploymentPoliciesResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_accounts_evaluate_deployment_policies_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EvaluateDeploymentPoliciesResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DeletedAccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`deleted_accounts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Account"]: + """Returns all the resources of a particular type belonging to a subscription. + + :return: An iterator like instance of Account + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Account]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deleted_accounts_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Account], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, location: str, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.Account: + """Returns a Cognitive Services account specified by the parameters. + + :param location: The location name. Required. + :type location: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: Account. The Account is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.Account + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Account] = kwargs.pop("cls", None) + + _request = build_deleted_accounts_get_request( + location=location, + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Account, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _purge_initial( + self, location: str, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deleted_accounts_purge_request( + location=location, + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass @@ -4637,9 +6980,240 @@ def _create_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_purge(self, location: str, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a Cognitive Services account from the resource group. + + :param location: The location name. Required. + :type location: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._purge_initial( + location=location, + resource_group_name=resource_group_name, + account_name=account_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Cognitive Services Account. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + properties: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -4652,129 +7226,151 @@ def _create_initial( return deserialized # type: ignore @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - account: _models.Account, + private_endpoint_connection_name: str, + properties: _models.PrivateEndpointConnection, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Account]: - """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. + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of specified private endpoint connection associated with the Cognitive + Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param account: The parameters to provide for the created account. Required. - :type account: ~azure.mgmt.cognitiveservices.models.Account + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Cognitive Services Account. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Account. The Account is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - account: JSON, + private_endpoint_connection_name: str, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Account]: - """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. + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of specified private endpoint connection associated with the Cognitive + Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param account: The parameters to provide for the created account. Required. - :type account: JSON + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Cognitive Services Account. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Account. The Account is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - account: IO[bytes], + private_endpoint_connection_name: str, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Account]: - """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. + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of specified private endpoint connection associated with the Cognitive + Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param account: The parameters to provide for the created account. Required. - :type account: IO[bytes] + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Cognitive Services Account. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Required. + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Account. The Account is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - account: Union[_models.Account, JSON, IO[bytes]], + private_endpoint_connection_name: str, + properties: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Account]: - """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. + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Update the state of specified private endpoint connection associated with the Cognitive + Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param account: The parameters to provide for the created account. Is one of the following - types: Account, JSON, IO[bytes] Required. - :type account: ~azure.mgmt.cognitiveservices.models.Account or JSON or IO[bytes] - :return: An instance of LROPoller that returns Account. The Account is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Cognitive Services Account. Required. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. Is one of the following types: + PrivateEndpointConnection, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection or JSON or + IO[bytes] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Account] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, - account=account, + private_endpoint_connection_name=private_endpoint_connection_name, + properties=properties, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -4786,7 +7382,7 @@ def begin_create( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.Account, response.json()) + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4804,22 +7400,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Account].from_continuation_token( + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Account]( + return LROPoller[_models.PrivateEndpointConnection]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _update_initial( - self, - resource_group_name: str, - account_name: str, - account: Union[_models.Account, JSON, IO[bytes]], - **kwargs: Any + def _delete_initial( + self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -4829,26 +7421,155 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified private endpoint connection associated with the Cognitive Services + account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Cognitive Services Account. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnectionListResult: + """Gets the private endpoint connections associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: PrivateEndpointConnectionListResult. The PrivateEndpointConnectionListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(account, (IOBase, bytes)): - _content = account - else: - _content = json.dumps(account, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - _request = build_accounts_update_request( + _request = build_private_endpoint_connections_list_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -4858,18 +7579,19 @@ def _update_initial( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -4877,178 +7599,120 @@ def _update_initial( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnectionListResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - account_name: str, - account: _models.Account, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Account]: - """Updates a Cognitive Services account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param account: The parameters to provide for the created account. Required. - :type account: ~azure.mgmt.cognitiveservices.models.Account - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Account. The Account is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - account_name: str, - account: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Account]: - """Updates a Cognitive Services account. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param account: The parameters to provide for the created account. Required. - :type account: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Account. The Account is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] - :raises ~azure.core.exceptions.HttpResponseError: - """ +class DeploymentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - def begin_update( - self, - resource_group_name: str, - account_name: str, - account: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Account]: - """Updates a Cognitive Services account. + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`deployments` attribute. + """ - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param account: The parameters to provide for the created account. Required. - :type account: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Account. The Account is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def begin_update( - self, - resource_group_name: str, - account_name: str, - account: Union[_models.Account, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Account]: - """Updates a Cognitive Services account. + def get( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> _models.Deployment: + """Gets the specified deployments associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param account: The parameters to provide for the created account. Is one of the following - types: Account, JSON, IO[bytes] Required. - :type account: ~azure.mgmt.cognitiveservices.models.Account or JSON or IO[bytes] - :return: An instance of LROPoller that returns Account. The Account is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :return: Deployment. The Deployment is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Account] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - account_name=account_name, - account=account, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Account, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + _request = build_deployments_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - polling_method = polling - if cont_token: - return LROPoller[_models.Account].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Account]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + deserialized = _deserialize(_models.Deployment, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: Union[_models.Deployment, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5057,16 +7721,27 @@ def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_accounts_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(deployment, (IOBase, bytes)): + _content = deployment + else: + _content = json.dumps(deployment, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_deployments_create_or_update_request( resource_group_name=resource_group_name, account_name=account_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -5083,7 +7758,7 @@ def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -5096,271 +7771,203 @@ def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a Cognitive Services account from the resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - account_name=account_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Account"]: - """Returns all the resources of a particular type belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of Account - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Account] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Account]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_accounts_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Account], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Account"]: - """Returns all the resources of a particular type belonging to a subscription. - - :return: An iterator like instance of Account - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Account] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Account]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_accounts_list_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Account], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - def get_next(next_link=None): - _request = prepare_request(next_link) + return deserialized # type: ignore - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Deployment]: + """Update the state of specified deployments associated with the Cognitive Services account. - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Required. + :type deployment: ~azure.mgmt.cognitiveservices.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ - return pipeline_response + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Deployment]: + """Update the state of specified deployments associated with the Cognitive Services account. - return ItemPaged(get_next, extract_data) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Required. + :type deployment: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Deployment]: + """Update the state of specified deployments associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Required. + :type deployment: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.ApiKeys: - """Lists the account keys for the specified Cognitive Services account. + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: Union[_models.Deployment, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Deployment]: + """Update the state of specified deployments associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: ApiKeys. The ApiKeys is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Is one of the following types: Deployment, JSON, + IO[bytes] Required. + :type deployment: ~azure.mgmt.cognitiveservices.models.Deployment or JSON or IO[bytes] + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + deployment=deployment, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Deployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Deployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Deployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: Union[_models.PatchResourceTagsAndSku, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5369,16 +7976,27 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ApiKeys] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_accounts_list_keys_request( + content_type = content_type or "application/json" + _content = None + if isinstance(deployment, (IOBase, bytes)): + _content = deployment + else: + _content = json.dumps(deployment, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_deployments_update_request( resource_group_name=resource_group_name, account_name=account_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -5388,19 +8006,18 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -5408,120 +8025,198 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ApiKeys, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def regenerate_key( + def begin_update( self, resource_group_name: str, account_name: str, - parameters: _models.RegenerateKeyParameters, + deployment_name: str, + deployment: _models.PatchResourceTagsAndSku, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ApiKeys: - """Regenerates the specified account key for the specified Cognitive Services account. + ) -> LROPoller[_models.Deployment]: + """Update specified deployments associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param parameters: regenerate key parameters. Required. - :type parameters: ~azure.mgmt.cognitiveservices.models.RegenerateKeyParameters + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Required. + :type deployment: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ApiKeys. The ApiKeys is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def regenerate_key( + def begin_update( self, resource_group_name: str, account_name: str, - parameters: JSON, + deployment_name: str, + deployment: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ApiKeys: - """Regenerates the specified account key for the specified Cognitive Services account. + ) -> LROPoller[_models.Deployment]: + """Update specified deployments associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param parameters: regenerate key parameters. Required. - :type parameters: JSON + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Required. + :type deployment: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: ApiKeys. The ApiKeys is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def regenerate_key( + def begin_update( self, resource_group_name: str, account_name: str, - parameters: IO[bytes], + deployment_name: str, + deployment: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ApiKeys: - """Regenerates the specified account key for the specified Cognitive Services account. + ) -> LROPoller[_models.Deployment]: + """Update specified deployments associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param parameters: regenerate key parameters. Required. - :type parameters: IO[bytes] + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Required. + :type deployment: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: ApiKeys. The ApiKeys is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def regenerate_key( + def begin_update( self, resource_group_name: str, account_name: str, - parameters: Union[_models.RegenerateKeyParameters, JSON, IO[bytes]], + deployment_name: str, + deployment: Union[_models.PatchResourceTagsAndSku, JSON, IO[bytes]], **kwargs: Any - ) -> _models.ApiKeys: - """Regenerates the specified account key for the specified Cognitive Services account. + ) -> LROPoller[_models.Deployment]: + """Update specified deployments associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param parameters: regenerate key parameters. Is one of the following types: - RegenerateKeyParameters, JSON, IO[bytes] Required. - :type parameters: ~azure.mgmt.cognitiveservices.models.RegenerateKeyParameters or JSON or + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :param deployment: The deployment properties. Is one of the following types: + PatchResourceTagsAndSku, JSON, IO[bytes] Required. + :type deployment: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku or JSON or IO[bytes] - :return: ApiKeys. The ApiKeys is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys + :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + deployment=deployment, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Deployment, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Deployment].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Deployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5530,26 +8225,17 @@ def regenerate_key( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApiKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_accounts_regenerate_key_request( + _request = build_deployments_delete_request( resource_group_name=resource_group_name, account_name=account_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -5559,19 +8245,18 @@ def regenerate_key( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -5579,105 +8264,99 @@ def regenerate_key( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ApiKeys, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list_skus(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.AccountSkuListResult: - """List available SKUs for the requested Cognitive Services account. + def begin_delete( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified deployment associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: AccountSkuListResult. The AccountSkuListResult is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.AccountSkuListResult + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AccountSkuListResult] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - _request = build_accounts_list_skus_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) else: - deserialized = _deserialize(_models.AccountSkuListResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_usages( - self, resource_group_name: str, account_name: str, *, filter: Optional[str] = None, **kwargs: Any - ) -> _models.UsageListResult: - """Get usages for the requested Cognitive Services account. + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.Deployment"]: + """Gets the deployments associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :keyword filter: An OData filter expression that describes a subset of usages to return. The - supported parameter is name.value (name of the metric, can have an or of multiple names). - Default value is None. - :paramtype filter: str - :return: UsageListResult. The UsageListResult is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.UsageListResult + :return: An iterator like instance of Deployment + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5686,75 +8365,102 @@ def list_usages( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) + _request = build_deployments_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_accounts_list_usages_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Deployment], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.UsageListResult, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) @distributed_trace - def list_models( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.AccountModel"]: - """List available Models for the requested Cognitive Services account. + def list_skus( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> ItemPaged["_models.SkuResource"]: + """Lists the specified deployments skus associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: An iterator like instance of AccountModel - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.AccountModel] + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :return: An iterator like instance of SkuResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.SkuResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AccountModel]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SkuResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -5767,9 +8473,10 @@ def list_models( def prepare_request(next_link=None): if not next_link: - _request = build_accounts_list_models_request( + _request = build_deployments_list_skus_request( resource_group_name=resource_group_name, account_name=account_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5793,7 +8500,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -5807,7 +8517,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.AccountModel], + List[_models.SkuResource], deserialized.get("value", []), ) if cls: @@ -5835,39 +8545,107 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + @distributed_trace + def pause( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> _models.Deployment: + """Pause a deployment. -class DeletedAccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + Pauses inferencing on a deployment by setting the deploymentState to 'Paused' (see + #/definitions/DeploymentProperties/properties/deploymentState). 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. - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`deleted_accounts` attribute. - """ + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :return: Deployment. The Deployment is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.Deployment + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + + _request = build_deployments_pause_request( + resource_group_name=resource_group_name, + account_name=account_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Deployment, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def get(self, location: str, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.Account: - """Returns a Cognitive Services account specified by the parameters. + def resume( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> _models.Deployment: + """Resume a deployment. + + 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. - :param location: The location name. Required. - :type location: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: Account. The Account is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.Account + :param deployment_name: The name of the deployment associated with the Cognitive Services + Account. Required. + :type deployment_name: str + :return: Deployment. The Deployment is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5881,12 +8659,12 @@ def get(self, location: str, resource_group_name: str, account_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Account] = kwargs.pop("cls", None) + cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - _request = build_deleted_accounts_get_request( - location=location, + _request = build_deployments_resume_request( resource_group_name=resource_group_name, account_name=account_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5921,16 +8699,51 @@ def get(self, location: str, resource_group_name: str, account_name: str, **kwar if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Account, response.json()) + deserialized = _deserialize(_models.Deployment, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _purge_initial( - self, location: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> Iterator[bytes]: + +class CommitmentPlansOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`commitment_plans` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, commitment_plan_name: str, **kwargs: Any + ) -> _models.CommitmentPlan: + """Gets the specified commitmentPlans associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5942,12 +8755,12 @@ def _purge_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.CommitmentPlan] = kwargs.pop("cls", None) - _request = build_deleted_accounts_purge_request( - location=location, + _request = build_commitment_plans_get_request( resource_group_name=resource_group_name, account_name=account_name, + commitment_plan_name=commitment_plan_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5959,18 +8772,19 @@ def _purge_initial( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -5978,205 +8792,133 @@ def _purge_initial( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CommitmentPlan, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_purge(self, location: str, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a Cognitive Services account from the resource group. + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + commitment_plan_name: str, + commitment_plan: _models.CommitmentPlan, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CommitmentPlan: + """Update the state of specified commitmentPlans associated with the Cognitive Services account. - :param location: The location name. Required. - :type location: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._purge_initial( - location=location, - resource_group_name=resource_group_name, - account_name=account_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Account"]: - """Returns all the resources of a particular type belonging to a subscription. - - :return: An iterator like instance of Account - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Account] + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The commitmentPlan properties. Required. + :type commitment_plan: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Account]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_deleted_accounts_list_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Account], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + commitment_plan_name: str, + commitment_plan: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CommitmentPlan: + """Update the state of specified commitmentPlans associated with the Cognitive Services account. -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`private_endpoint_connections` attribute. - """ + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The commitmentPlan properties. Required. + :type commitment_plan: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + commitment_plan_name: str, + commitment_plan: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CommitmentPlan: + """Update the state of specified commitmentPlans associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The commitmentPlan properties. Required. + :type commitment_plan: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get( - self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets the specified private endpoint connection associated with the Cognitive Services account. + def create_or_update( + self, + resource_group_name: str, + account_name: str, + commitment_plan_name: str, + commitment_plan: Union[_models.CommitmentPlan, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.CommitmentPlan: + """Update the state of specified commitmentPlans associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Cognitive Services Account. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with - MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The commitmentPlan properties. Is one of the following types: + CommitmentPlan, JSON, IO[bytes] Required. + :type commitment_plan: ~azure.mgmt.cognitiveservices.models.CommitmentPlan or JSON or IO[bytes] + :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -6187,17 +8929,27 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommitmentPlan] = kwargs.pop("cls", None) - _request = build_private_endpoint_connections_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(commitment_plan, (IOBase, bytes)): + _content = commitment_plan + else: + _content = json.dumps(commitment_plan, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_commitment_plans_create_or_update_request( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + commitment_plan_name=commitment_plan_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6214,7 +8966,7 @@ def get( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -6230,20 +8982,15 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + deserialized = _deserialize(_models.CommitmentPlan, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( - self, - resource_group_name: str, - account_name: str, - private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], - **kwargs: Any + def _delete_initial( + self, resource_group_name: str, account_name: str, commitment_plan_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6253,27 +9000,17 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_private_endpoint_connections_create_or_update_request( + _request = build_commitment_plans_delete_request( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + commitment_plan_name=commitment_plan_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -6290,177 +9027,60 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - account_name: str, - private_endpoint_connection_name: str, - properties: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Update the state of specified private endpoint connection associated with the Cognitive - Services account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Cognitive Services Account. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - account_name: str, - private_endpoint_connection_name: str, - properties: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Update the state of specified private endpoint connection associated with the Cognitive - Services account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Cognitive Services Account. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - account_name: str, - private_endpoint_connection_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Update the state of specified private endpoint connection associated with the Cognitive - Services account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Cognitive Services Account. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - account_name: str, - private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Update the state of specified private endpoint connection associated with the Cognitive - Services account. + def begin_delete( + self, resource_group_name: str, account_name: str, commitment_plan_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified commitmentPlan associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Cognitive Services Account. Required. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Is one of the following types: - PrivateEndpointConnection, JSON, IO[bytes] Required. - :type properties: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection or JSON or - IO[bytes] - :return: An instance of LROPoller that returns PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, - properties=properties, - content_type=content_type, + commitment_plan_name=commitment_plan_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -6469,12 +9089,9 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -6489,18 +9106,191 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.CommitmentPlan"]: + """Gets the commitmentPlans associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An iterator like instance of CommitmentPlan + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommitmentPlan]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_commitment_plans_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CommitmentPlan], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_plan(self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any) -> _models.CommitmentPlan: + """Returns a Cognitive Services commitment plan specified by the parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommitmentPlan] = kwargs.pop("cls", None) + + _request = build_commitment_plans_get_plan_request( + resource_group_name=resource_group_name, + commitment_plan_name=commitment_plan_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def _delete_initial( - self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CommitmentPlan, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_plan_initial( + self, + resource_group_name: str, + commitment_plan_name: str, + commitment_plan: Union[_models.CommitmentPlan, JSON, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6510,17 +9300,26 @@ def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_private_endpoint_connections_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(commitment_plan, (IOBase, bytes)): + _content = commitment_plan + else: + _content = json.dumps(commitment_plan, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_commitment_plans_create_or_update_plan_request( resource_group_name=resource_group_name, - account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + commitment_plan_name=commitment_plan_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6537,7 +9336,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -6550,8 +9349,10 @@ def _delete_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -6561,37 +9362,131 @@ def _delete_initial( return deserialized # type: ignore + @overload + def begin_create_or_update_plan( + self, + resource_group_name: str, + commitment_plan_name: str, + commitment_plan: _models.CommitmentPlan, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommitmentPlan]: + """Create Cognitive Services commitment plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The parameters to provide for the created commitment plan. Required. + :type commitment_plan: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update_plan( + self, + resource_group_name: str, + commitment_plan_name: str, + commitment_plan: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommitmentPlan]: + """Create Cognitive Services commitment plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The parameters to provide for the created commitment plan. Required. + :type commitment_plan: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update_plan( + self, + resource_group_name: str, + commitment_plan_name: str, + commitment_plan: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommitmentPlan]: + """Create Cognitive Services commitment plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The parameters to provide for the created commitment plan. Required. + :type commitment_plan: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_delete( - self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes the specified private endpoint connection associated with the Cognitive Services - account. + def begin_create_or_update_plan( + self, + resource_group_name: str, + commitment_plan_name: str, + commitment_plan: Union[_models.CommitmentPlan, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CommitmentPlan]: + """Create Cognitive Services commitment plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Cognitive Services Account. Required. - :type private_endpoint_connection_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The parameters to provide for the created commitment plan. Is one of + the following types: CommitmentPlan, JSON, IO[bytes] Required. + :type commitment_plan: ~azure.mgmt.cognitiveservices.models.CommitmentPlan or JSON or IO[bytes] + :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommitmentPlan] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._create_or_update_plan_initial( resource_group_name=resource_group_name, - account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + commitment_plan_name=commitment_plan_name, + commitment_plan=commitment_plan, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -6600,9 +9495,12 @@ def begin_delete( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CommitmentPlan, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -6617,125 +9515,23 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.CommitmentPlan].from_continuation_token( polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnectionListResult: - """Gets the private endpoint connections associated with the Cognitive Services account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :return: PrivateEndpointConnectionListResult. The PrivateEndpointConnectionListResult is - compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - _request = build_private_endpoint_connections_list_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.PrivateEndpointConnectionListResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class DeploymentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`deployments` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any - ) -> _models.Deployment: - """Gets the specified deployments associated with the Cognitive Services account. + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CommitmentPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :return: Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.Deployment - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _update_plan_initial( + self, + resource_group_name: str, + commitment_plan_name: str, + commitment_plan: Union[_models.PatchResourceTagsAndSku, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6744,17 +9540,26 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_deployments_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(commitment_plan, (IOBase, bytes)): + _content = commitment_plan + else: + _content = json.dumps(commitment_plan, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_commitment_plans_update_plan_request( resource_group_name=resource_group_name, - account_name=account_name, - deployment_name=deployment_name, + commitment_plan_name=commitment_plan_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6764,19 +9569,18 @@ def get( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -6784,23 +9588,184 @@ def get( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Deployment, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( + @overload + def begin_update_plan( self, resource_group_name: str, - account_name: str, - deployment_name: str, - deployment: Union[_models.Deployment, JSON, IO[bytes]], + commitment_plan_name: str, + commitment_plan: _models.PatchResourceTagsAndSku, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommitmentPlan]: + """Create Cognitive Services commitment plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The parameters to provide for the created commitment plan. Required. + :type commitment_plan: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_plan( + self, + resource_group_name: str, + commitment_plan_name: str, + commitment_plan: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommitmentPlan]: + """Create Cognitive Services commitment plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The parameters to provide for the created commitment plan. Required. + :type commitment_plan: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_plan( + self, + resource_group_name: str, + commitment_plan_name: str, + commitment_plan: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommitmentPlan]: + """Create Cognitive Services commitment plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The parameters to provide for the created commitment plan. Required. + :type commitment_plan: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_plan( + self, + resource_group_name: str, + commitment_plan_name: str, + commitment_plan: Union[_models.PatchResourceTagsAndSku, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.CommitmentPlan]: + """Create Cognitive Services commitment plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan: The parameters to provide for the created commitment plan. Is one of + the following types: PatchResourceTagsAndSku, JSON, IO[bytes] Required. + :type commitment_plan: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku or JSON or + IO[bytes] + :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommitmentPlan] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_plan_initial( + resource_group_name=resource_group_name, + commitment_plan_name=commitment_plan_name, + commitment_plan=commitment_plan, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CommitmentPlan, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CommitmentPlan].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CommitmentPlan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_plan_initial( + self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -6810,27 +9775,16 @@ def _create_or_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(deployment, (IOBase, bytes)): - _content = deployment - else: - _content = json.dumps(deployment, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_deployments_create_or_update_request( + _request = build_commitment_plans_delete_plan_request( resource_group_name=resource_group_name, - account_name=account_name, - deployment_name=deployment_name, + commitment_plan_name=commitment_plan_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -6847,7 +9801,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -6860,10 +9814,8 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -6873,188 +9825,340 @@ def _create_or_update_initial( return deserialized # type: ignore - @overload - def begin_create_or_update( - self, - resource_group_name: str, - account_name: str, - deployment_name: str, - deployment: _models.Deployment, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Deployment]: - """Update the state of specified deployments associated with the Cognitive Services account. + @distributed_trace + def begin_delete_plan(self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a Cognitive Services commitment plan from the resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :param deployment: The deployment properties. Required. - :type deployment: ~azure.mgmt.cognitiveservices.models.Deployment - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def begin_create_or_update( - self, - resource_group_name: str, - account_name: str, - deployment_name: str, - deployment: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Deployment]: - """Update the state of specified deployments associated with the Cognitive Services account. + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_plan_initial( + resource_group_name=resource_group_name, + commitment_plan_name=commitment_plan_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_plans_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.CommitmentPlan"]: + """Returns all the resources of a particular type belonging to a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of CommitmentPlan + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommitmentPlan]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_commitment_plans_list_plans_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CommitmentPlan], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_plans_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.CommitmentPlan"]: + """Returns all the resources of a particular type belonging to a subscription. + + :return: An iterator like instance of CommitmentPlan + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommitmentPlan]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_commitment_plans_list_plans_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CommitmentPlan], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :param deployment: The deployment properties. Required. - :type deployment: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_next(next_link=None): + _request = prepare_request(next_link) - @overload - def begin_create_or_update( - self, - resource_group_name: str, - account_name: str, - deployment_name: str, - deployment: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Deployment]: - """Update the state of specified deployments associated with the Cognitive Services account. + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :param deployment: The deployment properties. Required. - :type deployment: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - account_name: str, - deployment_name: str, - deployment: Union[_models.Deployment, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Deployment]: - """Update the state of specified deployments associated with the Cognitive Services account. + def get_association( + self, resource_group_name: str, commitment_plan_name: str, commitment_plan_association_name: str, **kwargs: Any + ) -> _models.CommitmentPlanAccountAssociation: + """Gets the association of the Cognitive Services commitment plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :param deployment: The deployment properties. Is one of the following types: Deployment, JSON, - IO[bytes] Required. - :type deployment: ~azure.mgmt.cognitiveservices.models.Deployment or JSON or IO[bytes] - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan_association_name: The name of the commitment plan association with the + Cognitive Services Account. Required. + :type commitment_plan_association_name: str + :return: CommitmentPlanAccountAssociation. The CommitmentPlanAccountAssociation is compatible + with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - account_name=account_name, - deployment_name=deployment_name, - deployment=deployment, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.Deployment, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[_models.CommitmentPlanAccountAssociation] = kwargs.pop("cls", None) + _request = build_commitment_plans_get_association_request( + resource_group_name=resource_group_name, + commitment_plan_name=commitment_plan_name, + commitment_plan_association_name=commitment_plan_association_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - polling_method = polling - if cont_token: - return LROPoller[_models.Deployment].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Deployment]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + deserialized = _deserialize(_models.CommitmentPlanAccountAssociation, response.json()) - def _update_initial( + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_association_initial( self, resource_group_name: str, - account_name: str, - deployment_name: str, - deployment: Union[_models.PatchResourceTagsAndSku, JSON, IO[bytes]], + commitment_plan_name: str, + commitment_plan_association_name: str, + association: Union[_models.CommitmentPlanAccountAssociation, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -7073,15 +10177,15 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(deployment, (IOBase, bytes)): - _content = deployment + if isinstance(association, (IOBase, bytes)): + _content = association else: - _content = json.dumps(deployment, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(association, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_deployments_update_request( + _request = build_commitment_plans_create_or_update_association_request( resource_group_name=resource_group_name, - account_name=account_name, - deployment_name=deployment_name, + commitment_plan_name=commitment_plan_name, + commitment_plan_association_name=commitment_plan_association_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -7102,7 +10206,7 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -7115,8 +10219,10 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -7127,143 +10233,151 @@ def _update_initial( return deserialized # type: ignore @overload - def begin_update( + def begin_create_or_update_association( self, resource_group_name: str, - account_name: str, - deployment_name: str, - deployment: _models.PatchResourceTagsAndSku, + commitment_plan_name: str, + commitment_plan_association_name: str, + association: _models.CommitmentPlanAccountAssociation, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Deployment]: - """Update specified deployments associated with the Cognitive Services account. + ) -> LROPoller[_models.CommitmentPlanAccountAssociation]: + """Create or update the association of the Cognitive Services commitment plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :param deployment: The deployment properties. Required. - :type deployment: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan_association_name: The name of the commitment plan association with the + Cognitive Services Account. Required. + :type commitment_plan_association_name: str + :param association: The commitmentPlan properties. Required. + :type association: ~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :return: An instance of LROPoller that returns CommitmentPlanAccountAssociation. The + CommitmentPlanAccountAssociation is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_create_or_update_association( self, resource_group_name: str, - account_name: str, - deployment_name: str, - deployment: JSON, + commitment_plan_name: str, + commitment_plan_association_name: str, + association: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Deployment]: - """Update specified deployments associated with the Cognitive Services account. + ) -> LROPoller[_models.CommitmentPlanAccountAssociation]: + """Create or update the association of the Cognitive Services commitment plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :param deployment: The deployment properties. Required. - :type deployment: JSON + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan_association_name: The name of the commitment plan association with the + Cognitive Services Account. Required. + :type commitment_plan_association_name: str + :param association: The commitmentPlan properties. Required. + :type association: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :return: An instance of LROPoller that returns CommitmentPlanAccountAssociation. The + CommitmentPlanAccountAssociation is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def begin_create_or_update_association( self, resource_group_name: str, - account_name: str, - deployment_name: str, - deployment: IO[bytes], + commitment_plan_name: str, + commitment_plan_association_name: str, + association: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Deployment]: - """Update specified deployments associated with the Cognitive Services account. + ) -> LROPoller[_models.CommitmentPlanAccountAssociation]: + """Create or update the association of the Cognitive Services commitment plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :param deployment: The deployment properties. Required. - :type deployment: IO[bytes] + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan_association_name: The name of the commitment plan association with the + Cognitive Services Account. Required. + :type commitment_plan_association_name: str + :param association: The commitmentPlan properties. Required. + :type association: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :return: An instance of LROPoller that returns CommitmentPlanAccountAssociation. The + CommitmentPlanAccountAssociation is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def begin_create_or_update_association( self, resource_group_name: str, - account_name: str, - deployment_name: str, - deployment: Union[_models.PatchResourceTagsAndSku, JSON, IO[bytes]], + commitment_plan_name: str, + commitment_plan_association_name: str, + association: Union[_models.CommitmentPlanAccountAssociation, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Deployment]: - """Update specified deployments associated with the Cognitive Services account. + ) -> LROPoller[_models.CommitmentPlanAccountAssociation]: + """Create or update the association of the Cognitive Services commitment plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :param deployment: The deployment properties. Is one of the following types: - PatchResourceTagsAndSku, JSON, IO[bytes] Required. - :type deployment: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku or JSON or - IO[bytes] - :return: An instance of LROPoller that returns Deployment. The Deployment is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan_association_name: The name of the commitment plan association with the + Cognitive Services Account. Required. + :type commitment_plan_association_name: str + :param association: The commitmentPlan properties. Is one of the following types: + CommitmentPlanAccountAssociation, JSON, IO[bytes] Required. + :type association: ~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation or + JSON or IO[bytes] + :return: An instance of LROPoller that returns CommitmentPlanAccountAssociation. The + CommitmentPlanAccountAssociation is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + cls: ClsType[_models.CommitmentPlanAccountAssociation] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_initial( + raw_result = self._create_or_update_association_initial( resource_group_name=resource_group_name, - account_name=account_name, - deployment_name=deployment_name, - deployment=deployment, + commitment_plan_name=commitment_plan_name, + commitment_plan_association_name=commitment_plan_association_name, + association=association, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -7275,7 +10389,7 @@ def begin_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.Deployment, response.json()) + deserialized = _deserialize(_models.CommitmentPlanAccountAssociation, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7293,18 +10407,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Deployment].from_continuation_token( + return LROPoller[_models.CommitmentPlanAccountAssociation].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Deployment]( + return LROPoller[_models.CommitmentPlanAccountAssociation]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( - self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + def _delete_association_initial( + self, resource_group_name: str, commitment_plan_name: str, commitment_plan_association_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7319,10 +10433,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_deployments_delete_request( + _request = build_commitment_plans_delete_association_request( resource_group_name=resource_group_name, - account_name=account_name, - deployment_name=deployment_name, + commitment_plan_name=commitment_plan_name, + commitment_plan_association_name=commitment_plan_association_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -7366,19 +10480,20 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace - def begin_delete( - self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + def begin_delete_association( + self, resource_group_name: str, commitment_plan_name: str, commitment_plan_association_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes the specified deployment associated with the Cognitive Services account. + """Deletes the association of the Cognitive Services commitment plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :param commitment_plan_association_name: The name of the commitment plan association with the + Cognitive Services Account. Required. + :type commitment_plan_association_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -7391,10 +10506,10 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_association_initial( resource_group_name=resource_group_name, - account_name=account_name, - deployment_name=deployment_name, + commitment_plan_name=commitment_plan_name, + commitment_plan_association_name=commitment_plan_association_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -7420,133 +10535,35 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.Deployment"]: - """Gets the deployments associated with the Cognitive Services account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :return: An iterator like instance of Deployment - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Deployment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_deployments_list_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Deployment], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_skus( - self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any - ) -> ItemPaged["_models.SkuResource"]: - """Lists the specified deployments skus associated with the Cognitive Services account. + def list_associations( + self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any + ) -> ItemPaged["_models.CommitmentPlanAccountAssociation"]: + """Gets the associations of the Cognitive Services commitment plan. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :return: An iterator like instance of SkuResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.SkuResource] + :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. Required. + :type commitment_plan_name: str + :return: An iterator like instance of CommitmentPlanAccountAssociation + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SkuResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CommitmentPlanAccountAssociation]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -7559,10 +10576,9 @@ def list_skus( def prepare_request(next_link=None): if not next_link: - _request = build_deployments_list_skus_request( + _request = build_commitment_plans_list_associations_request( resource_group_name=resource_group_name, - account_name=account_name, - deployment_name=deployment_name, + commitment_plan_name=commitment_plan_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -7586,7 +10602,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -7600,7 +10619,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SkuResource], + List[_models.CommitmentPlanAccountAssociation], deserialized.get("value", []), ) if cls: @@ -7628,27 +10647,220 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + +class EncryptionScopesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`encryption_scopes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def pause( - self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any - ) -> _models.Deployment: - """Pause a deployment. + def get( + self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any + ) -> _models.EncryptionScope: + """Gets the specified EncryptionScope associated with the Cognitive Services account. - Pauses inferencing on a deployment by setting the deploymentState to 'Paused' (see - #/definitions/DeploymentProperties/properties/deploymentState). 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. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :return: EncryptionScope. The EncryptionScope is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EncryptionScope] = kwargs.pop("cls", None) + + _request = build_encryption_scopes_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + encryption_scope_name=encryption_scope_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.EncryptionScope, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: _models.EncryptionScope, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EncryptionScope: + """Update the state of specified encryptionScope associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :return: Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.Deployment + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :param encryption_scope: The encryptionScope properties. Required. + :type encryption_scope: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EncryptionScope. The EncryptionScope is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EncryptionScope: + """Update the state of specified encryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :param encryption_scope: The encryptionScope properties. Required. + :type encryption_scope: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EncryptionScope. The EncryptionScope is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.EncryptionScope: + """Update the state of specified encryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :param encryption_scope: The encryptionScope properties. Required. + :type encryption_scope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EncryptionScope. The EncryptionScope is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + account_name: str, + encryption_scope_name: str, + encryption_scope: Union[_models.EncryptionScope, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.EncryptionScope: + """Update the state of specified encryptionScope associated with the Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :param encryption_scope: The encryptionScope properties. Is one of the following types: + EncryptionScope, JSON, IO[bytes] Required. + :type encryption_scope: ~azure.mgmt.cognitiveservices.models.EncryptionScope or JSON or + IO[bytes] + :return: EncryptionScope. The EncryptionScope is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7659,17 +10871,27 @@ def pause( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EncryptionScope] = kwargs.pop("cls", None) - _request = build_deployments_pause_request( + content_type = content_type or "application/json" + _content = None + if isinstance(encryption_scope, (IOBase, bytes)): + _content = encryption_scope + else: + _content = json.dumps(encryption_scope, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_encryption_scopes_create_or_update_request( resource_group_name=resource_group_name, account_name=account_name, - deployment_name=deployment_name, + encryption_scope_name=encryption_scope_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -7686,7 +10908,7 @@ def pause( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -7702,35 +10924,16 @@ def pause( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Deployment, response.json()) + deserialized = _deserialize(_models.EncryptionScope, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def resume( - self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any - ) -> _models.Deployment: - """Resume a deployment. - - 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. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param deployment_name: The name of the deployment associated with the Cognitive Services - Account. Required. - :type deployment_name: str - :return: Deployment. The Deployment is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.Deployment - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _delete_initial( + self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7742,12 +10945,12 @@ def resume( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Deployment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_deployments_resume_request( + _request = build_encryption_scopes_delete_request( resource_group_name=resource_group_name, account_name=account_name, - deployment_name=deployment_name, + encryption_scope_name=encryption_scope_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -7759,19 +10962,18 @@ def resume( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -7779,25 +10981,190 @@ def resume( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.Deployment, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified encryptionScope associated with the Cognitive Services account. -class CommitmentPlansOperations: + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive + Services Account. Required. + :type encryption_scope_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + encryption_scope_name=encryption_scope_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.EncryptionScope"]: + """Gets the content filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An iterator like instance of EncryptionScope + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.EncryptionScope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.EncryptionScope]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_encryption_scopes_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.EncryptionScope], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RaiPoliciesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`commitment_plans` attribute. + :attr:`rai_policies` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -7811,20 +11178,20 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def get( - self, resource_group_name: str, account_name: str, commitment_plan_name: str, **kwargs: Any - ) -> _models.CommitmentPlan: - """Gets the specified commitmentPlans associated with the Cognitive Services account. + self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any + ) -> _models.RaiPolicy: + """Gets the specified Content Filters associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7838,12 +11205,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CommitmentPlan] = kwargs.pop("cls", None) + cls: ClsType[_models.RaiPolicy] = kwargs.pop("cls", None) - _request = build_commitment_plans_get_request( + _request = build_rai_policies_get_request( resource_group_name=resource_group_name, account_name=account_name, - commitment_plan_name=commitment_plan_name, + rai_policy_name=rai_policy_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -7878,7 +11245,7 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CommitmentPlan, response.json()) + deserialized = _deserialize(_models.RaiPolicy, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -7890,29 +11257,29 @@ def create_or_update( self, resource_group_name: str, account_name: str, - commitment_plan_name: str, - commitment_plan: _models.CommitmentPlan, + rai_policy_name: str, + rai_policy: _models.RaiPolicy, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CommitmentPlan: - """Update the state of specified commitmentPlans associated with the Cognitive Services account. + ) -> _models.RaiPolicy: + """Update the state of specified Content Filters associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The commitmentPlan properties. Required. - :type commitment_plan: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Required. + :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ @@ -7921,29 +11288,29 @@ def create_or_update( self, resource_group_name: str, account_name: str, - commitment_plan_name: str, - commitment_plan: JSON, + rai_policy_name: str, + rai_policy: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CommitmentPlan: - """Update the state of specified commitmentPlans associated with the Cognitive Services account. + ) -> _models.RaiPolicy: + """Update the state of specified Content Filters associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The commitmentPlan properties. Required. - :type commitment_plan: JSON + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Required. + :type rai_policy: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ @@ -7952,29 +11319,29 @@ def create_or_update( self, resource_group_name: str, account_name: str, - commitment_plan_name: str, - commitment_plan: IO[bytes], + rai_policy_name: str, + rai_policy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CommitmentPlan: - """Update the state of specified commitmentPlans associated with the Cognitive Services account. + ) -> _models.RaiPolicy: + """Update the state of specified Content Filters associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The commitmentPlan properties. Required. - :type commitment_plan: IO[bytes] + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Required. + :type rai_policy: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ @@ -7983,25 +11350,25 @@ def create_or_update( self, resource_group_name: str, account_name: str, - commitment_plan_name: str, - commitment_plan: Union[_models.CommitmentPlan, JSON, IO[bytes]], + rai_policy_name: str, + rai_policy: Union[_models.RaiPolicy, JSON, IO[bytes]], **kwargs: Any - ) -> _models.CommitmentPlan: - """Update the state of specified commitmentPlans associated with the Cognitive Services account. + ) -> _models.RaiPolicy: + """Update the state of specified Content Filters associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The commitmentPlan properties. Is one of the following types: - CommitmentPlan, JSON, IO[bytes] Required. - :type commitment_plan: ~azure.mgmt.cognitiveservices.models.CommitmentPlan or JSON or IO[bytes] - :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Is one of the following types: + RaiPolicy, JSON, IO[bytes] Required. + :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy or JSON or IO[bytes] + :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8016,19 +11383,19 @@ def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CommitmentPlan] = kwargs.pop("cls", None) + cls: ClsType[_models.RaiPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(commitment_plan, (IOBase, bytes)): - _content = commitment_plan + if isinstance(rai_policy, (IOBase, bytes)): + _content = rai_policy else: - _content = json.dumps(commitment_plan, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(rai_policy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_commitment_plans_create_or_update_request( + _request = build_rai_policies_create_or_update_request( resource_group_name=resource_group_name, account_name=account_name, - commitment_plan_name=commitment_plan_name, + rai_policy_name=rai_policy_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -8065,7 +11432,7 @@ def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CommitmentPlan, response.json()) + deserialized = _deserialize(_models.RaiPolicy, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -8073,7 +11440,7 @@ def create_or_update( return deserialized # type: ignore def _delete_initial( - self, resource_group_name: str, account_name: str, commitment_plan_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8088,10 +11455,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_commitment_plans_delete_request( + _request = build_rai_policies_delete_request( resource_group_name=resource_group_name, account_name=account_name, - commitment_plan_name=commitment_plan_name, + rai_policy_name=rai_policy_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -8110,7 +11477,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -8136,18 +11503,18 @@ def _delete_initial( @distributed_trace def begin_delete( - self, resource_group_name: str, account_name: str, commitment_plan_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes the specified commitmentPlan associated with the Cognitive Services account. + """Deletes the specified Content Filters associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -8163,7 +11530,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, - commitment_plan_name=commitment_plan_name, + rai_policy_name=rai_policy_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -8198,22 +11565,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.CommitmentPlan"]: - """Gets the commitmentPlans associated with the Cognitive Services account. + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.RaiPolicy"]: + """Gets the content filters associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: An iterator like instance of CommitmentPlan - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :return: An iterator like instance of RaiPolicy + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiPolicy] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CommitmentPlan]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RaiPolicy]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8226,7 +11593,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It def prepare_request(next_link=None): if not next_link: - _request = build_commitment_plans_list_request( + _request = build_rai_policies_list_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -8252,7 +11619,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -8266,46 +11636,197 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.CommitmentPlan], + List[_models.RaiPolicy], deserialized.get("value", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) - def get_next(next_link=None): - _request = prepare_request(next_link) + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SubscriptionRaiPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`subscription_rai_policy` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, rai_policy_name: str, **kwargs: Any) -> _models.RaiPolicy: + """Gets the specified Content Filters associated with the Subscription. + + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RaiPolicy] = kwargs.pop("cls", None) + + _request = build_subscription_rai_policy_get_request( + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RaiPolicy, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + return deserialized # type: ignore - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + @overload + def create_or_update( + self, + rai_policy_name: str, + rai_policy: _models.RaiPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiPolicy: + """Update the state of specified Content Filters associated with the subscription. - return pipeline_response + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Required. + :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ - return ItemPaged(get_next, extract_data) + @overload + def create_or_update( + self, rai_policy_name: str, rai_policy: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RaiPolicy: + """Update the state of specified Content Filters associated with the subscription. + + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Required. + :type rai_policy: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, rai_policy_name: str, rai_policy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.RaiPolicy: + """Update the state of specified Content Filters associated with the subscription. + + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Required. + :type rai_policy: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get_plan(self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any) -> _models.CommitmentPlan: - """Returns a Cognitive Services commitment plan specified by the parameters. + def create_or_update( + self, rai_policy_name: str, rai_policy: Union[_models.RaiPolicy, JSON, IO[bytes]], **kwargs: Any + ) -> _models.RaiPolicy: + """Update the state of specified Content Filters associated with the subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :return: CommitmentPlan. The CommitmentPlan is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :param rai_policy: Properties describing the Content Filters. Is one of the following types: + RaiPolicy, JSON, IO[bytes] Required. + :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy or JSON or IO[bytes] + :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8316,16 +11837,25 @@ def get_plan(self, resource_group_name: str, commitment_plan_name: str, **kwargs } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CommitmentPlan] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RaiPolicy] = kwargs.pop("cls", None) - _request = build_commitment_plans_get_plan_request( - resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, + content_type = content_type or "application/json" + _content = None + if isinstance(rai_policy, (IOBase, bytes)): + _content = rai_policy + else: + _content = json.dumps(rai_policy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_subscription_rai_policy_create_or_update_request( + rai_policy_name=rai_policy_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -8342,7 +11872,7 @@ def get_plan(self, resource_group_name: str, commitment_plan_name: str, **kwargs response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -8358,20 +11888,14 @@ def get_plan(self, resource_group_name: str, commitment_plan_name: str, **kwargs if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CommitmentPlan, response.json()) + deserialized = _deserialize(_models.RaiPolicy, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_plan_initial( - self, - resource_group_name: str, - commitment_plan_name: str, - commitment_plan: Union[_models.CommitmentPlan, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: + def _delete_initial(self, rai_policy_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8380,26 +11904,15 @@ def _create_or_update_plan_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" - _content = None - if isinstance(commitment_plan, (IOBase, bytes)): - _content = commitment_plan - else: - _content = json.dumps(commitment_plan, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_commitment_plans_create_or_update_plan_request( - resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, + _request = build_subscription_rai_policy_delete_request( + rai_policy_name=rai_policy_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -8416,7 +11929,7 @@ def _create_or_update_plan_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -8429,10 +11942,8 @@ def _create_or_update_plan_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -8440,147 +11951,36 @@ def _create_or_update_plan_initial( if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized # type: ignore - - @overload - def begin_create_or_update_plan( - self, - resource_group_name: str, - commitment_plan_name: str, - commitment_plan: _models.CommitmentPlan, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CommitmentPlan]: - """Create Cognitive Services commitment plan. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The parameters to provide for the created commitment plan. Required. - :type commitment_plan: ~azure.mgmt.cognitiveservices.models.CommitmentPlan - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update_plan( - self, - resource_group_name: str, - commitment_plan_name: str, - commitment_plan: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CommitmentPlan]: - """Create Cognitive Services commitment plan. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The parameters to provide for the created commitment plan. Required. - :type commitment_plan: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update_plan( - self, - resource_group_name: str, - commitment_plan_name: str, - commitment_plan: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CommitmentPlan]: - """Create Cognitive Services commitment plan. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The parameters to provide for the created commitment plan. Required. - :type commitment_plan: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update_plan( - self, - resource_group_name: str, - commitment_plan_name: str, - commitment_plan: Union[_models.CommitmentPlan, JSON, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CommitmentPlan]: - """Create Cognitive Services commitment plan. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The parameters to provide for the created commitment plan. Is one of - the following types: CommitmentPlan, JSON, IO[bytes] Required. - :type commitment_plan: ~azure.mgmt.cognitiveservices.models.CommitmentPlan or JSON or IO[bytes] - :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, rai_policy_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified Content Filters associated with the subscription. + + :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services + Account. Required. + :type rai_policy_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CommitmentPlan] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_plan_initial( - resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, - commitment_plan=commitment_plan, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs + raw_result = self._delete_initial( + rai_policy_name=rai_policy_name, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.CommitmentPlan, response.json()) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -8595,23 +11995,60 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.CommitmentPlan].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.CommitmentPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class RaiBlocklistItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`rai_blocklist_items` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - def _update_plan_initial( + @distributed_trace + def get( self, resource_group_name: str, - commitment_plan_name: str, - commitment_plan: Union[_models.PatchResourceTagsAndSku, JSON, IO[bytes]], + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, **kwargs: Any - ) -> Iterator[bytes]: + ) -> _models.RaiBlocklistItem: + """Gets the specified custom blocklist Item associated with the custom blocklist. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :return: RaiBlocklistItem. The RaiBlocklistItem is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8620,26 +12057,18 @@ def _update_plan_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(commitment_plan, (IOBase, bytes)): - _content = commitment_plan - else: - _content = json.dumps(commitment_plan, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.RaiBlocklistItem] = kwargs.pop("cls", None) - _request = build_commitment_plans_update_plan_request( + _request = build_rai_blocklist_items_get_request( resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -8649,18 +12078,19 @@ def _update_plan_initial( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -8668,184 +12098,228 @@ def _update_plan_initial( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RaiBlocklistItem, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @overload - def begin_update_plan( + def create_or_update( self, resource_group_name: str, - commitment_plan_name: str, - commitment_plan: _models.PatchResourceTagsAndSku, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + rai_blocklist_item: _models.RaiBlocklistItem, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommitmentPlan]: - """Create Cognitive Services commitment plan. + ) -> _models.RaiBlocklistItem: + """Update the state of specified blocklist item associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The parameters to provide for the created commitment plan. Required. - :type commitment_plan: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :param rai_blocklist_item: Properties describing the custom blocklist. Required. + :type rai_blocklist_item: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :return: RaiBlocklistItem. The RaiBlocklistItem is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_plan( + def create_or_update( self, resource_group_name: str, - commitment_plan_name: str, - commitment_plan: JSON, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + rai_blocklist_item: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommitmentPlan]: - """Create Cognitive Services commitment plan. + ) -> _models.RaiBlocklistItem: + """Update the state of specified blocklist item associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The parameters to provide for the created commitment plan. Required. - :type commitment_plan: JSON + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :param rai_blocklist_item: Properties describing the custom blocklist. Required. + :type rai_blocklist_item: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :return: RaiBlocklistItem. The RaiBlocklistItem is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_plan( + def create_or_update( self, resource_group_name: str, - commitment_plan_name: str, - commitment_plan: IO[bytes], + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + rai_blocklist_item: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommitmentPlan]: - """Create Cognitive Services commitment plan. + ) -> _models.RaiBlocklistItem: + """Update the state of specified blocklist item associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The parameters to provide for the created commitment plan. Required. - :type commitment_plan: IO[bytes] + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :param rai_blocklist_item: Properties describing the custom blocklist. Required. + :type rai_blocklist_item: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :return: RaiBlocklistItem. The RaiBlocklistItem is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_plan( + def create_or_update( self, resource_group_name: str, - commitment_plan_name: str, - commitment_plan: Union[_models.PatchResourceTagsAndSku, JSON, IO[bytes]], + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + rai_blocklist_item: Union[_models.RaiBlocklistItem, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.CommitmentPlan]: - """Create Cognitive Services commitment plan. + ) -> _models.RaiBlocklistItem: + """Update the state of specified blocklist item associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan: The parameters to provide for the created commitment plan. Is one of - the following types: PatchResourceTagsAndSku, JSON, IO[bytes] Required. - :type commitment_plan: ~azure.mgmt.cognitiveservices.models.PatchResourceTagsAndSku or JSON or + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str + :param rai_blocklist_item: Properties describing the custom blocklist. Is one of the following + types: RaiBlocklistItem, JSON, IO[bytes] Required. + :type rai_blocklist_item: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem or JSON or IO[bytes] - :return: An instance of LROPoller that returns CommitmentPlan. The CommitmentPlan is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :return: RaiBlocklistItem. The RaiBlocklistItem is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CommitmentPlan] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_plan_initial( - resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, - commitment_plan=commitment_plan, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.RaiBlocklistItem] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.CommitmentPlan, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + content_type = content_type or "application/json" + _content = None + if isinstance(rai_blocklist_item, (IOBase, bytes)): + _content = rai_blocklist_item + else: + _content = json.dumps(rai_blocklist_item, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _request = build_rai_blocklist_items_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - polling_method = polling - if cont_token: - return LROPoller[_models.CommitmentPlan].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CommitmentPlan]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + deserialized = _deserialize(_models.RaiBlocklistItem, response.json()) - def _delete_plan_initial( - self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8860,9 +12334,11 @@ def _delete_plan_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_commitment_plans_delete_plan_request( + _request = build_rai_blocklist_items_delete_request( resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -8881,7 +12357,7 @@ def _delete_plan_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -8906,15 +12382,27 @@ def _delete_plan_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_plan(self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a Cognitive Services commitment plan from the resource group. + def begin_delete( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified blocklist Item associated with the custom blocklist. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom + blocklist. Required. + :type rai_blocklist_item_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -8927,9 +12415,11 @@ def begin_delete_plan(self, resource_group_name: str, commitment_plan_name: str, lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_plan_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -8964,113 +12454,27 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_plans_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.CommitmentPlan"]: - """Returns all the resources of a particular type belonging to a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of CommitmentPlan - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentPlan] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.CommitmentPlan]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_commitment_plans_list_plans_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.CommitmentPlan], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_plans_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.CommitmentPlan"]: - """Returns all the resources of a particular type belonging to a subscription. + def list( + self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any + ) -> ItemPaged["_models.RaiBlocklistItem"]: + """Gets the blocklist items associated with the custom blocklist. - :return: An iterator like instance of CommitmentPlan - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :return: An iterator like instance of RaiBlocklistItem + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiBlocklistItem] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CommitmentPlan]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RaiBlocklistItem]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9083,7 +12487,10 @@ def list_plans_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.Commit def prepare_request(next_link=None): if not next_link: - _request = build_commitment_plans_list_plans_by_subscription_request( + _request = build_rai_blocklist_items_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -9107,7 +12514,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9121,7 +12531,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.CommitmentPlan], + List[_models.RaiBlocklistItem], deserialized.get("value", []), ) if cls: @@ -9147,26 +12557,284 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged(get_next, extract_data) + return ItemPaged(get_next, extract_data) + + @overload + def batch_add( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_items: List[_models.RaiBlocklistItemBulkRequest], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiBlocklist: + """Batch operation to add blocklist items. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_items: Properties describing the custom blocklist items. Required. + :type rai_blocklist_items: + list[~azure.mgmt.cognitiveservices.models.RaiBlocklistItemBulkRequest] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def batch_add( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_items: List[JSON], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiBlocklist: + """Batch operation to add blocklist items. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_items: Properties describing the custom blocklist items. Required. + :type rai_blocklist_items: list[JSON] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def batch_add( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_items: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.RaiBlocklist: + """Batch operation to add blocklist items. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_items: Properties describing the custom blocklist items. Required. + :type rai_blocklist_items: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def batch_add( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_items: Union[List[_models.RaiBlocklistItemBulkRequest], List[JSON], IO[bytes]], + **kwargs: Any + ) -> _models.RaiBlocklist: + """Batch operation to add blocklist items. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_items: Properties describing the custom blocklist items. Is one of the + following types: [RaiBlocklistItemBulkRequest], [JSON], IO[bytes] Required. + :type rai_blocklist_items: + list[~azure.mgmt.cognitiveservices.models.RaiBlocklistItemBulkRequest] or list[JSON] or + IO[bytes] + :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RaiBlocklist] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(rai_blocklist_items, (IOBase, bytes)): + _content = rai_blocklist_items + else: + _content = json.dumps(rai_blocklist_items, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_rai_blocklist_items_batch_add_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RaiBlocklist, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def batch_delete( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_items_names: List[str], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Batch operation to delete blocklist items. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_items_names: List of RAI Blocklist Items Names. Required. + :type rai_blocklist_items_names: list[str] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def batch_delete( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_items_names: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Batch operation to delete blocklist items. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_items_names: List of RAI Blocklist Items Names. Required. + :type rai_blocklist_items_names: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get_association( - self, resource_group_name: str, commitment_plan_name: str, commitment_plan_association_name: str, **kwargs: Any - ) -> _models.CommitmentPlanAccountAssociation: - """Gets the association of the Cognitive Services commitment plan. + def batch_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist_items_names: Union[List[str], IO[bytes]], + **kwargs: Any + ) -> None: + """Batch operation to delete blocklist items. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan_association_name: The name of the commitment plan association with the - Cognitive Services Account. Required. - :type commitment_plan_association_name: str - :return: CommitmentPlanAccountAssociation. The CommitmentPlanAccountAssociation is compatible - with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist_items_names: List of RAI Blocklist Items Names. Is either a [str] type or + a IO[bytes] type. Required. + :type rai_blocklist_items_names: list[str] or IO[bytes] + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9177,17 +12845,27 @@ def get_association( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CommitmentPlanAccountAssociation] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_commitment_plans_get_association_request( + content_type = content_type or "application/json" + _content = None + if isinstance(rai_blocklist_items_names, (IOBase, bytes)): + _content = rai_blocklist_items_names + else: + _content = json.dumps(rai_blocklist_items_names, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_rai_blocklist_items_batch_delete_request( resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, - commitment_plan_association_name=commitment_plan_association_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -9196,20 +12874,14 @@ def get_association( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -9217,24 +12889,47 @@ def get_association( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.CommitmentPlanAccountAssociation, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, None, {}) # type: ignore - return deserialized # type: ignore - def _create_or_update_association_initial( - self, - resource_group_name: str, - commitment_plan_name: str, - commitment_plan_association_name: str, - association: Union[_models.CommitmentPlanAccountAssociation, JSON, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: +class RaiBlocklistsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`rai_blocklists` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any + ) -> _models.RaiBlocklist: + """Gets the specified custom blocklist associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -9243,27 +12938,17 @@ def _create_or_update_association_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(association, (IOBase, bytes)): - _content = association - else: - _content = json.dumps(association, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.RaiBlocklist] = kwargs.pop("cls", None) - _request = build_commitment_plans_create_or_update_association_request( + _request = build_rai_blocklists_get_request( resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, - commitment_plan_association_name=commitment_plan_association_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -9273,18 +12958,19 @@ def _create_or_update_association_initial( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -9292,207 +12978,205 @@ def _create_or_update_association_initial( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RaiBlocklist, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @overload - def begin_create_or_update_association( + def create_or_update( self, resource_group_name: str, - commitment_plan_name: str, - commitment_plan_association_name: str, - association: _models.CommitmentPlanAccountAssociation, + account_name: str, + rai_blocklist_name: str, + rai_blocklist: _models.RaiBlocklist, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommitmentPlanAccountAssociation]: - """Create or update the association of the Cognitive Services commitment plan. + ) -> _models.RaiBlocklist: + """Update the state of specified blocklist associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan_association_name: The name of the commitment plan association with the - Cognitive Services Account. Required. - :type commitment_plan_association_name: str - :param association: The commitmentPlan properties. Required. - :type association: ~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist: Properties describing the custom blocklist. Required. + :type rai_blocklist: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns CommitmentPlanAccountAssociation. The - CommitmentPlanAccountAssociation is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation] + :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update_association( + def create_or_update( self, resource_group_name: str, - commitment_plan_name: str, - commitment_plan_association_name: str, - association: JSON, + account_name: str, + rai_blocklist_name: str, + rai_blocklist: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommitmentPlanAccountAssociation]: - """Create or update the association of the Cognitive Services commitment plan. + ) -> _models.RaiBlocklist: + """Update the state of specified blocklist associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan_association_name: The name of the commitment plan association with the - Cognitive Services Account. Required. - :type commitment_plan_association_name: str - :param association: The commitmentPlan properties. Required. - :type association: JSON + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist: Properties describing the custom blocklist. Required. + :type rai_blocklist: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns CommitmentPlanAccountAssociation. The - CommitmentPlanAccountAssociation is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation] + :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update_association( - self, - resource_group_name: str, - commitment_plan_name: str, - commitment_plan_association_name: str, - association: IO[bytes], + def create_or_update( + self, + resource_group_name: str, + account_name: str, + rai_blocklist_name: str, + rai_blocklist: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommitmentPlanAccountAssociation]: - """Create or update the association of the Cognitive Services commitment plan. + ) -> _models.RaiBlocklist: + """Update the state of specified blocklist associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan_association_name: The name of the commitment plan association with the - Cognitive Services Account. Required. - :type commitment_plan_association_name: str - :param association: The commitmentPlan properties. Required. - :type association: IO[bytes] + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist: Properties describing the custom blocklist. Required. + :type rai_blocklist: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns CommitmentPlanAccountAssociation. The - CommitmentPlanAccountAssociation is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation] + :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update_association( + def create_or_update( self, resource_group_name: str, - commitment_plan_name: str, - commitment_plan_association_name: str, - association: Union[_models.CommitmentPlanAccountAssociation, JSON, IO[bytes]], + account_name: str, + rai_blocklist_name: str, + rai_blocklist: Union[_models.RaiBlocklist, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.CommitmentPlanAccountAssociation]: - """Create or update the association of the Cognitive Services commitment plan. + ) -> _models.RaiBlocklist: + """Update the state of specified blocklist associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan_association_name: The name of the commitment plan association with the - Cognitive Services Account. Required. - :type commitment_plan_association_name: str - :param association: The commitmentPlan properties. Is one of the following types: - CommitmentPlanAccountAssociation, JSON, IO[bytes] Required. - :type association: ~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation or - JSON or IO[bytes] - :return: An instance of LROPoller that returns CommitmentPlanAccountAssociation. The - CommitmentPlanAccountAssociation is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation] + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str + :param rai_blocklist: Properties describing the custom blocklist. Is one of the following + types: RaiBlocklist, JSON, IO[bytes] Required. + :type rai_blocklist: ~azure.mgmt.cognitiveservices.models.RaiBlocklist or JSON or IO[bytes] + :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CommitmentPlanAccountAssociation] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_association_initial( - resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, - commitment_plan_association_name=commitment_plan_association_name, - association=association, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.RaiBlocklist] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.CommitmentPlanAccountAssociation, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + content_type = content_type or "application/json" + _content = None + if isinstance(rai_blocklist, (IOBase, bytes)): + _content = rai_blocklist + else: + _content = json.dumps(rai_blocklist, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _request = build_rai_blocklists_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - polling_method = polling - if cont_token: - return LROPoller[_models.CommitmentPlanAccountAssociation].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CommitmentPlanAccountAssociation]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + deserialized = _deserialize(_models.RaiBlocklist, response.json()) - def _delete_association_initial( - self, resource_group_name: str, commitment_plan_name: str, commitment_plan_association_name: str, **kwargs: Any + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9507,10 +13191,10 @@ def _delete_association_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_commitment_plans_delete_association_request( + _request = build_rai_blocklists_delete_request( resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, - commitment_plan_association_name=commitment_plan_association_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -9529,7 +13213,7 @@ def _delete_association_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -9554,20 +13238,19 @@ def _delete_association_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_association( - self, resource_group_name: str, commitment_plan_name: str, commitment_plan_association_name: str, **kwargs: Any + def begin_delete( + self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes the association of the Cognitive Services commitment plan. + """Deletes the specified custom blocklist associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :param commitment_plan_association_name: The name of the commitment plan association with the - Cognitive Services Account. Required. - :type commitment_plan_association_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services + Account. Required. + :type rai_blocklist_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -9580,10 +13263,10 @@ def begin_delete_association( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_association_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, - commitment_plan_association_name=commitment_plan_association_name, + account_name=account_name, + rai_blocklist_name=rai_blocklist_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -9618,26 +13301,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list_associations( - self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any - ) -> ItemPaged["_models.CommitmentPlanAccountAssociation"]: - """Gets the associations of the Cognitive Services commitment plan. + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.RaiBlocklist"]: + """Gets the custom blocklists associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param commitment_plan_name: The name of the commitmentPlan associated with the Cognitive - Services Account. Required. - :type commitment_plan_name: str - :return: An iterator like instance of CommitmentPlanAccountAssociation - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation] + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An iterator like instance of RaiBlocklist + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiBlocklist] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CommitmentPlanAccountAssociation]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RaiBlocklist]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9650,9 +13329,9 @@ def list_associations( def prepare_request(next_link=None): if not next_link: - _request = build_commitment_plans_list_associations_request( + _request = build_rai_blocklists_list_request( resource_group_name=resource_group_name, - commitment_plan_name=commitment_plan_name, + account_name=account_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -9676,7 +13355,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -9690,7 +13372,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.CommitmentPlanAccountAssociation], + List[_models.RaiBlocklist], deserialized.get("value", []), ) if cls: @@ -9719,14 +13401,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class EncryptionScopesOperations: +class RaiTopicsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`encryption_scopes` attribute. + :attr:`rai_topics` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -9739,21 +13421,19 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any - ) -> _models.EncryptionScope: - """Gets the specified EncryptionScope associated with the Cognitive Services account. + def get(self, resource_group_name: str, account_name: str, rai_topic_name: str, **kwargs: Any) -> _models.RaiTopic: + """Gets the specified custom topic associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive - Services Account. Required. - :type encryption_scope_name: str - :return: EncryptionScope. The EncryptionScope is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services + Account. Required. + :type rai_topic_name: str + :return: RaiTopic. The RaiTopic is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiTopic :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9767,12 +13447,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.EncryptionScope] = kwargs.pop("cls", None) + cls: ClsType[_models.RaiTopic] = kwargs.pop("cls", None) - _request = build_encryption_scopes_get_request( + _request = build_rai_topics_get_request( resource_group_name=resource_group_name, account_name=account_name, - encryption_scope_name=encryption_scope_name, + rai_topic_name=rai_topic_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -9807,7 +13487,7 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EncryptionScope, response.json()) + deserialized = _deserialize(_models.RaiTopic, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -9819,29 +13499,29 @@ def create_or_update( self, resource_group_name: str, account_name: str, - encryption_scope_name: str, - encryption_scope: _models.EncryptionScope, + rai_topic_name: str, + rai_topic: _models.RaiTopic, *, content_type: str = "application/json", - **kwargs: Any - ) -> _models.EncryptionScope: - """Update the state of specified encryptionScope associated with the Cognitive Services account. + **kwargs: Any + ) -> _models.RaiTopic: + """Create the rai topic associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive - Services Account. Required. - :type encryption_scope_name: str - :param encryption_scope: The encryptionScope properties. Required. - :type encryption_scope: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services + Account. Required. + :type rai_topic_name: str + :param rai_topic: Properties describing the rai topic. Required. + :type rai_topic: ~azure.mgmt.cognitiveservices.models.RaiTopic :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EncryptionScope. The EncryptionScope is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :return: RaiTopic. The RaiTopic is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiTopic :raises ~azure.core.exceptions.HttpResponseError: """ @@ -9850,29 +13530,29 @@ def create_or_update( self, resource_group_name: str, account_name: str, - encryption_scope_name: str, - encryption_scope: JSON, + rai_topic_name: str, + rai_topic: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EncryptionScope: - """Update the state of specified encryptionScope associated with the Cognitive Services account. + ) -> _models.RaiTopic: + """Create the rai topic associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive - Services Account. Required. - :type encryption_scope_name: str - :param encryption_scope: The encryptionScope properties. Required. - :type encryption_scope: JSON + :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services + Account. Required. + :type rai_topic_name: str + :param rai_topic: Properties describing the rai topic. Required. + :type rai_topic: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: EncryptionScope. The EncryptionScope is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :return: RaiTopic. The RaiTopic is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiTopic :raises ~azure.core.exceptions.HttpResponseError: """ @@ -9881,29 +13561,29 @@ def create_or_update( self, resource_group_name: str, account_name: str, - encryption_scope_name: str, - encryption_scope: IO[bytes], + rai_topic_name: str, + rai_topic: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.EncryptionScope: - """Update the state of specified encryptionScope associated with the Cognitive Services account. + ) -> _models.RaiTopic: + """Create the rai topic associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive - Services Account. Required. - :type encryption_scope_name: str - :param encryption_scope: The encryptionScope properties. Required. - :type encryption_scope: IO[bytes] + :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services + Account. Required. + :type rai_topic_name: str + :param rai_topic: Properties describing the rai topic. Required. + :type rai_topic: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: EncryptionScope. The EncryptionScope is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :return: RaiTopic. The RaiTopic is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiTopic :raises ~azure.core.exceptions.HttpResponseError: """ @@ -9912,26 +13592,25 @@ def create_or_update( self, resource_group_name: str, account_name: str, - encryption_scope_name: str, - encryption_scope: Union[_models.EncryptionScope, JSON, IO[bytes]], + rai_topic_name: str, + rai_topic: Union[_models.RaiTopic, JSON, IO[bytes]], **kwargs: Any - ) -> _models.EncryptionScope: - """Update the state of specified encryptionScope associated with the Cognitive Services account. + ) -> _models.RaiTopic: + """Create the rai topic associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive - Services Account. Required. - :type encryption_scope_name: str - :param encryption_scope: The encryptionScope properties. Is one of the following types: - EncryptionScope, JSON, IO[bytes] Required. - :type encryption_scope: ~azure.mgmt.cognitiveservices.models.EncryptionScope or JSON or - IO[bytes] - :return: EncryptionScope. The EncryptionScope is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope + :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services + Account. Required. + :type rai_topic_name: str + :param rai_topic: Properties describing the rai topic. Is one of the following types: RaiTopic, + JSON, IO[bytes] Required. + :type rai_topic: ~azure.mgmt.cognitiveservices.models.RaiTopic or JSON or IO[bytes] + :return: RaiTopic. The RaiTopic is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiTopic :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9946,19 +13625,19 @@ def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.EncryptionScope] = kwargs.pop("cls", None) + cls: ClsType[_models.RaiTopic] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(encryption_scope, (IOBase, bytes)): - _content = encryption_scope + if isinstance(rai_topic, (IOBase, bytes)): + _content = rai_topic else: - _content = json.dumps(encryption_scope, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(rai_topic, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_encryption_scopes_create_or_update_request( + _request = build_rai_topics_create_or_update_request( resource_group_name=resource_group_name, account_name=account_name, - encryption_scope_name=encryption_scope_name, + rai_topic_name=rai_topic_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -9995,7 +13674,7 @@ def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.EncryptionScope, response.json()) + deserialized = _deserialize(_models.RaiTopic, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10003,7 +13682,7 @@ def create_or_update( return deserialized # type: ignore def _delete_initial( - self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, rai_topic_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10018,10 +13697,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_encryption_scopes_delete_request( + _request = build_rai_topics_delete_request( resource_group_name=resource_group_name, account_name=account_name, - encryption_scope_name=encryption_scope_name, + rai_topic_name=rai_topic_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -10066,18 +13745,18 @@ def _delete_initial( @distributed_trace def begin_delete( - self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, rai_topic_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes the specified encryptionScope associated with the Cognitive Services account. + """Deletes the specified custom topic associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param encryption_scope_name: The name of the encryptionScope associated with the Cognitive - Services Account. Required. - :type encryption_scope_name: str + :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services + Account. Required. + :type rai_topic_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -10093,7 +13772,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, - encryption_scope_name=encryption_scope_name, + rai_topic_name=rai_topic_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10128,22 +13807,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.EncryptionScope"]: - """Gets the content filters associated with the Azure OpenAI account. + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.RaiTopic"]: + """Gets the custom topics associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: An iterator like instance of EncryptionScope - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.EncryptionScope] + :return: An iterator like instance of RaiTopic + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiTopic] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.EncryptionScope]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RaiTopic]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10156,7 +13835,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It def prepare_request(next_link=None): if not next_link: - _request = build_encryption_scopes_list_request( + _request = build_rai_topics_list_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -10182,7 +13861,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -10196,7 +13878,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.EncryptionScope], + List[_models.RaiTopic], deserialized.get("value", []), ) if cls: @@ -10225,14 +13907,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class RaiPoliciesOperations: +class RaiToolLabelsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`rai_policies` attribute. + :attr:`rai_tool_labels` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -10246,20 +13928,19 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def get( - self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any - ) -> _models.RaiPolicy: - """Gets the specified Content Filters associated with the Azure OpenAI account. + self, resource_group_name: str, account_name: str, rai_tool_connection_name: str, **kwargs: Any + ) -> _models.RaiToolLabel: + """Gets the specified RAI Tool Label associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :param rai_tool_connection_name: The name of the Rai Tool Label. Required. + :type rai_tool_connection_name: str + :return: RaiToolLabel. The RaiToolLabel is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiToolLabel :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10273,12 +13954,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RaiPolicy] = kwargs.pop("cls", None) + cls: ClsType[_models.RaiToolLabel] = kwargs.pop("cls", None) - _request = build_rai_policies_get_request( + _request = build_rai_tool_labels_get_request( resource_group_name=resource_group_name, account_name=account_name, - rai_policy_name=rai_policy_name, + rai_tool_connection_name=rai_tool_connection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -10313,7 +13994,7 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RaiPolicy, response.json()) + deserialized = _deserialize(_models.RaiToolLabel, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10325,29 +14006,28 @@ def create_or_update( self, resource_group_name: str, account_name: str, - rai_policy_name: str, - rai_policy: _models.RaiPolicy, + rai_tool_connection_name: str, + rai_tool_label: _models.RaiToolLabel, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiPolicy: - """Update the state of specified Content Filters associated with the Azure OpenAI account. + ) -> _models.RaiToolLabel: + """Creates the RAI Tool Label associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :param rai_policy: Properties describing the Content Filters. Required. - :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :param rai_tool_connection_name: The name of the Rai Tool Label. Required. + :type rai_tool_connection_name: str + :param rai_tool_label: Properties describing the RAI Tool Label. Required. + :type rai_tool_label: ~azure.mgmt.cognitiveservices.models.RaiToolLabel :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :return: RaiToolLabel. The RaiToolLabel is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiToolLabel :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10356,29 +14036,28 @@ def create_or_update( self, resource_group_name: str, account_name: str, - rai_policy_name: str, - rai_policy: JSON, + rai_tool_connection_name: str, + rai_tool_label: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiPolicy: - """Update the state of specified Content Filters associated with the Azure OpenAI account. + ) -> _models.RaiToolLabel: + """Creates the RAI Tool Label associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :param rai_policy: Properties describing the Content Filters. Required. - :type rai_policy: JSON + :param rai_tool_connection_name: The name of the Rai Tool Label. Required. + :type rai_tool_connection_name: str + :param rai_tool_label: Properties describing the RAI Tool Label. Required. + :type rai_tool_label: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :return: RaiToolLabel. The RaiToolLabel is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiToolLabel :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10387,29 +14066,28 @@ def create_or_update( self, resource_group_name: str, account_name: str, - rai_policy_name: str, - rai_policy: IO[bytes], + rai_tool_connection_name: str, + rai_tool_label: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiPolicy: - """Update the state of specified Content Filters associated with the Azure OpenAI account. + ) -> _models.RaiToolLabel: + """Creates the RAI Tool Label associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :param rai_policy: Properties describing the Content Filters. Required. - :type rai_policy: IO[bytes] + :param rai_tool_connection_name: The name of the Rai Tool Label. Required. + :type rai_tool_connection_name: str + :param rai_tool_label: Properties describing the RAI Tool Label. Required. + :type rai_tool_label: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :return: RaiToolLabel. The RaiToolLabel is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiToolLabel :raises ~azure.core.exceptions.HttpResponseError: """ @@ -10418,25 +14096,24 @@ def create_or_update( self, resource_group_name: str, account_name: str, - rai_policy_name: str, - rai_policy: Union[_models.RaiPolicy, JSON, IO[bytes]], + rai_tool_connection_name: str, + rai_tool_label: Union[_models.RaiToolLabel, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RaiPolicy: - """Update the state of specified Content Filters associated with the Azure OpenAI account. + ) -> _models.RaiToolLabel: + """Creates the RAI Tool Label associated with the Azure OpenAI account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :param rai_policy: Properties describing the Content Filters. Is one of the following types: - RaiPolicy, JSON, IO[bytes] Required. - :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy or JSON or IO[bytes] - :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :param rai_tool_connection_name: The name of the Rai Tool Label. Required. + :type rai_tool_connection_name: str + :param rai_tool_label: Properties describing the RAI Tool Label. Is one of the following types: + RaiToolLabel, JSON, IO[bytes] Required. + :type rai_tool_label: ~azure.mgmt.cognitiveservices.models.RaiToolLabel or JSON or IO[bytes] + :return: RaiToolLabel. The RaiToolLabel is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiToolLabel :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10451,19 +14128,19 @@ def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RaiPolicy] = kwargs.pop("cls", None) + cls: ClsType[_models.RaiToolLabel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(rai_policy, (IOBase, bytes)): - _content = rai_policy + if isinstance(rai_tool_label, (IOBase, bytes)): + _content = rai_tool_label else: - _content = json.dumps(rai_policy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(rai_tool_label, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_rai_policies_create_or_update_request( + _request = build_rai_tool_labels_create_or_update_request( resource_group_name=resource_group_name, account_name=account_name, - rai_policy_name=rai_policy_name, + rai_tool_connection_name=rai_tool_connection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -10500,7 +14177,7 @@ def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RaiPolicy, response.json()) + deserialized = _deserialize(_models.RaiToolLabel, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -10508,7 +14185,7 @@ def create_or_update( return deserialized # type: ignore def _delete_initial( - self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, rai_tool_connection_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10523,10 +14200,262 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_rai_policies_delete_request( - resource_group_name=resource_group_name, - account_name=account_name, - rai_policy_name=rai_policy_name, + _request = build_rai_tool_labels_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + rai_tool_connection_name=rai_tool_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, rai_tool_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified RAI Tool Label associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param rai_tool_connection_name: The name of the Rai Tool Label. Required. + :type rai_tool_connection_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + rai_tool_connection_name=rai_tool_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.RaiToolLabel"]: + """Lists all RAI Tool Labels associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An iterator like instance of RaiToolLabel + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiToolLabel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RaiToolLabel]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_rai_tool_labels_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RaiToolLabel], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RaiContentFiltersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`rai_content_filters` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, location: str, filter_name: str, **kwargs: Any) -> _models.RaiContentFilter: + """Get Content Filters by Name. + + :param location: The name of the Azure region. Required. + :type location: str + :param filter_name: The name of the RAI Content Filter. Required. + :type filter_name: str + :return: RaiContentFilter. The RaiContentFilter is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiContentFilter + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RaiContentFilter] = kwargs.pop("cls", None) + + _request = build_rai_content_filters_get_request( + location=location, + filter_name=filter_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -10538,18 +14467,19 @@ def _delete_initial( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -10557,98 +14487,30 @@ def _delete_initial( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RaiContentFilter, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_delete( - self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes the specified Content Filters associated with the Azure OpenAI account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - account_name=account_name, - rai_policy_name=rai_policy_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.RaiPolicy"]: - """Gets the content filters associated with the Azure OpenAI account. + def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.RaiContentFilter"]: + """List Content Filters types. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :return: An iterator like instance of RaiPolicy - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiPolicy] + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of RaiContentFilter + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiContentFilter] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RaiPolicy]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RaiContentFilter]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10661,9 +14523,8 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It def prepare_request(next_link=None): if not next_link: - _request = build_rai_policies_list_request( - resource_group_name=resource_group_name, - account_name=account_name, + _request = build_rai_content_filters_list_request( + location=location, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -10687,7 +14548,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -10701,7 +14565,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RaiPolicy], + List[_models.RaiContentFilter], deserialized.get("value", []), ) if cls: @@ -10730,14 +14594,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class SubscriptionRaiPolicyOperations: +class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`subscription_rai_policy` attribute. + :attr:`network_security_perimeter_configurations` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -10750,14 +14614,21 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, rai_policy_name: str, **kwargs: Any) -> _models.RaiPolicy: - """Gets the specified Content Filters associated with the Subscription. + def get( + self, resource_group_name: str, account_name: str, nsp_configuration_name: str, **kwargs: Any + ) -> _models.NetworkSecurityPerimeterConfiguration: + """Gets the specified NSP configurations for an account. - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param nsp_configuration_name: The name of the NSP Configuration. Required. + :type nsp_configuration_name: str + :return: NetworkSecurityPerimeterConfiguration. The NetworkSecurityPerimeterConfiguration is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10771,10 +14642,12 @@ def get(self, rai_policy_name: str, **kwargs: Any) -> _models.RaiPolicy: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RaiPolicy] = kwargs.pop("cls", None) + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) - _request = build_subscription_rai_policy_get_request( - rai_policy_name=rai_policy_name, + _request = build_network_security_perimeter_configurations_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + nsp_configuration_name=nsp_configuration_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -10809,91 +14682,34 @@ def get(self, rai_policy_name: str, **kwargs: Any) -> _models.RaiPolicy: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RaiPolicy, response.json()) + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def create_or_update( - self, - rai_policy_name: str, - rai_policy: _models.RaiPolicy, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RaiPolicy: - """Update the state of specified Content Filters associated with the subscription. - - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :param rai_policy: Properties describing the Content Filters. Required. - :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, rai_policy_name: str, rai_policy: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiPolicy: - """Update the state of specified Content Filters associated with the subscription. - - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :param rai_policy: Properties describing the Content Filters. Required. - :type rai_policy: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, rai_policy_name: str, rai_policy: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiPolicy: - """Update the state of specified Content Filters associated with the subscription. + @distributed_trace + def list( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.NetworkSecurityPerimeterConfiguration"]: + """Gets a list of NSP configurations for an account. - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :param rai_policy: Properties describing the Content Filters. Required. - :type rai_policy: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An iterator like instance of NetworkSecurityPerimeterConfiguration + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @distributed_trace - def create_or_update( - self, rai_policy_name: str, rai_policy: Union[_models.RaiPolicy, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RaiPolicy: - """Update the state of specified Content Filters associated with the subscription. + cls: ClsType[List[_models.NetworkSecurityPerimeterConfiguration]] = kwargs.pop("cls", None) - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :param rai_policy: Properties describing the Content Filters. Is one of the following types: - RaiPolicy, JSON, IO[bytes] Required. - :type rai_policy: ~azure.mgmt.cognitiveservices.models.RaiPolicy or JSON or IO[bytes] - :return: RaiPolicy. The RaiPolicy is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10902,65 +14718,83 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RaiPolicy] = kwargs.pop("cls", None) + _request = build_network_security_perimeter_configurations_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - content_type = content_type or "application/json" - _content = None - if isinstance(rai_policy, (IOBase, bytes)): - _content = rai_policy - else: - _content = json.dumps(rai_policy, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_subscription_rai_policy_create_or_update_request( - rai_policy_name=rai_policy_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NetworkSecurityPerimeterConfiguration], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - response = pipeline_response.http_response + def get_next(next_link=None): + _request = prepare_request(next_link) - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.RaiPolicy, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) - def _delete_initial(self, rai_policy_name: str, **kwargs: Any) -> Iterator[bytes]: + def _reconcile_initial( + self, resource_group_name: str, account_name: str, nsp_configuration_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10974,8 +14808,10 @@ def _delete_initial(self, rai_policy_name: str, **kwargs: Any) -> Iterator[bytes cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_subscription_rai_policy_delete_request( - rai_policy_name=rai_policy_name, + _request = build_network_security_perimeter_configurations_reconcile_request( + resource_group_name=resource_group_name, + account_name=account_name, + nsp_configuration_name=nsp_configuration_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -10994,7 +14830,7 @@ def _delete_initial(self, rai_policy_name: str, **kwargs: Any) -> Iterator[bytes response = pipeline_response.http_response - if response.status_code not in [202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -11019,33 +14855,50 @@ def _delete_initial(self, rai_policy_name: str, **kwargs: Any) -> Iterator[bytes return deserialized # type: ignore @distributed_trace - def begin_delete(self, rai_policy_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes the specified Content Filters associated with the subscription. + def begin_reconcile( + self, resource_group_name: str, account_name: str, nsp_configuration_name: str, **kwargs: Any + ) -> LROPoller[_models.NetworkSecurityPerimeterConfiguration]: + """Reconcile the NSP configuration for an account. - :param rai_policy_name: The name of the RaiPolicy associated with the Cognitive Services - Account. Required. - :type rai_policy_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param nsp_configuration_name: The name of the NSP Configuration. Required. + :type nsp_configuration_name: str + :return: An instance of LROPoller that returns NetworkSecurityPerimeterConfiguration. The + NetworkSecurityPerimeterConfiguration is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( - rai_policy_name=rai_policy_name, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + raw_result = self._reconcile_initial( + resource_group_name=resource_group_name, + account_name=account_name, + nsp_configuration_name=nsp_configuration_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -11060,58 +14913,225 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.NetworkSecurityPerimeterConfiguration].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.NetworkSecurityPerimeterConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class DefenderForAISettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`defender_for_ai_settings` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, defender_for_ai_setting_name: str, **kwargs: Any + ) -> _models.DefenderForAISetting: + """Gets the specified Defender for AI setting by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. + :type defender_for_ai_setting_name: str + :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DefenderForAISetting] = kwargs.pop("cls", None) + + _request = build_defender_for_ai_settings_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + defender_for_ai_setting_name=defender_for_ai_setting_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DefenderForAISetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + defender_for_ai_setting_name: str, + defender_for_ai_settings: _models.DefenderForAISetting, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DefenderForAISetting: + """Creates or Updates the specified Defender for AI setting. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. + :type defender_for_ai_setting_name: str + :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. + :type defender_for_ai_settings: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :raises ~azure.core.exceptions.HttpResponseError: + """ -class RaiBlocklistItemsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + defender_for_ai_setting_name: str, + defender_for_ai_settings: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DefenderForAISetting: + """Creates or Updates the specified Defender for AI setting. - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`rai_blocklist_items` attribute. - """ + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. + :type defender_for_ai_setting_name: str + :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. + :type defender_for_ai_settings: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def create_or_update( + self, + resource_group_name: str, + account_name: str, + defender_for_ai_setting_name: str, + defender_for_ai_settings: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DefenderForAISetting: + """Creates or Updates the specified Defender for AI setting. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. + :type defender_for_ai_setting_name: str + :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. + :type defender_for_ai_settings: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get( + def create_or_update( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist_item_name: str, + defender_for_ai_setting_name: str, + defender_for_ai_settings: Union[_models.DefenderForAISetting, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RaiBlocklistItem: - """Gets the specified custom blocklist Item associated with the custom blocklist. + ) -> _models.DefenderForAISetting: + """Creates or Updates the specified Defender for AI setting. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom - blocklist. Required. - :type rai_blocklist_item_name: str - :return: RaiBlocklistItem. The RaiBlocklistItem is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. + :type defender_for_ai_setting_name: str + :param defender_for_ai_settings: Properties describing the Defender for AI setting. Is one of + the following types: DefenderForAISetting, JSON, IO[bytes] Required. + :type defender_for_ai_settings: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting or + JSON or IO[bytes] + :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11122,18 +15142,27 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RaiBlocklistItem] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DefenderForAISetting] = kwargs.pop("cls", None) - _request = build_rai_blocklist_items_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(defender_for_ai_settings, (IOBase, bytes)): + _content = defender_for_ai_settings + else: + _content = json.dumps(defender_for_ai_settings, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_defender_for_ai_settings_create_or_update_request( resource_group_name=resource_group_name, account_name=account_name, - rai_blocklist_name=rai_blocklist_name, - rai_blocklist_item_name=rai_blocklist_item_name, + defender_for_ai_setting_name=defender_for_ai_setting_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -11150,7 +15179,7 @@ def get( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -11166,7 +15195,7 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RaiBlocklistItem, response.json()) + deserialized = _deserialize(_models.DefenderForAISetting, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -11174,139 +15203,119 @@ def get( return deserialized # type: ignore @overload - def create_or_update( + def update( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist_item_name: str, - rai_blocklist_item: _models.RaiBlocklistItem, + defender_for_ai_setting_name: str, + defender_for_ai_settings: _models.DefenderForAISetting, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiBlocklistItem: - """Update the state of specified blocklist item associated with the Azure OpenAI account. + ) -> _models.DefenderForAISetting: + """Updates the specified Defender for AI setting. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom - blocklist. Required. - :type rai_blocklist_item_name: str - :param rai_blocklist_item: Properties describing the custom blocklist. Required. - :type rai_blocklist_item: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. + :type defender_for_ai_setting_name: str + :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. + :type defender_for_ai_settings: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiBlocklistItem. The RaiBlocklistItem is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def update( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist_item_name: str, - rai_blocklist_item: JSON, + defender_for_ai_setting_name: str, + defender_for_ai_settings: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiBlocklistItem: - """Update the state of specified blocklist item associated with the Azure OpenAI account. + ) -> _models.DefenderForAISetting: + """Updates the specified Defender for AI setting. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom - blocklist. Required. - :type rai_blocklist_item_name: str - :param rai_blocklist_item: Properties describing the custom blocklist. Required. - :type rai_blocklist_item: JSON + :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. + :type defender_for_ai_setting_name: str + :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. + :type defender_for_ai_settings: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiBlocklistItem. The RaiBlocklistItem is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def update( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist_item_name: str, - rai_blocklist_item: IO[bytes], + defender_for_ai_setting_name: str, + defender_for_ai_settings: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiBlocklistItem: - """Update the state of specified blocklist item associated with the Azure OpenAI account. + ) -> _models.DefenderForAISetting: + """Updates the specified Defender for AI setting. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom - blocklist. Required. - :type rai_blocklist_item_name: str - :param rai_blocklist_item: Properties describing the custom blocklist. Required. - :type rai_blocklist_item: IO[bytes] + :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. + :type defender_for_ai_setting_name: str + :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. + :type defender_for_ai_settings: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RaiBlocklistItem. The RaiBlocklistItem is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def update( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist_item_name: str, - rai_blocklist_item: Union[_models.RaiBlocklistItem, JSON, IO[bytes]], + defender_for_ai_setting_name: str, + defender_for_ai_settings: Union[_models.DefenderForAISetting, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RaiBlocklistItem: - """Update the state of specified blocklist item associated with the Azure OpenAI account. + ) -> _models.DefenderForAISetting: + """Updates the specified Defender for AI setting. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom - blocklist. Required. - :type rai_blocklist_item_name: str - :param rai_blocklist_item: Properties describing the custom blocklist. Is one of the following - types: RaiBlocklistItem, JSON, IO[bytes] Required. - :type rai_blocklist_item: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem or JSON or - IO[bytes] - :return: RaiBlocklistItem. The RaiBlocklistItem is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem + :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. + :type defender_for_ai_setting_name: str + :param defender_for_ai_settings: Properties describing the Defender for AI setting. Is one of + the following types: DefenderForAISetting, JSON, IO[bytes] Required. + :type defender_for_ai_settings: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting or + JSON or IO[bytes] + :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11321,20 +15330,19 @@ def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RaiBlocklistItem] = kwargs.pop("cls", None) + cls: ClsType[_models.DefenderForAISetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None - if isinstance(rai_blocklist_item, (IOBase, bytes)): - _content = rai_blocklist_item + if isinstance(defender_for_ai_settings, (IOBase, bytes)): + _content = defender_for_ai_settings else: - _content = json.dumps(rai_blocklist_item, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(defender_for_ai_settings, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_rai_blocklist_items_create_or_update_request( + _request = build_defender_for_ai_settings_update_request( resource_group_name=resource_group_name, account_name=account_name, - rai_blocklist_name=rai_blocklist_name, - rai_blocklist_item_name=rai_blocklist_item_name, + defender_for_ai_setting_name=defender_for_ai_setting_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -11355,7 +15363,7 @@ def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -11371,175 +15379,32 @@ def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RaiBlocklistItem, response.json()) + deserialized = _deserialize(_models.DefenderForAISetting, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_initial( - self, - resource_group_name: str, - account_name: str, - rai_blocklist_name: str, - rai_blocklist_item_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_rai_blocklist_items_delete_request( - resource_group_name=resource_group_name, - account_name=account_name, - rai_blocklist_name=rai_blocklist_name, - rai_blocklist_item_name=rai_blocklist_item_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - account_name: str, - rai_blocklist_name: str, - rai_blocklist_item_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes the specified blocklist Item associated with the custom blocklist. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_item_name: The name of the RaiBlocklist Item associated with the custom - blocklist. Required. - :type rai_blocklist_item_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - account_name=account_name, - rai_blocklist_name=rai_blocklist_name, - rai_blocklist_item_name=rai_blocklist_item_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace def list( - self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any - ) -> ItemPaged["_models.RaiBlocklistItem"]: - """Gets the blocklist items associated with the custom blocklist. + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.DefenderForAISetting"]: + """Lists the Defender for AI settings. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :return: An iterator like instance of RaiBlocklistItem - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiBlocklistItem] + :return: An iterator like instance of DefenderForAISetting + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.DefenderForAISetting] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RaiBlocklistItem]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.DefenderForAISetting]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11552,10 +15417,9 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_rai_blocklist_items_list_request( + _request = build_defender_for_ai_settings_list_request( resource_group_name=resource_group_name, account_name=account_name, - rai_blocklist_name=rai_blocklist_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -11579,7 +15443,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -11593,7 +15460,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RaiBlocklistItem], + List[_models.DefenderForAISetting], deserialized.get("value", []), ) if cls: @@ -11621,126 +15488,39 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - @overload - def batch_add( - self, - resource_group_name: str, - account_name: str, - rai_blocklist_name: str, - rai_blocklist_items: List[_models.RaiBlocklistItemBulkRequest], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RaiBlocklist: - """Batch operation to add blocklist items. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_items: Properties describing the custom blocklist items. Required. - :type rai_blocklist_items: - list[~azure.mgmt.cognitiveservices.models.RaiBlocklistItemBulkRequest] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def batch_add( - self, - resource_group_name: str, - account_name: str, - rai_blocklist_name: str, - rai_blocklist_items: List[JSON], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RaiBlocklist: - """Batch operation to add blocklist items. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_items: Properties describing the custom blocklist items. Required. - :type rai_blocklist_items: list[JSON] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist - :raises ~azure.core.exceptions.HttpResponseError: - """ +class ProjectsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - def batch_add( - self, - resource_group_name: str, - account_name: str, - rai_blocklist_name: str, - rai_blocklist_items: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RaiBlocklist: - """Batch operation to add blocklist items. + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`projects` attribute. + """ - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_items: Properties describing the custom blocklist items. Required. - :type rai_blocklist_items: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist - :raises ~azure.core.exceptions.HttpResponseError: - """ + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def batch_add( - self, - resource_group_name: str, - account_name: str, - rai_blocklist_name: str, - rai_blocklist_items: Union[List[_models.RaiBlocklistItemBulkRequest], List[JSON], IO[bytes]], - **kwargs: Any - ) -> _models.RaiBlocklist: - """Batch operation to add blocklist items. + def get(self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any) -> _models.Project: + """Returns a Cognitive Services project specified by the parameters. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_items: Properties describing the custom blocklist items. Is one of the - following types: [RaiBlocklistItemBulkRequest], [JSON], IO[bytes] Required. - :type rai_blocklist_items: - list[~azure.mgmt.cognitiveservices.models.RaiBlocklistItemBulkRequest] or list[JSON] or - IO[bytes] - :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :return: Project. The Project is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.Project :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11751,27 +15531,17 @@ def batch_add( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RaiBlocklist] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(rai_blocklist_items, (IOBase, bytes)): - _content = rai_blocklist_items - else: - _content = json.dumps(rai_blocklist_items, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.Project] = kwargs.pop("cls", None) - _request = build_rai_blocklist_items_batch_add_request( + _request = build_projects_get_request( resource_group_name=resource_group_name, account_name=account_name, - rai_blocklist_name=rai_blocklist_name, + project_name=project_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -11804,194 +15574,277 @@ def batch_add( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RaiBlocklist, response.json()) + deserialized = _deserialize(_models.Project, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + def _create_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(project, (IOBase, bytes)): + _content = project + else: + _content = json.dumps(project, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_projects_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + @overload - def batch_delete( + def begin_create( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist_items_names: List[str], + project_name: str, + project: _models.Project, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Batch operation to delete blocklist items. + ) -> LROPoller[_models.Project]: + """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. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_items_names: List of RAI Blocklist Items Names. Required. - :type rai_blocklist_items_names: list[str] + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of LROPoller that returns Project. The Project is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def batch_delete( + def begin_create( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist_items_names: IO[bytes], + project_name: str, + project: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Batch operation to delete blocklist items. + ) -> LROPoller[_models.Project]: + """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. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_items_names: List of RAI Blocklist Items Names. Required. - :type rai_blocklist_items_names: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: An instance of LROPoller that returns Project. The Project is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace - def batch_delete( # pylint: disable=inconsistent-return-statements + @overload + def begin_create( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist_items_names: Union[List[str], IO[bytes]], + project_name: str, + project: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> None: - """Batch operation to delete blocklist items. + ) -> LROPoller[_models.Project]: + """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. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist_items_names: List of RAI Blocklist Items Names. Is either a [str] type or - a IO[bytes] type. Required. - :type rai_blocklist_items_names: list[str] or IO[bytes] - :return: None - :rtype: None + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Project. The Project is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Project]: + """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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Is one of the following + types: Project, JSON, IO[bytes] Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project or JSON or IO[bytes] + :return: An instance of LROPoller that returns Project. The Project is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.Project] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + project=project, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _content = None - if isinstance(rai_blocklist_items_names, (IOBase, bytes)): - _content = rai_blocklist_items_names - else: - _content = json.dumps(rai_blocklist_items_names, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Project, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _request = build_rai_blocklist_items_batch_delete_request( - resource_group_name=resource_group_name, - account_name=account_name, - rai_blocklist_name=rai_blocklist_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class RaiBlocklistsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`rai_blocklists` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Project].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Project]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get( - self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any - ) -> _models.RaiBlocklist: - """Gets the specified custom blocklist associated with the Azure OpenAI account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12000,17 +15853,27 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RaiBlocklist] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_rai_blocklists_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(project, (IOBase, bytes)): + _content = project + else: + _content = json.dumps(project, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_projects_update_request( resource_group_name=resource_group_name, account_name=account_name, - rai_blocklist_name=rai_blocklist_name, + project_name=project_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -12020,19 +15883,18 @@ def get( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -12040,205 +15902,191 @@ def get( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.RaiBlocklist, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def create_or_update( + def begin_update( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist: _models.RaiBlocklist, + project_name: str, + project: _models.Project, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiBlocklist: - """Update the state of specified blocklist associated with the Azure OpenAI account. + ) -> LROPoller[_models.Project]: + """Updates a Cognitive Services Project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist: Properties describing the custom blocklist. Required. - :type rai_blocklist: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :return: An instance of LROPoller that returns Project. The Project is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_update( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist: JSON, + project_name: str, + project: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiBlocklist: - """Update the state of specified blocklist associated with the Azure OpenAI account. + ) -> LROPoller[_models.Project]: + """Updates a Cognitive Services Project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist: Properties describing the custom blocklist. Required. - :type rai_blocklist: JSON + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :return: An instance of LROPoller that returns Project. The Project is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_update( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist: IO[bytes], + project_name: str, + project: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiBlocklist: - """Update the state of specified blocklist associated with the Azure OpenAI account. + ) -> LROPoller[_models.Project]: + """Updates a Cognitive Services Project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist: Properties describing the custom blocklist. Required. - :type rai_blocklist: IO[bytes] + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :return: An instance of LROPoller that returns Project. The Project is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def begin_update( self, resource_group_name: str, account_name: str, - rai_blocklist_name: str, - rai_blocklist: Union[_models.RaiBlocklist, JSON, IO[bytes]], + project_name: str, + project: Union[_models.Project, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RaiBlocklist: - """Update the state of specified blocklist associated with the Azure OpenAI account. + ) -> LROPoller[_models.Project]: + """Updates a Cognitive Services Project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str - :param rai_blocklist: Properties describing the custom blocklist. Is one of the following - types: RaiBlocklist, JSON, IO[bytes] Required. - :type rai_blocklist: ~azure.mgmt.cognitiveservices.models.RaiBlocklist or JSON or IO[bytes] - :return: RaiBlocklist. The RaiBlocklist is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Is one of the following + types: Project, JSON, IO[bytes] Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project or JSON or IO[bytes] + :return: An instance of LROPoller that returns Project. The Project is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RaiBlocklist] = kwargs.pop("cls", None) + cls: ClsType[_models.Project] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + project=project, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _content = None - if isinstance(rai_blocklist, (IOBase, bytes)): - _content = rai_blocklist - else: - _content = json.dumps(rai_blocklist, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Project, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _request = build_rai_blocklists_create_or_update_request( - resource_group_name=resource_group_name, - account_name=account_name, - rai_blocklist_name=rai_blocklist_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) else: - deserialized = _deserialize(_models.RaiBlocklist, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + polling_method = polling + if cont_token: + return LROPoller[_models.Project].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Project]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( - self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12253,10 +16101,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_rai_blocklists_delete_request( + _request = build_projects_delete_request( resource_group_name=resource_group_name, account_name=account_name, - rai_blocklist_name=rai_blocklist_name, + project_name=project_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -12275,7 +16123,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [202, 204]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -12301,18 +16149,17 @@ def _delete_initial( @distributed_trace def begin_delete( - self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes the specified custom blocklist associated with the Azure OpenAI account. + """Deletes a Cognitive Services project from the resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_blocklist_name: The name of the RaiBlocklist associated with the Cognitive Services - Account. Required. - :type rai_blocklist_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -12328,7 +16175,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, - rai_blocklist_name=rai_blocklist_name, + project_name=project_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -12363,22 +16210,22 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.RaiBlocklist"]: - """Gets the custom blocklists associated with the Azure OpenAI account. + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.Project"]: + """Returns all the projects in a Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: An iterator like instance of RaiBlocklist - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiBlocklist] + :return: An iterator like instance of Project + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Project] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RaiBlocklist]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Project]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12391,7 +16238,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It def prepare_request(next_link=None): if not next_link: - _request = build_rai_blocklists_list_request( + _request = build_projects_list_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -12417,7 +16264,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -12426,73 +16276,281 @@ def prepare_request(next_link=None): } _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Project], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ProjectConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`project_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, project_name: str, connection_name: str, **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Lists Cognitive Services project connection by name. + + Lists Cognitive Services project connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + _request = build_project_connections_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RaiBlocklist], - deserialized.get("value", []), + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - def get_next(next_link=None): - _request = prepare_request(next_link) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ConnectionPropertiesV2BasicResource, response.json()) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + return deserialized # type: ignore - return pipeline_response + @overload + def create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + connection: Optional[_models.ConnectionPropertiesV2BasicResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services project connection under the specified project. - return ItemPaged(get_next, extract_data) + Create or update Cognitive Services project connection under the specified project. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param connection: The object for creating or updating a new account connection. Default value + is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ -class RaiTopicsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @overload + def create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + connection: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services project connection under the specified project. - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`rai_topics` attribute. - """ + Create or update Cognitive Services project connection under the specified project. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param connection: The object for creating or updating a new account connection. Default value + is None. + :type connection: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + connection: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services project connection under the specified project. + + Create or update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param connection: The object for creating or updating a new account connection. Default value + is None. + :type connection: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get(self, resource_group_name: str, account_name: str, rai_topic_name: str, **kwargs: Any) -> _models.RaiTopic: - """Gets the specified custom topic associated with the Azure OpenAI account. + def create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + connection: Optional[Union[_models.ConnectionPropertiesV2BasicResource, JSON, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services project connection under the specified project. + + Create or update Cognitive Services project connection under the specified project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services - Account. Required. - :type rai_topic_name: str - :return: RaiTopic. The RaiTopic is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiTopic + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param connection: The object for creating or updating a new account connection. Is one of the + following types: ConnectionPropertiesV2BasicResource, JSON, IO[bytes] Default value is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource or + JSON or IO[bytes] + :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12503,17 +16561,32 @@ def get(self, resource_group_name: str, account_name: str, rai_topic_name: str, } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RaiTopic] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if connection else None + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) - _request = build_rai_topics_get_request( + content_type = content_type or "application/json" if connection else None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + if connection is not None: + _content = json.dumps(connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_project_connections_create_request( resource_group_name=resource_group_name, account_name=account_name, - rai_topic_name=rai_topic_name, + project_name=project_name, + connection_name=connection_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -12546,7 +16619,7 @@ def get(self, resource_group_name: str, account_name: str, rai_topic_name: str, if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RaiTopic, response.json()) + deserialized = _deserialize(_models.ConnectionPropertiesV2BasicResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -12554,122 +16627,143 @@ def get(self, resource_group_name: str, account_name: str, rai_topic_name: str, return deserialized # type: ignore @overload - def create_or_update( + def update( self, resource_group_name: str, account_name: str, - rai_topic_name: str, - rai_topic: _models.RaiTopic, + project_name: str, + connection_name: str, + connection: Optional[_models.ConnectionUpdateContent] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiTopic: - """Create the rai topic associated with the Azure OpenAI account. + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services project connection under the specified project. + + Update Cognitive Services project connection under the specified project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services - Account. Required. - :type rai_topic_name: str - :param rai_topic: Properties describing the rai topic. Required. - :type rai_topic: ~azure.mgmt.cognitiveservices.models.RaiTopic + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param connection: Parameters for account connection update. Default value is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiTopic. The RaiTopic is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiTopic + :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def update( self, resource_group_name: str, - account_name: str, - rai_topic_name: str, - rai_topic: JSON, + account_name: str, + project_name: str, + connection_name: str, + connection: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiTopic: - """Create the rai topic associated with the Azure OpenAI account. + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services project connection under the specified project. + + Update Cognitive Services project connection under the specified project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services - Account. Required. - :type rai_topic_name: str - :param rai_topic: Properties describing the rai topic. Required. - :type rai_topic: JSON + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param connection: Parameters for account connection update. Default value is None. + :type connection: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiTopic. The RaiTopic is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiTopic + :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def update( self, resource_group_name: str, account_name: str, - rai_topic_name: str, - rai_topic: IO[bytes], + project_name: str, + connection_name: str, + connection: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiTopic: - """Create the rai topic associated with the Azure OpenAI account. + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services project connection under the specified project. + + Update Cognitive Services project connection under the specified project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services - Account. Required. - :type rai_topic_name: str - :param rai_topic: Properties describing the rai topic. Required. - :type rai_topic: IO[bytes] + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param connection: Parameters for account connection update. Default value is None. + :type connection: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RaiTopic. The RaiTopic is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiTopic + :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def update( self, resource_group_name: str, account_name: str, - rai_topic_name: str, - rai_topic: Union[_models.RaiTopic, JSON, IO[bytes]], + project_name: str, + connection_name: str, + connection: Optional[Union[_models.ConnectionUpdateContent, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> _models.RaiTopic: - """Create the rai topic associated with the Azure OpenAI account. + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services project connection under the specified project. + + Update Cognitive Services project connection under the specified project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services - Account. Required. - :type rai_topic_name: str - :param rai_topic: Properties describing the rai topic. Is one of the following types: RaiTopic, - JSON, IO[bytes] Required. - :type rai_topic: ~azure.mgmt.cognitiveservices.models.RaiTopic or JSON or IO[bytes] - :return: RaiTopic. The RaiTopic is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiTopic + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param connection: Parameters for account connection update. Is one of the following types: + ConnectionUpdateContent, JSON, IO[bytes] Default value is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent or JSON or + IO[bytes] + :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is + compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12684,19 +16778,24 @@ def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RaiTopic] = kwargs.pop("cls", None) + content_type = content_type if connection else None + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if connection else None _content = None - if isinstance(rai_topic, (IOBase, bytes)): - _content = rai_topic + if isinstance(connection, (IOBase, bytes)): + _content = connection else: - _content = json.dumps(rai_topic, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + if connection is not None: + _content = json.dumps(connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None - _request = build_rai_topics_create_or_update_request( + _request = build_project_connections_update_request( resource_group_name=resource_group_name, account_name=account_name, - rai_topic_name=rai_topic_name, + project_name=project_name, + connection_name=connection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -12717,7 +16816,7 @@ def create_or_update( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -12733,16 +16832,34 @@ def create_or_update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RaiTopic, response.json()) + deserialized = _deserialize(_models.ConnectionPropertiesV2BasicResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_initial( - self, resource_group_name: str, account_name: str, rai_topic_name: str, **kwargs: Any - ) -> Iterator[bytes]: + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, project_name: str, connection_name: str, **kwargs: Any + ) -> None: + """Delete Cognitive Services project connection by name. + + Delete Cognitive Services project connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12754,12 +16871,13 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_rai_topics_delete_request( + _request = build_project_connections_delete_request( resource_group_name=resource_group_name, account_name=account_name, - rai_topic_name=rai_topic_name, + project_name=project_name, + connection_name=connection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -12770,19 +16888,14 @@ def _delete_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -12790,98 +16903,48 @@ def _delete_initial( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace - def begin_delete( - self, resource_group_name: str, account_name: str, rai_topic_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes the specified custom topic associated with the Azure OpenAI account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param rai_topic_name: The name of the Rai Topic associated with the Cognitive Services - Account. Required. - :type rai_topic_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - account_name=account_name, - rai_topic_name=rai_topic_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + def list( + self, + resource_group_name: str, + account_name: str, + project_name: str, + *, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any + ) -> ItemPaged["_models.ConnectionPropertiesV2BasicResource"]: + """Lists all the available Cognitive Services project connections under the specified project. - @distributed_trace - def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.RaiTopic"]: - """Gets the custom topics associated with the Azure OpenAI account. + Lists all the available Cognitive Services project connections under the specified project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: An iterator like instance of RaiTopic - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiTopic] + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :keyword target: Target of the connection. Default value is None. + :paramtype target: str + :keyword category: Category of the connection. Default value is None. + :paramtype category: str + :keyword include_all: query parameter that indicates if get connection call should return both + connections and datastores. Default value is False. + :paramtype include_all: bool + :return: An iterator like instance of ConnectionPropertiesV2BasicResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RaiTopic]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ConnectionPropertiesV2BasicResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12894,10 +16957,14 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It def prepare_request(next_link=None): if not next_link: - _request = build_rai_topics_list_request( + _request = build_project_connections_list_request( resource_group_name=resource_group_name, account_name=account_name, + project_name=project_name, subscription_id=self._config.subscription_id, + target=target, + category=category, + include_all=include_all, api_version=self._config.api_version, headers=_headers, params=_params, @@ -12920,7 +16987,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -12934,7 +17004,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RaiTopic], + List[_models.ConnectionPropertiesV2BasicResource], deserialized.get("value", []), ) if cls: @@ -12963,14 +17033,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class RaiToolLabelsOperations: +class ProjectCapabilityHostsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`rai_tool_labels` attribute. + :attr:`project_capability_hosts` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -12984,19 +17054,24 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def get( - self, resource_group_name: str, account_name: str, rai_tool_connection_name: str, **kwargs: Any - ) -> _models.RaiToolLabel: - """Gets the specified RAI Tool Label associated with the Azure OpenAI account. + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + ) -> _models.ProjectCapabilityHost: + """Get project capabilityHost. + + Get project capabilityHost. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_tool_connection_name: The name of the Rai Tool Label. Required. - :type rai_tool_connection_name: str - :return: RaiToolLabel. The RaiToolLabel is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiToolLabel + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :return: ProjectCapabilityHost. The ProjectCapabilityHost is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13010,12 +17085,13 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RaiToolLabel] = kwargs.pop("cls", None) + cls: ClsType[_models.ProjectCapabilityHost] = kwargs.pop("cls", None) - _request = build_rai_tool_labels_get_request( + _request = build_project_capability_hosts_get_request( resource_group_name=resource_group_name, account_name=account_name, - rai_tool_connection_name=rai_tool_connection_name, + project_name=project_name, + capability_host_name=capability_host_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13050,198 +17126,300 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RaiToolLabel, response.json()) + deserialized = _deserialize(_models.ProjectCapabilityHost, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + capability_host: Union[_models.ProjectCapabilityHost, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(capability_host, (IOBase, bytes)): + _content = capability_host + else: + _content = json.dumps(capability_host, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_project_capability_hosts_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "str", response.headers.get("x-ms-async-operation-timeout") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - rai_tool_connection_name: str, - rai_tool_label: _models.RaiToolLabel, + project_name: str, + capability_host_name: str, + capability_host: _models.ProjectCapabilityHost, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiToolLabel: - """Creates the RAI Tool Label associated with the Azure OpenAI account. + ) -> LROPoller[_models.ProjectCapabilityHost]: + """Create or update project capabilityHost. + + Create or update project capabilityHost. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_tool_connection_name: The name of the Rai Tool Label. Required. - :type rai_tool_connection_name: str - :param rai_tool_label: Properties describing the RAI Tool Label. Required. - :type rai_tool_label: ~azure.mgmt.cognitiveservices.models.RaiToolLabel + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param capability_host: CapabilityHost definition. Required. + :type capability_host: ~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiToolLabel. The RaiToolLabel is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiToolLabel + :return: An instance of LROPoller that returns ProjectCapabilityHost. The ProjectCapabilityHost + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - rai_tool_connection_name: str, - rai_tool_label: JSON, + project_name: str, + capability_host_name: str, + capability_host: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiToolLabel: - """Creates the RAI Tool Label associated with the Azure OpenAI account. + ) -> LROPoller[_models.ProjectCapabilityHost]: + """Create or update project capabilityHost. + + Create or update project capabilityHost. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_tool_connection_name: The name of the Rai Tool Label. Required. - :type rai_tool_connection_name: str - :param rai_tool_label: Properties describing the RAI Tool Label. Required. - :type rai_tool_label: JSON + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param capability_host: CapabilityHost definition. Required. + :type capability_host: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiToolLabel. The RaiToolLabel is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiToolLabel + :return: An instance of LROPoller that returns ProjectCapabilityHost. The ProjectCapabilityHost + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - rai_tool_connection_name: str, - rai_tool_label: IO[bytes], + project_name: str, + capability_host_name: str, + capability_host: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RaiToolLabel: - """Creates the RAI Tool Label associated with the Azure OpenAI account. + ) -> LROPoller[_models.ProjectCapabilityHost]: + """Create or update project capabilityHost. + + Create or update project capabilityHost. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_tool_connection_name: The name of the Rai Tool Label. Required. - :type rai_tool_connection_name: str - :param rai_tool_label: Properties describing the RAI Tool Label. Required. - :type rai_tool_label: IO[bytes] + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param capability_host: CapabilityHost definition. Required. + :type capability_host: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RaiToolLabel. The RaiToolLabel is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiToolLabel + :return: An instance of LROPoller that returns ProjectCapabilityHost. The ProjectCapabilityHost + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - rai_tool_connection_name: str, - rai_tool_label: Union[_models.RaiToolLabel, JSON, IO[bytes]], + project_name: str, + capability_host_name: str, + capability_host: Union[_models.ProjectCapabilityHost, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RaiToolLabel: - """Creates the RAI Tool Label associated with the Azure OpenAI account. + ) -> LROPoller[_models.ProjectCapabilityHost]: + """Create or update project capabilityHost. + + Create or update project capabilityHost. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_tool_connection_name: The name of the Rai Tool Label. Required. - :type rai_tool_connection_name: str - :param rai_tool_label: Properties describing the RAI Tool Label. Is one of the following types: - RaiToolLabel, JSON, IO[bytes] Required. - :type rai_tool_label: ~azure.mgmt.cognitiveservices.models.RaiToolLabel or JSON or IO[bytes] - :return: RaiToolLabel. The RaiToolLabel is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiToolLabel + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param capability_host: CapabilityHost definition. Is one of the following types: + ProjectCapabilityHost, JSON, IO[bytes] Required. + :type capability_host: ~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ProjectCapabilityHost. The ProjectCapabilityHost + is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RaiToolLabel] = kwargs.pop("cls", None) + cls: ClsType[_models.ProjectCapabilityHost] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + capability_host=capability_host, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - content_type = content_type or "application/json" - _content = None - if isinstance(rai_tool_label, (IOBase, bytes)): - _content = rai_tool_label - else: - _content = json.dumps(rai_tool_label, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ProjectCapabilityHost, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _request = build_rai_tool_labels_create_or_update_request( - resource_group_name=resource_group_name, - account_name=account_name, - rai_tool_connection_name=rai_tool_connection_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) else: - deserialized = _deserialize(_models.RaiToolLabel, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + polling_method = polling + if cont_token: + return LROPoller[_models.ProjectCapabilityHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ProjectCapabilityHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( - self, resource_group_name: str, account_name: str, rai_tool_connection_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13256,10 +17434,11 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_rai_tool_labels_delete_request( + _request = build_project_capability_hosts_delete_request( resource_group_name=resource_group_name, account_name=account_name, - rai_tool_connection_name=rai_tool_connection_name, + project_name=project_name, + capability_host_name=capability_host_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13293,7 +17472,9 @@ def _delete_initial( response_headers = {} if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "str", response.headers.get("x-ms-async-operation-timeout") + ) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -13304,17 +17485,22 @@ def _delete_initial( @distributed_trace def begin_delete( - self, resource_group_name: str, account_name: str, rai_tool_connection_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes the specified RAI Tool Label associated with the Azure OpenAI account. + """Delete project capabilityHost. + + Delete project capabilityHost. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param rai_tool_connection_name: The name of the Rai Tool Label. Required. - :type rai_tool_connection_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -13330,7 +17516,8 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, - rai_tool_connection_name=rai_tool_connection_name, + project_name=project_name, + capability_host_name=capability_host_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -13365,22 +17552,29 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.RaiToolLabel"]: - """Lists all RAI Tool Labels associated with the Azure OpenAI account. + def list( + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + ) -> ItemPaged["_models.ProjectCapabilityHost"]: + """List capabilityHost. + + List capabilityHost. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: An iterator like instance of RaiToolLabel - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiToolLabel] + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :return: An iterator like instance of ProjectCapabilityHost + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RaiToolLabel]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ProjectCapabilityHost]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13393,9 +17587,10 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It def prepare_request(next_link=None): if not next_link: - _request = build_rai_tool_labels_list_request( + _request = build_project_capability_hosts_list_request( resource_group_name=resource_group_name, account_name=account_name, + project_name=project_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13419,7 +17614,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -13433,7 +17631,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RaiToolLabel], + List[_models.ProjectCapabilityHost], deserialized.get("value", []), ) if cls: @@ -13462,35 +17660,173 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class RaiContentFiltersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. +class QuotaTiersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`quota_tiers` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, default: str, **kwargs: Any) -> _models.QuotaTier: + """Gets the Quota Tier for a subscription. + + Gets the Quota Tier information for the given subscription. QuotaTiers is a subscription wide + resource type. It holds current tier information. + + :param default: Default parameter. Leave the value as default. Required. + :type default: str + :return: QuotaTier. The QuotaTier is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.QuotaTier] = kwargs.pop("cls", None) + + _request = build_quota_tiers_get_request( + default=default, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.QuotaTier, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, default: str, tier: _models.QuotaTier, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QuotaTier: + """Updates the Quota Tier resource for a subscription. + + Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide + resource type. It holds current tier information. + + :param default: Default parameter. Leave the value as default. Required. + :type default: str + :param tier: The parameters to provide for the quota tier resource. Required. + :type tier: ~azure.mgmt.cognitiveservices.models.QuotaTier + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: QuotaTier. The QuotaTier is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, default: str, tier: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QuotaTier: + """Updates the Quota Tier resource for a subscription. + + Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide + resource type. It holds current tier information. + + :param default: Default parameter. Leave the value as default. Required. + :type default: str + :param tier: The parameters to provide for the quota tier resource. Required. + :type tier: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: QuotaTier. The QuotaTier is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, default: str, tier: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QuotaTier: + """Updates the Quota Tier resource for a subscription. - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`rai_content_filters` attribute. - """ + Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide + resource type. It holds current tier information. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param default: Default parameter. Leave the value as default. Required. + :type default: str + :param tier: The parameters to provide for the quota tier resource. Required. + :type tier: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: QuotaTier. The QuotaTier is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get(self, location: str, filter_name: str, **kwargs: Any) -> _models.RaiContentFilter: - """Get Content Filters by Name. + def create_or_update( + self, default: str, tier: Union[_models.QuotaTier, JSON, IO[bytes]], **kwargs: Any + ) -> _models.QuotaTier: + """Updates the Quota Tier resource for a subscription. - :param location: The name of the Azure region. Required. - :type location: str - :param filter_name: The name of the RAI Content Filter. Required. - :type filter_name: str - :return: RaiContentFilter. The RaiContentFilter is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiContentFilter + Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide + resource type. It holds current tier information. + + :param default: Default parameter. Leave the value as default. Required. + :type default: str + :param tier: The parameters to provide for the quota tier resource. Is one of the following + types: QuotaTier, JSON, IO[bytes] Required. + :type tier: ~azure.mgmt.cognitiveservices.models.QuotaTier or JSON or IO[bytes] + :return: QuotaTier. The QuotaTier is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13501,16 +17837,25 @@ def get(self, location: str, filter_name: str, **kwargs: Any) -> _models.RaiCont } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.RaiContentFilter] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QuotaTier] = kwargs.pop("cls", None) - _request = build_rai_content_filters_get_request( - location=location, - filter_name=filter_name, + content_type = content_type or "application/json" + _content = None + if isinstance(tier, (IOBase, bytes)): + _content = tier + else: + _content = json.dumps(tier, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_quota_tiers_create_or_update_request( + default=default, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -13527,7 +17872,7 @@ def get(self, location: str, filter_name: str, **kwargs: Any) -> _models.RaiCont response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 201]: if _stream: try: response.read() # Load the body in memory and close the socket @@ -13543,142 +17888,94 @@ def get(self, location: str, filter_name: str, **kwargs: Any) -> _models.RaiCont if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.RaiContentFilter, response.json()) + deserialized = _deserialize(_models.QuotaTier, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.RaiContentFilter"]: - """List Content Filters types. + @overload + def update( + self, default: str, tier: _models.QuotaTier, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QuotaTier: + """Updates the Quota Tier resource for a subscription. The only properties that can be updated are + "tierUpgradePolicy". - :param location: The name of the Azure region. Required. - :type location: str - :return: An iterator like instance of RaiContentFilter - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.RaiContentFilter] + Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide + resource type. It holds current tier information. + + :param default: Default parameter. Leave the value as default. Required. + :type default: str + :param tier: The parameters to provide for the quota tier resource. Required. + :type tier: ~azure.mgmt.cognitiveservices.models.QuotaTier + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: QuotaTier. The QuotaTier is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.RaiContentFilter]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - _request = build_rai_content_filters_list_request( - location=location, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RaiContentFilter], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response + @overload + def update( + self, default: str, tier: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QuotaTier: + """Updates the Quota Tier resource for a subscription. The only properties that can be updated are + "tierUpgradePolicy". - return ItemPaged(get_next, extract_data) + Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide + resource type. It holds current tier information. + :param default: Default parameter. Leave the value as default. Required. + :type default: str + :param tier: The parameters to provide for the quota tier resource. Required. + :type tier: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: QuotaTier. The QuotaTier is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier + :raises ~azure.core.exceptions.HttpResponseError: + """ -class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. + @overload + def update( + self, default: str, tier: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.QuotaTier: + """Updates the Quota Tier resource for a subscription. The only properties that can be updated are + "tierUpgradePolicy". - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`network_security_perimeter_configurations` attribute. - """ + Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide + resource type. It holds current tier information. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param default: Default parameter. Leave the value as default. Required. + :type default: str + :param tier: The parameters to provide for the quota tier resource. Required. + :type tier: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: QuotaTier. The QuotaTier is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get( - self, resource_group_name: str, account_name: str, nsp_configuration_name: str, **kwargs: Any - ) -> _models.NetworkSecurityPerimeterConfiguration: - """Gets the specified NSP configurations for an account. + def update(self, default: str, tier: Union[_models.QuotaTier, JSON, IO[bytes]], **kwargs: Any) -> _models.QuotaTier: + """Updates the Quota Tier resource for a subscription. The only properties that can be updated are + "tierUpgradePolicy". + + Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide + resource type. It holds current tier information. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param nsp_configuration_name: The name of the NSP Configuration. Required. - :type nsp_configuration_name: str - :return: NetworkSecurityPerimeterConfiguration. The NetworkSecurityPerimeterConfiguration is - compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterConfiguration + :param default: Default parameter. Leave the value as default. Required. + :type default: str + :param tier: The parameters to provide for the quota tier resource. Is one of the following + types: QuotaTier, JSON, IO[bytes] Required. + :type tier: ~azure.mgmt.cognitiveservices.models.QuotaTier or JSON or IO[bytes] + :return: QuotaTier. The QuotaTier is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13689,17 +17986,25 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QuotaTier] = kwargs.pop("cls", None) - _request = build_network_security_perimeter_configurations_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - nsp_configuration_name=nsp_configuration_name, + content_type = content_type or "application/json" + _content = None + if isinstance(tier, (IOBase, bytes)): + _content = tier + else: + _content = json.dumps(tier, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_quota_tiers_update_request( + default=default, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -13732,7 +18037,7 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) + deserialized = _deserialize(_models.QuotaTier, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -13740,25 +18045,17 @@ def get( return deserialized # type: ignore @distributed_trace - def list( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.NetworkSecurityPerimeterConfiguration"]: - """Gets a list of NSP configurations for an account. + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.QuotaTier"]: + """Returns all the resources of a particular type belonging to a subscription. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :return: An iterator like instance of NetworkSecurityPerimeterConfiguration - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterConfiguration] + :return: An iterator like instance of QuotaTier + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.QuotaTier] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.NetworkSecurityPerimeterConfiguration]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.QuotaTier]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13771,9 +18068,7 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_network_security_perimeter_configurations_list_request( - resource_group_name=resource_group_name, - account_name=account_name, + _request = build_quota_tiers_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13797,7 +18092,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -13811,7 +18109,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.NetworkSecurityPerimeterConfiguration], + List[_models.QuotaTier], deserialized.get("value", []), ) if cls: @@ -13839,9 +18137,47 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _reconcile_initial( - self, resource_group_name: str, account_name: str, nsp_configuration_name: str, **kwargs: Any - ) -> Iterator[bytes]: + +class AgentApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`agent_applications` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any + ) -> _models.AgentApplication: + """Gets an Agent Application by name. + + Gets an Agent Application by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param name: Name for the Agent Application. Required. + :type name: str + :return: AgentApplication. The AgentApplication is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.AgentApplication + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13853,12 +18189,13 @@ def _reconcile_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.AgentApplication] = kwargs.pop("cls", None) - _request = build_network_security_perimeter_configurations_reconcile_request( + _request = build_agent_applications_get_request( resource_group_name=resource_group_name, account_name=account_name, - nsp_configuration_name=nsp_configuration_name, + project_name=project_name, + name=name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13870,18 +18207,19 @@ def _reconcile_initial( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -13889,128 +18227,25 @@ def _reconcile_initial( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AgentApplication, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_reconcile( - self, resource_group_name: str, account_name: str, nsp_configuration_name: str, **kwargs: Any - ) -> LROPoller[_models.NetworkSecurityPerimeterConfiguration]: - """Reconcile the NSP configuration for an account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param nsp_configuration_name: The name of the NSP Configuration. Required. - :type nsp_configuration_name: str - :return: An instance of LROPoller that returns NetworkSecurityPerimeterConfiguration. The - NetworkSecurityPerimeterConfiguration is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._reconcile_initial( - resource_group_name=resource_group_name, - account_name=account_name, - nsp_configuration_name=nsp_configuration_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.NetworkSecurityPerimeterConfiguration].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NetworkSecurityPerimeterConfiguration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - -class DefenderForAISettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`defender_for_ai_settings` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, account_name: str, defender_for_ai_setting_name: str, **kwargs: Any - ) -> _models.DefenderForAISetting: - """Gets the specified Defender for AI setting by name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. - :type defender_for_ai_setting_name: str - :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + name: str, + body: Union[_models.AgentApplication, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14019,17 +18254,28 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DefenderForAISetting] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_defender_for_ai_settings_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_agent_applications_create_or_update_request( resource_group_name=resource_group_name, account_name=account_name, - defender_for_ai_setting_name=defender_for_ai_setting_name, + project_name=project_name, + name=name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -14039,19 +18285,18 @@ def get( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -14059,132 +18304,219 @@ def get( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DefenderForAISetting, response.json()) + response_headers = {} + if response.status_code == 201: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "str", response.headers.get("x-ms-async-operation-timeout") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - defender_for_ai_setting_name: str, - defender_for_ai_settings: _models.DefenderForAISetting, + project_name: str, + name: str, + body: _models.AgentApplication, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefenderForAISetting: - """Creates or Updates the specified Defender for AI setting. + ) -> LROPoller[_models.AgentApplication]: + """Creates or updates an Agent Application (asynchronous). + + Creates or updates an Agent Application (asynchronous). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. - :type defender_for_ai_setting_name: str - :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. - :type defender_for_ai_settings: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param name: Name for the Agent Application. Required. + :type name: str + :param body: Agent Application definition object. Required. + :type body: ~azure.mgmt.cognitiveservices.models.AgentApplication :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :return: An instance of LROPoller that returns AgentApplication. The AgentApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.AgentApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - defender_for_ai_setting_name: str, - defender_for_ai_settings: JSON, + project_name: str, + name: str, + body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefenderForAISetting: - """Creates or Updates the specified Defender for AI setting. + ) -> LROPoller[_models.AgentApplication]: + """Creates or updates an Agent Application (asynchronous). + + Creates or updates an Agent Application (asynchronous). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. - :type defender_for_ai_setting_name: str - :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. - :type defender_for_ai_settings: JSON + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param name: Name for the Agent Application. Required. + :type name: str + :param body: Agent Application definition object. Required. + :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :return: An instance of LROPoller that returns AgentApplication. The AgentApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.AgentApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - defender_for_ai_setting_name: str, - defender_for_ai_settings: IO[bytes], + project_name: str, + name: str, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefenderForAISetting: - """Creates or Updates the specified Defender for AI setting. + ) -> LROPoller[_models.AgentApplication]: + """Creates or updates an Agent Application (asynchronous). + + Creates or updates an Agent Application (asynchronous). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. - :type defender_for_ai_setting_name: str - :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. - :type defender_for_ai_settings: IO[bytes] + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param name: Name for the Agent Application. Required. + :type name: str + :param body: Agent Application definition object. Required. + :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :return: An instance of LROPoller that returns AgentApplication. The AgentApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.AgentApplication] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - defender_for_ai_setting_name: str, - defender_for_ai_settings: Union[_models.DefenderForAISetting, JSON, IO[bytes]], + project_name: str, + name: str, + body: Union[_models.AgentApplication, JSON, IO[bytes]], **kwargs: Any - ) -> _models.DefenderForAISetting: - """Creates or Updates the specified Defender for AI setting. + ) -> LROPoller[_models.AgentApplication]: + """Creates or updates an Agent Application (asynchronous). + + Creates or updates an Agent Application (asynchronous). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. - :type defender_for_ai_setting_name: str - :param defender_for_ai_settings: Properties describing the Defender for AI setting. Is one of - the following types: DefenderForAISetting, JSON, IO[bytes] Required. - :type defender_for_ai_settings: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting or - JSON or IO[bytes] - :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param name: Name for the Agent Application. Required. + :type name: str + :param body: Agent Application definition object. Is one of the following types: + AgentApplication, JSON, IO[bytes] Required. + :type body: ~azure.mgmt.cognitiveservices.models.AgentApplication or JSON or IO[bytes] + :return: An instance of LROPoller that returns AgentApplication. The AgentApplication is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.AgentApplication] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AgentApplication] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + name=name, + body=body, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AgentApplication, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AgentApplication].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AgentApplication]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14193,27 +18525,18 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DefenderForAISetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(defender_for_ai_settings, (IOBase, bytes)): - _content = defender_for_ai_settings - else: - _content = json.dumps(defender_for_ai_settings, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_defender_for_ai_settings_create_or_update_request( + _request = build_agent_applications_delete_request( resource_group_name=resource_group_name, account_name=account_name, - defender_for_ai_setting_name=defender_for_ai_setting_name, + project_name=project_name, + name=name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -14223,19 +18546,18 @@ def create_or_update( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -14243,130 +18565,246 @@ def create_or_update( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DefenderForAISetting, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def update( - self, - resource_group_name: str, - account_name: str, - defender_for_ai_setting_name: str, - defender_for_ai_settings: _models.DefenderForAISetting, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DefenderForAISetting: - """Updates the specified Defender for AI setting. + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete Agent Application. + + Delete Agent Application. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. - :type defender_for_ai_setting_name: str - :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. - :type defender_for_ai_settings: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param name: Name for the Agent Application. Required. + :type name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def update( - self, - resource_group_name: str, - account_name: str, - defender_for_ai_setting_name: str, - defender_for_ai_settings: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DefenderForAISetting: - """Updates the specified Defender for AI setting. + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. - :type defender_for_ai_setting_name: str - :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. - :type defender_for_ai_settings: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @overload - def update( + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( self, resource_group_name: str, account_name: str, - defender_for_ai_setting_name: str, - defender_for_ai_settings: IO[bytes], + project_name: str, *, - content_type: str = "application/json", + count: int = 30, + skip: Optional[int] = None, + skip_token: Optional[str] = None, + names: Optional[List[str]] = None, + search_text: Optional[str] = None, + order_by: Optional[str] = None, + order_by_asc: bool = False, **kwargs: Any - ) -> _models.DefenderForAISetting: - """Updates the specified Defender for AI setting. + ) -> ItemPaged["_models.AgentApplication"]: + """Lists Agent Applications in the project. + + Lists Agent Applications in the project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. - :type defender_for_ai_setting_name: str - :param defender_for_ai_settings: Properties describing the Defender for AI setting. Required. - :type defender_for_ai_settings: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :keyword count: Number of agent applications to be retrieved in a page of results. Default + value is 30. + :paramtype count: int + :keyword skip: Number of agent applications to skip. Default value is None. + :paramtype skip: int + :keyword skip_token: Continuation token for pagination. Default value is None. + :paramtype skip_token: str + :keyword names: Names of agent applications to retrieve. Default value is None. + :paramtype names: list[str] + :keyword search_text: Search text for filtering agent applications. Default value is None. + :paramtype search_text: str + :keyword order_by: Field to order by. Default value is None. + :paramtype order_by: str + :keyword order_by_asc: Whether to order in ascending order. Default value is False. + :paramtype order_by_asc: bool + :return: An iterator like instance of AgentApplication + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.AgentApplication] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AgentApplication]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_agent_applications_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + count=count, + skip=skip, + skip_token=skip_token, + names=names, + search_text=search_text, + order_by=order_by, + order_by_asc=order_by_asc, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.AgentApplication], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def update( - self, - resource_group_name: str, - account_name: str, - defender_for_ai_setting_name: str, - defender_for_ai_settings: Union[_models.DefenderForAISetting, JSON, IO[bytes]], - **kwargs: Any - ) -> _models.DefenderForAISetting: - """Updates the specified Defender for AI setting. + def list_agents( + self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any + ) -> _models.AgentReferenceResourceArmPaginatedResult: + """Lists agents for an Agent Application. + + Lists agents for an Agent Application. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param defender_for_ai_setting_name: The name of the defender for AI setting. Required. - :type defender_for_ai_setting_name: str - :param defender_for_ai_settings: Properties describing the Defender for AI setting. Is one of - the following types: DefenderForAISetting, JSON, IO[bytes] Required. - :type defender_for_ai_settings: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting or - JSON or IO[bytes] - :return: DefenderForAISetting. The DefenderForAISetting is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param name: Name for the Agent Application. Required. + :type name: str + :return: AgentReferenceResourceArmPaginatedResult. The AgentReferenceResourceArmPaginatedResult + is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.AgentReferenceResourceArmPaginatedResult :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14377,27 +18815,18 @@ def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DefenderForAISetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(defender_for_ai_settings, (IOBase, bytes)): - _content = defender_for_ai_settings - else: - _content = json.dumps(defender_for_ai_settings, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.AgentReferenceResourceArmPaginatedResult] = kwargs.pop("cls", None) - _request = build_defender_for_ai_settings_update_request( + _request = build_agent_applications_list_agents_request( resource_group_name=resource_group_name, account_name=account_name, - defender_for_ai_setting_name=defender_for_ai_setting_name, + project_name=project_name, + name=name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -14430,7 +18859,7 @@ def update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DefenderForAISetting, response.json()) + deserialized = _deserialize(_models.AgentReferenceResourceArmPaginatedResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -14438,25 +18867,93 @@ def update( return deserialized # type: ignore @distributed_trace - def list( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.DefenderForAISetting"]: - """Lists the Defender for AI settings. + def enable( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any + ) -> None: + """Enables an Agent Application. + + Enables an Agent Application. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: An iterator like instance of DefenderForAISetting - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.DefenderForAISetting] + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param name: Name for the Agent Application. Required. + :type name: str + :return: None + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DefenderForAISetting]] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_agent_applications_enable_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def disable( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any + ) -> None: + """Disables an Agent Application. + + Disables an Agent Application. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param name: Name for the Agent Application. Required. + :type name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14465,86 +18962,53 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_defender_for_ai_settings_list_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[None] = kwargs.pop("cls", None) - return _request + _request = build_agent_applications_disable_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.DefenderForAISetting], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, None, {}) # type: ignore -class ProjectsOperations: +class ManagedComputeDeploymentsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`projects` attribute. + :attr:`managed_compute_deployments` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -14557,18 +19021,36 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any) -> _models.Project: - """Returns a Cognitive Services project specified by the parameters. + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def get( + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any + ) -> _models.ManagedComputeDeployment: + """Gets the specified managed compute deployment associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :return: Project. The Project is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.Project + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :return: ManagedComputeDeployment. The ManagedComputeDeployment is compatible with + MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14582,12 +19064,12 @@ def get(self, resource_group_name: str, account_name: str, project_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.Project] = kwargs.pop("cls", None) + cls: ClsType[_models.ManagedComputeDeployment] = kwargs.pop("cls", None) - _request = build_projects_get_request( + _request = build_managed_compute_deployments_get_request( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -14622,19 +19104,34 @@ def get(self, resource_group_name: str, account_name: str, project_name: str, ** if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.Project, response.json()) + deserialized = _deserialize(_models.ManagedComputeDeployment, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_initial( + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def _create_or_update_initial( self, resource_group_name: str, account_name: str, - project_name: str, - project: Union[_models.Project, JSON, IO[bytes]], + deployment_name: str, + resource: Union[_models.ManagedComputeDeployment, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -14653,15 +19150,15 @@ def _create_initial( content_type = content_type or "application/json" _content = None - if isinstance(project, (IOBase, bytes)): - _content = project + if isinstance(resource, (IOBase, bytes)): + _content = resource else: - _content = json.dumps(project, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_projects_create_request( + _request = build_managed_compute_deployments_create_or_update_request( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -14682,7 +19179,7 @@ def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 201]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -14696,10 +19193,9 @@ def _create_initial( response_headers = {} if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -14710,142 +19206,162 @@ def _create_initial( return deserialized # type: ignore @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - project_name: str, - project: _models.Project, + deployment_name: str, + resource: _models.ManagedComputeDeployment, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Project]: - """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. + ) -> LROPoller[_models.ManagedComputeDeployment]: + """Creates or updates a managed compute deployment associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param project: The parameters to provide for the created project. Required. - :type project: ~azure.mgmt.cognitiveservices.models.Project + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param resource: The managed compute deployment properties. Required. + :type resource: ~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Project. The Project is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :return: An instance of LROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - project_name: str, - project: JSON, + deployment_name: str, + resource: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Project]: - """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. + ) -> LROPoller[_models.ManagedComputeDeployment]: + """Creates or updates a managed compute deployment associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param project: The parameters to provide for the created project. Required. - :type project: JSON + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param resource: The managed compute deployment properties. Required. + :type resource: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Project. The Project is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :return: An instance of LROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, account_name: str, - project_name: str, - project: IO[bytes], + deployment_name: str, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Project]: - """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. + ) -> LROPoller[_models.ManagedComputeDeployment]: + """Creates or updates a managed compute deployment associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param project: The parameters to provide for the created project. Required. - :type project: IO[bytes] + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param resource: The managed compute deployment properties. Required. + :type resource: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Project. The Project is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :return: An instance of LROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create( + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def begin_create_or_update( self, resource_group_name: str, account_name: str, - project_name: str, - project: Union[_models.Project, JSON, IO[bytes]], + deployment_name: str, + resource: Union[_models.ManagedComputeDeployment, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Project]: - """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. + ) -> LROPoller[_models.ManagedComputeDeployment]: + """Creates or updates a managed compute deployment associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param project: The parameters to provide for the created project. Is one of the following - types: Project, JSON, IO[bytes] Required. - :type project: ~azure.mgmt.cognitiveservices.models.Project or JSON or IO[bytes] - :return: An instance of LROPoller that returns Project. The Project is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param resource: The managed compute deployment properties. Is one of the following types: + ManagedComputeDeployment, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Project] = kwargs.pop("cls", None) + cls: ClsType[_models.ManagedComputeDeployment] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, - project=project, + deployment_name=deployment_name, + resource=resource, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -14857,7 +19373,7 @@ def begin_create( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.Project, response.json()) + deserialized = _deserialize(_models.ManagedComputeDeployment, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14875,22 +19391,37 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Project].from_continuation_token( + return LROPoller[_models.ManagedComputeDeployment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Project]( + return LROPoller[_models.ManagedComputeDeployment]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) def _update_initial( self, resource_group_name: str, account_name: str, - project_name: str, - project: Union[_models.Project, JSON, IO[bytes]], + deployment_name: str, + properties: Union[_models.PatchResourceSku, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -14909,15 +19440,15 @@ def _update_initial( content_type = content_type or "application/json" _content = None - if isinstance(project, (IOBase, bytes)): - _content = project + if isinstance(properties, (IOBase, bytes)): + _content = properties else: - _content = json.dumps(project, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_projects_update_request( + _request = build_managed_compute_deployments_update_request( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -14953,6 +19484,10 @@ def _update_initial( response_headers = {} if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -14966,29 +19501,32 @@ def begin_update( self, resource_group_name: str, account_name: str, - project_name: str, - project: _models.Project, + deployment_name: str, + properties: _models.PatchResourceSku, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Project]: - """Updates a Cognitive Services Project. + ) -> LROPoller[_models.ManagedComputeDeployment]: + """Updates the specified managed compute deployment associated with the Cognitive Services + account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param project: The parameters to provide for the created project. Required. - :type project: ~azure.mgmt.cognitiveservices.models.Project + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param properties: The managed compute deployment patch properties. Required. + :type properties: ~azure.mgmt.cognitiveservices.models.PatchResourceSku :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Project. The Project is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :return: An instance of LROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -14997,29 +19535,32 @@ def begin_update( self, resource_group_name: str, account_name: str, - project_name: str, - project: JSON, + deployment_name: str, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Project]: - """Updates a Cognitive Services Project. + ) -> LROPoller[_models.ManagedComputeDeployment]: + """Updates the specified managed compute deployment associated with the Cognitive Services + account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param project: The parameters to provide for the created project. Required. - :type project: JSON + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param properties: The managed compute deployment patch properties. Required. + :type properties: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Project. The Project is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :return: An instance of LROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -15028,63 +19569,84 @@ def begin_update( self, resource_group_name: str, account_name: str, - project_name: str, - project: IO[bytes], + deployment_name: str, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Project]: - """Updates a Cognitive Services Project. + ) -> LROPoller[_models.ManagedComputeDeployment]: + """Updates the specified managed compute deployment associated with the Cognitive Services + account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param project: The parameters to provide for the created project. Required. - :type project: IO[bytes] + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param properties: The managed compute deployment patch properties. Required. + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns Project. The Project is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :return: An instance of LROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) def begin_update( self, resource_group_name: str, account_name: str, - project_name: str, - project: Union[_models.Project, JSON, IO[bytes]], + deployment_name: str, + properties: Union[_models.PatchResourceSku, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Project]: - """Updates a Cognitive Services Project. + ) -> LROPoller[_models.ManagedComputeDeployment]: + """Updates the specified managed compute deployment associated with the Cognitive Services + account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param project: The parameters to provide for the created project. Is one of the following - types: Project, JSON, IO[bytes] Required. - :type project: ~azure.mgmt.cognitiveservices.models.Project or JSON or IO[bytes] - :return: An instance of LROPoller that returns Project. The Project is compatible with - MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str + :param properties: The managed compute deployment patch properties. Is one of the following + types: PatchResourceSku, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.cognitiveservices.models.PatchResourceSku or JSON or IO[bytes] + :return: An instance of LROPoller that returns ManagedComputeDeployment. The + ManagedComputeDeployment is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Project] = kwargs.pop("cls", None) + cls: ClsType[_models.ManagedComputeDeployment] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -15092,8 +19654,8 @@ def begin_update( raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, - project=project, + deployment_name=deployment_name, + properties=properties, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -15105,7 +19667,7 @@ def begin_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.Project, response.json()) + deserialized = _deserialize(_models.ManagedComputeDeployment, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15123,18 +19685,31 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Project].from_continuation_token( + return LROPoller[_models.ManagedComputeDeployment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Project]( + return LROPoller[_models.ManagedComputeDeployment]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) def _delete_initial( - self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15149,10 +19724,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_projects_delete_request( + _request = build_managed_compute_deployments_delete_request( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, + deployment_name=deployment_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -15171,7 +19746,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [202, 204]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -15185,7 +19760,10 @@ def _delete_initial( response_headers = {} if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -15196,18 +19774,33 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "deployment_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) def begin_delete( - self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes a Cognitive Services project from the resource group. + """Deletes the specified managed compute deployment associated with the Cognitive Services + account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str + :param deployment_name: The name of the managed compute deployment associated with the + Cognitive Services Account. Required. + :type deployment_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -15223,7 +19816,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, + deployment_name=deployment_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -15258,22 +19851,32 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.Project"]: - """Returns all the projects in a Cognitive Services account. + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-03-15-preview"], + ) + def list( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.ManagedComputeDeployment"]: + """Gets the managed compute deployments associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :return: An iterator like instance of Project - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Project] + :return: An iterator like instance of ManagedComputeDeployment + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ManagedComputeDeployment] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Project]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ManagedComputeDeployment]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15286,7 +19889,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It def prepare_request(next_link=None): if not next_link: - _request = build_projects_list_request( + _request = build_managed_compute_deployments_list_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -15312,7 +19915,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -15326,7 +19932,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.Project], + List[_models.ManagedComputeDeployment], deserialized.get("value", []), ) if cls: @@ -15355,14 +19961,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class ProjectConnectionsOperations: +class ComputeOperationsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`project_connections` attribute. + :attr:`compute_operations` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -15375,227 +19981,22 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get( - self, resource_group_name: str, account_name: str, project_name: str, connection_name: str, **kwargs: Any - ) -> _models.ConnectionPropertiesV2BasicResource: - """Lists Cognitive Services project connection by name. - - Lists Cognitive Services project connection by name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param connection_name: Friendly name of the connection. Required. - :type connection_name: str - :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is - compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) - - _request = build_project_connections_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - project_name=project_name, - connection_name=connection_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ConnectionPropertiesV2BasicResource, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - resource_group_name: str, - account_name: str, - project_name: str, - connection_name: str, - connection: Optional[_models.ConnectionPropertiesV2BasicResource] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionPropertiesV2BasicResource: - """Create or update Cognitive Services project connection under the specified project. - - Create or update Cognitive Services project connection under the specified project. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param connection_name: Friendly name of the connection. Required. - :type connection_name: str - :param connection: The object for creating or updating a new account connection. Default value - is None. - :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is - compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - account_name: str, - project_name: str, - connection_name: str, - connection: Optional[JSON] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionPropertiesV2BasicResource: - """Create or update Cognitive Services project connection under the specified project. - - Create or update Cognitive Services project connection under the specified project. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param connection_name: Friendly name of the connection. Required. - :type connection_name: str - :param connection: The object for creating or updating a new account connection. Default value - is None. - :type connection: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is - compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - account_name: str, - project_name: str, - connection_name: str, - connection: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionPropertiesV2BasicResource: - """Create or update Cognitive Services project connection under the specified project. - - Create or update Cognitive Services project connection under the specified project. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param connection_name: Friendly name of the connection. Required. - :type connection_name: str - :param connection: The object for creating or updating a new account connection. Default value - is None. - :type connection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is - compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - account_name: str, - project_name: str, - connection_name: str, - connection: Optional[Union[_models.ConnectionPropertiesV2BasicResource, JSON, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.ConnectionPropertiesV2BasicResource: - """Create or update Cognitive Services project connection under the specified project. - - Create or update Cognitive Services project connection under the specified project. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param connection_name: Friendly name of the connection. Required. - :type connection_name: str - :param connection: The object for creating or updating a new account connection. Is one of the - following types: ConnectionPropertiesV2BasicResource, JSON, IO[bytes] Default value is None. - :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource or - JSON or IO[bytes] - :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is - compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + @api_version_validation( + method_added_on="2026-01-15-preview", + params_added_on={ + "2026-01-15-preview": ["api_version", "subscription_id", "location", "operation_id", "accept"] + }, + api_versions_list=["2026-01-15-preview", "2026-03-15-preview"], + ) + def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.ComputeOperationStatus: + """Gets the status of a compute operation. + + :param location: The name of the Azure region. Required. + :type location: str + :param operation_id: The ID of the compute operation. Required. + :type operation_id: str + :return: ComputeOperationStatus. The ComputeOperationStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.ComputeOperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15606,32 +20007,16 @@ def create( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if connection else None - cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if connection else None - _content = None - if isinstance(connection, (IOBase, bytes)): - _content = connection - else: - if connection is not None: - _content = json.dumps(connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + cls: ClsType[_models.ComputeOperationStatus] = kwargs.pop("cls", None) - _request = build_project_connections_create_request( - resource_group_name=resource_group_name, - account_name=account_name, - project_name=project_name, - connection_name=connection_name, + _request = build_compute_operations_get_request( + location=location, + operation_id=operation_id, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -15664,151 +20049,182 @@ def create( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ConnectionPropertiesV2BasicResource, response.json()) + deserialized = _deserialize(_models.ComputeOperationStatus, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - def update( - self, - resource_group_name: str, - account_name: str, - project_name: str, - connection_name: str, - connection: Optional[_models.ConnectionUpdateContent] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionPropertiesV2BasicResource: - """Update Cognitive Services project connection under the specified project. - Update Cognitive Services project connection under the specified project. +class ManagedComputeUsagesOperationGroupOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param connection_name: Friendly name of the connection. Required. - :type connection_name: str - :param connection: Parameters for account connection update. Default value is None. - :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is - compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`managed_compute_usages_operation_group` attribute. + """ - @overload - def update( - self, - resource_group_name: str, - account_name: str, - project_name: str, - connection_name: str, - connection: Optional[JSON] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionPropertiesV2BasicResource: - """Update Cognitive Services project connection under the specified project. + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - Update Cognitive Services project connection under the specified project. + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={"2026-03-15-preview": ["api_version", "subscription_id", "location", "accept"]}, + api_versions_list=["2026-03-15-preview"], + ) + def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.ManagedComputeUsage"]: + """List managed compute quota usages for a subscription and location. - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param connection_name: Friendly name of the connection. Required. - :type connection_name: str - :param connection: Parameters for account connection update. Default value is None. - :type connection: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is - compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of ManagedComputeUsage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ManagedComputeUsage] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def update( - self, - resource_group_name: str, - account_name: str, - project_name: str, - connection_name: str, - connection: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ConnectionPropertiesV2BasicResource: - """Update Cognitive Services project connection under the specified project. + cls: ClsType[List[_models.ManagedComputeUsage]] = kwargs.pop("cls", None) - Update Cognitive Services project connection under the specified project. + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param connection_name: Friendly name of the connection. Required. - :type connection_name: str - :param connection: Parameters for account connection update. Default value is None. - :type connection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is - compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + def prepare_request(next_link=None): + if not next_link: - @distributed_trace - def update( - self, - resource_group_name: str, - account_name: str, - project_name: str, - connection_name: str, - connection: Optional[Union[_models.ConnectionUpdateContent, JSON, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.ConnectionPropertiesV2BasicResource: - """Update Cognitive Services project connection under the specified project. + _request = build_managed_compute_usages_operation_group_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ManagedComputeUsage], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ComputesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`computes` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CognitiveServicesManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - Update Cognitive Services project connection under the specified project. + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def get(self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any) -> _models.Compute: + """Gets the specified compute associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param connection_name: Friendly name of the connection. Required. - :type connection_name: str - :param connection: Parameters for account connection update. Is one of the following types: - ConnectionUpdateContent, JSON, IO[bytes] Default value is None. - :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent or JSON or - IO[bytes] - :return: ConnectionPropertiesV2BasicResource. The ConnectionPropertiesV2BasicResource is - compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :return: Compute. The Compute is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.Compute :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15819,32 +20235,17 @@ def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if connection else None - cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if connection else None - _content = None - if isinstance(connection, (IOBase, bytes)): - _content = connection - else: - if connection is not None: - _content = json.dumps(connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + cls: ClsType[_models.Compute] = kwargs.pop("cls", None) - _request = build_project_connections_update_request( + _request = build_computes_get_request( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, - connection_name=connection_name, + compute_name=compute_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -15877,34 +20278,36 @@ def update( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ConnectionPropertiesV2BasicResource, response.json()) + deserialized = _deserialize(_models.Compute, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, project_name: str, connection_name: str, **kwargs: Any - ) -> None: - """Delete Cognitive Services project connection by name. - - Delete Cognitive Services project connection by name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param connection_name: Friendly name of the connection. Required. - :type connection_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + resource: Union[_models.Compute, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15913,18 +20316,27 @@ def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_project_connections_delete_request( + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_computes_create_or_update_request( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, - connection_name=connection_name, + compute_name=compute_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -15933,14 +20345,19 @@ def delete( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -15948,240 +20365,232 @@ def delete( # pylint: disable=inconsistent-return-statements ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore - @distributed_trace - def list( + return deserialized # type: ignore + + @overload + def begin_create_or_update( self, resource_group_name: str, account_name: str, - project_name: str, + compute_name: str, + resource: _models.Compute, *, - target: Optional[str] = None, - category: Optional[str] = None, - include_all: bool = False, + content_type: str = "application/json", **kwargs: Any - ) -> ItemPaged["_models.ConnectionPropertiesV2BasicResource"]: - """Lists all the available Cognitive Services project connections under the specified project. - - Lists all the available Cognitive Services project connections under the specified project. + ) -> LROPoller[_models.Compute]: + """Creates or updates a compute associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :keyword target: Target of the connection. Default value is None. - :paramtype target: str - :keyword category: Category of the connection. Default value is None. - :paramtype category: str - :keyword include_all: query parameter that indicates if get connection call should return both - connections and datastores. Default value is False. - :paramtype include_all: bool - :return: An iterator like instance of ConnectionPropertiesV2BasicResource - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param resource: The compute properties. Required. + :type resource: ~azure.mgmt.cognitiveservices.models.Compute + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Compute] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ConnectionPropertiesV2BasicResource]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_project_connections_list_request( - resource_group_name=resource_group_name, - account_name=account_name, - project_name=project_name, - subscription_id=self._config.subscription_id, - target=target, - category=category, - include_all=include_all, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ConnectionPropertiesV2BasicResource], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Compute]: + """Creates or updates a compute associated with the Cognitive Services account. -class ProjectCapabilityHostsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param resource: The compute properties. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Compute] + :raises ~azure.core.exceptions.HttpResponseError: + """ - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`project_capability_hosts` attribute. - """ + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Compute]: + """Creates or updates a compute associated with the Cognitive Services account. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param resource: The compute properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Compute] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get( - self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any - ) -> _models.ProjectCapabilityHost: - """Get project capabilityHost. - - Get project capabilityHost. + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + compute_name: str, + resource: Union[_models.Compute, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Compute]: + """Creates or updates a compute associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param capability_host_name: The name of the capability host associated with the Cognitive - Services Resource. Required. - :type capability_host_name: str - :return: ProjectCapabilityHost. The ProjectCapabilityHost is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param resource: The compute properties. Is one of the following types: Compute, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.cognitiveservices.models.Compute or JSON or IO[bytes] + :return: An instance of LROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Compute] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ProjectCapabilityHost] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Compute] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Compute, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _request = build_project_capability_hosts_get_request( - resource_group_name=resource_group_name, - account_name=account_name, - project_name=project_name, - capability_host_name=capability_host_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) else: - deserialized = _deserialize(_models.ProjectCapabilityHost, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + polling_method = polling + if cont_token: + return LROPoller[_models.Compute].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Compute]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _create_or_update_initial( + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def _update_initial( self, resource_group_name: str, account_name: str, - project_name: str, - capability_host_name: str, - capability_host: Union[_models.ProjectCapabilityHost, JSON, IO[bytes]], + compute_name: str, + properties: Union[_models.Compute, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -16200,16 +20609,15 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(capability_host, (IOBase, bytes)): - _content = capability_host + if isinstance(properties, (IOBase, bytes)): + _content = properties else: - _content = json.dumps(capability_host, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_project_capability_hosts_create_or_update_request( + _request = build_computes_update_request( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, - capability_host_name=capability_host_name, + compute_name=compute_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -16230,7 +20638,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -16243,13 +20651,9 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["x-ms-async-operation-timeout"] = self._deserialize( - "str", response.headers.get("x-ms-async-operation-timeout") - ) + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -16259,168 +20663,157 @@ def _create_or_update_initial( return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, account_name: str, - project_name: str, - capability_host_name: str, - capability_host: _models.ProjectCapabilityHost, + compute_name: str, + properties: _models.Compute, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ProjectCapabilityHost]: - """Create or update project capabilityHost. - - Create or update project capabilityHost. + ) -> LROPoller[_models.Compute]: + """Updates a compute associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param capability_host_name: The name of the capability host associated with the Cognitive - Services Resource. Required. - :type capability_host_name: str - :param capability_host: CapabilityHost definition. Required. - :type capability_host: ~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param properties: The compute properties to update. Required. + :type properties: ~azure.mgmt.cognitiveservices.models.Compute :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns ProjectCapabilityHost. The ProjectCapabilityHost - is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost] + :return: An instance of LROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Compute] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, account_name: str, - project_name: str, - capability_host_name: str, - capability_host: JSON, + compute_name: str, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ProjectCapabilityHost]: - """Create or update project capabilityHost. - - Create or update project capabilityHost. + ) -> LROPoller[_models.Compute]: + """Updates a compute associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param capability_host_name: The name of the capability host associated with the Cognitive - Services Resource. Required. - :type capability_host_name: str - :param capability_host: CapabilityHost definition. Required. - :type capability_host: JSON + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param properties: The compute properties to update. Required. + :type properties: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns ProjectCapabilityHost. The ProjectCapabilityHost - is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost] + :return: An instance of LROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Compute] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, account_name: str, - project_name: str, - capability_host_name: str, - capability_host: IO[bytes], + compute_name: str, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ProjectCapabilityHost]: - """Create or update project capabilityHost. - - Create or update project capabilityHost. + ) -> LROPoller[_models.Compute]: + """Updates a compute associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param capability_host_name: The name of the capability host associated with the Cognitive - Services Resource. Required. - :type capability_host_name: str - :param capability_host: CapabilityHost definition. Required. - :type capability_host: IO[bytes] + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param properties: The compute properties to update. Required. + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns ProjectCapabilityHost. The ProjectCapabilityHost - is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost] + :paramtype content_type: str + :return: An instance of LROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Compute] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def begin_update( self, resource_group_name: str, account_name: str, - project_name: str, - capability_host_name: str, - capability_host: Union[_models.ProjectCapabilityHost, JSON, IO[bytes]], + compute_name: str, + properties: Union[_models.Compute, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.ProjectCapabilityHost]: - """Create or update project capabilityHost. - - Create or update project capabilityHost. + ) -> LROPoller[_models.Compute]: + """Updates a compute associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param capability_host_name: The name of the capability host associated with the Cognitive - Services Resource. Required. - :type capability_host_name: str - :param capability_host: CapabilityHost definition. Is one of the following types: - ProjectCapabilityHost, JSON, IO[bytes] Required. - :type capability_host: ~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost or JSON or - IO[bytes] - :return: An instance of LROPoller that returns ProjectCapabilityHost. The ProjectCapabilityHost - is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost] + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :param properties: The compute properties to update. Is one of the following types: Compute, + JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.cognitiveservices.models.Compute or JSON or IO[bytes] + :return: An instance of LROPoller that returns Compute. The Compute is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Compute] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ProjectCapabilityHost] = kwargs.pop("cls", None) + cls: ClsType[_models.Compute] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, - capability_host_name=capability_host_name, - capability_host=capability_host, + compute_name=compute_name, + properties=properties, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -16432,7 +20825,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ProjectCapabilityHost, response.json()) + deserialized = _deserialize(_models.Compute, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16450,18 +20843,31 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ProjectCapabilityHost].from_continuation_token( + return LROPoller[_models.Compute].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ProjectCapabilityHost]( + return LROPoller[_models.Compute]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) def _delete_initial( - self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16476,11 +20882,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_project_capability_hosts_delete_request( + _request = build_computes_delete_request( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, - capability_host_name=capability_host_name, + compute_name=compute_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -16514,9 +20919,7 @@ def _delete_initial( response_headers = {} if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["x-ms-async-operation-timeout"] = self._deserialize( - "str", response.headers.get("x-ms-async-operation-timeout") - ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -16526,23 +20929,32 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) def begin_delete( - self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete project capabilityHost. - - Delete project capabilityHost. + """Deletes the specified compute associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param capability_host_name: The name of the capability host associated with the Cognitive - Services Resource. Required. - :type capability_host_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -16558,8 +20970,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, - capability_host_name=capability_host_name, + compute_name=compute_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -16594,29 +21005,29 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def list( - self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any - ) -> ItemPaged["_models.ProjectCapabilityHost"]: - """List capabilityHost. - - List capabilityHost. + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-03-15-preview"], + ) + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.Compute"]: + """Gets the computes associated with the Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: The name of Cognitive Services account. Required. :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :return: An iterator like instance of ProjectCapabilityHost - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ProjectCapabilityHost] + :return: An iterator like instance of Compute + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Compute] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ProjectCapabilityHost]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Compute]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16629,10 +21040,9 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_project_capability_hosts_list_request( + _request = build_computes_list_request( resource_group_name=resource_group_name, account_name=account_name, - project_name=project_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -16656,7 +21066,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -16670,7 +21083,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.ProjectCapabilityHost], + List[_models.Compute], deserialized.get("value", []), ) if cls: @@ -16698,39 +21111,22 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class QuotaTiersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`quota_tiers` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CognitiveServicesManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, default: str, **kwargs: Any) -> _models.QuotaTier: - """Gets the Quota Tier for a subscription. - - Gets the Quota Tier information for the given subscription. QuotaTiers is a subscription wide - resource type. It holds current tier information. - - :param default: Default parameter. Leave the value as default. Required. - :type default: str - :return: QuotaTier. The QuotaTier is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier - :raises ~azure.core.exceptions.HttpResponseError: - """ + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def _start_initial( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16742,10 +21138,12 @@ def get(self, default: str, **kwargs: Any) -> _models.QuotaTier: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.QuotaTier] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_quota_tiers_get_request( - default=default, + _request = build_computes_start_request( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -16757,19 +21155,18 @@ def get(self, default: str, **kwargs: Any) -> _models.QuotaTier: _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -16777,97 +21174,111 @@ def get(self, default: str, **kwargs: Any) -> _models.QuotaTier: ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.QuotaTier, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def create_or_update( - self, default: str, tier: _models.QuotaTier, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.QuotaTier: - """Updates the Quota Tier resource for a subscription. - - Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide - resource type. It holds current tier information. - - :param default: Default parameter. Leave the value as default. Required. - :type default: str - :param tier: The parameters to provide for the quota tier resource. Required. - :type tier: ~azure.mgmt.cognitiveservices.models.QuotaTier - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: QuotaTier. The QuotaTier is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, default: str, tier: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.QuotaTier: - """Updates the Quota Tier resource for a subscription. - - Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide - resource type. It holds current tier information. - - :param default: Default parameter. Leave the value as default. Required. - :type default: str - :param tier: The parameters to provide for the quota tier resource. Required. - :type tier: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: QuotaTier. The QuotaTier is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, default: str, tier: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.QuotaTier: - """Updates the Quota Tier resource for a subscription. - - Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide - resource type. It holds current tier information. + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def begin_start( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Starts a stopped ContainerInstance compute resource. This is a long-running operation that + returns 202 Accepted. Only applicable when computeType is ContainerInstance. - :param default: Default parameter. Leave the value as default. Required. - :type default: str - :param tier: The parameters to provide for the quota tier resource. Required. - :type tier: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: QuotaTier. The QuotaTier is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @distributed_trace - def create_or_update( - self, default: str, tier: Union[_models.QuotaTier, JSON, IO[bytes]], **kwargs: Any - ) -> _models.QuotaTier: - """Updates the Quota Tier resource for a subscription. + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide - resource type. It holds current tier information. + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - :param default: Default parameter. Leave the value as default. Required. - :type default: str - :param tier: The parameters to provide for the quota tier resource. Is one of the following - types: QuotaTier, JSON, IO[bytes] Required. - :type tier: ~azure.mgmt.cognitiveservices.models.QuotaTier or JSON or IO[bytes] - :return: QuotaTier. The QuotaTier is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier - :raises ~azure.core.exceptions.HttpResponseError: - """ + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def _stop_initial( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16876,25 +21287,17 @@ def create_or_update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.QuotaTier] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(tier, (IOBase, bytes)): - _content = tier - else: - _content = json.dumps(tier, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_quota_tiers_create_or_update_request( - default=default, + _request = build_computes_stop_request( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -16904,19 +21307,18 @@ def create_or_update( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -16924,99 +21326,111 @@ def create_or_update( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.QuotaTier, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - @overload - def update( - self, default: str, tier: _models.QuotaTier, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.QuotaTier: - """Updates the Quota Tier resource for a subscription. The only properties that can be updated are - "tierUpgradePolicy". - - Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide - resource type. It holds current tier information. - - :param default: Default parameter. Leave the value as default. Required. - :type default: str - :param tier: The parameters to provide for the quota tier resource. Required. - :type tier: ~azure.mgmt.cognitiveservices.models.QuotaTier - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: QuotaTier. The QuotaTier is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, default: str, tier: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.QuotaTier: - """Updates the Quota Tier resource for a subscription. The only properties that can be updated are - "tierUpgradePolicy". - - Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide - resource type. It holds current tier information. + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def begin_stop( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Stops a running ContainerInstance compute resource. This is a long-running operation that + returns 202 Accepted. Only applicable when computeType is ContainerInstance. - :param default: Default parameter. Leave the value as default. Required. - :type default: str - :param tier: The parameters to provide for the quota tier resource. Required. - :type tier: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: QuotaTier. The QuotaTier is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - def update( - self, default: str, tier: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.QuotaTier: - """Updates the Quota Tier resource for a subscription. The only properties that can be updated are - "tierUpgradePolicy". - - Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide - resource type. It holds current tier information. + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - :param default: Default parameter. Leave the value as default. Required. - :type default: str - :param tier: The parameters to provide for the quota tier resource. Required. - :type tier: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: QuotaTier. The QuotaTier is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier - :raises ~azure.core.exceptions.HttpResponseError: - """ + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def update(self, default: str, tier: Union[_models.QuotaTier, JSON, IO[bytes]], **kwargs: Any) -> _models.QuotaTier: - """Updates the Quota Tier resource for a subscription. The only properties that can be updated are - "tierUpgradePolicy". + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - Update the Quota Tier information for the given subscription. QuotaTiers is a subscription wide - resource type. It holds current tier information. + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - :param default: Default parameter. Leave the value as default. Required. - :type default: str - :param tier: The parameters to provide for the quota tier resource. Is one of the following - types: QuotaTier, JSON, IO[bytes] Required. - :type tier: ~azure.mgmt.cognitiveservices.models.QuotaTier or JSON or IO[bytes] - :return: QuotaTier. The QuotaTier is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.QuotaTier - :raises ~azure.core.exceptions.HttpResponseError: - """ + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def _restart_initial( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17025,25 +21439,17 @@ def update(self, default: str, tier: Union[_models.QuotaTier, JSON, IO[bytes]], } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.QuotaTier] = kwargs.pop("cls", None) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - content_type = content_type or "application/json" - _content = None - if isinstance(tier, (IOBase, bytes)): - _content = tier - else: - _content = json.dumps(tier, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_quota_tiers_update_request( - default=default, + _request = build_computes_restart_request( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -17053,19 +21459,18 @@ def update(self, default: str, tier: Union[_models.QuotaTier, JSON, IO[bytes]], _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -17073,115 +21478,104 @@ def update(self, default: str, tier: Union[_models.QuotaTier, JSON, IO[bytes]], ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.QuotaTier, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.QuotaTier"]: - """Returns all the resources of a particular type belonging to a subscription. + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "compute_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def begin_restart( + self, resource_group_name: str, account_name: str, compute_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Restarts a running ContainerInstance compute resource. This is a long-running operation that + returns 202 Accepted. Only applicable when computeType is ContainerInstance. - :return: An iterator like instance of QuotaTier - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.QuotaTier] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param compute_name: The name of the compute associated with the Cognitive Services Account. + Required. + :type compute_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.QuotaTier]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_quota_tiers_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.QuotaTier], - deserialized.get("value", []), + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + account_name=account_name, + compute_name=compute_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + return cls(pipeline_response, None, {}) # type: ignore - def get_next(next_link=None): - _request = prepare_request(next_link) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore -class AgentApplicationsOperations: +class WorkbenchesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`agent_applications` attribute. + :attr:`workbenches` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -17194,12 +21588,25 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) def get( - self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any - ) -> _models.AgentApplication: - """Gets an Agent Application by name. - - Gets an Agent Application by name. + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> _models.Workbench: + """Gets the specified workbench associated with the project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17208,10 +21615,10 @@ def get( :type account_name: str :param project_name: The name of Cognitive Services account's project. Required. :type project_name: str - :param name: Name for the Agent Application. Required. - :type name: str - :return: AgentApplication. The AgentApplication is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.AgentApplication + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :return: Workbench. The Workbench is compatible with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.Workbench :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17222,18 +21629,112 @@ def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Workbench] = kwargs.pop("cls", None) + + _request = build_workbenches_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workbench, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + resource: Union[_models.Workbench, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentApplication] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_agent_applications_get_request( + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_workbenches_create_or_update_request( resource_group_name=resource_group_name, account_name=account_name, project_name=project_name, - name=name, + workbench_name=workbench_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -17243,19 +21744,18 @@ def get( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -17263,23 +21763,244 @@ def get( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentApplication, response.json()) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( + @overload + def begin_create_or_update( self, resource_group_name: str, account_name: str, project_name: str, - name: str, - body: Union[_models.AgentApplication, JSON, IO[bytes]], + workbench_name: str, + resource: _models.Workbench, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Workbench]: + """Creates or updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param resource: The workbench properties. Required. + :type resource: ~azure.mgmt.cognitiveservices.models.Workbench + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Workbench]: + """Creates or updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param resource: The workbench properties. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Workbench]: + """Creates or updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param resource: The workbench properties. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + resource: Union[_models.Workbench, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Workbench]: + """Creates or updates a workbench associated with the project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param resource: The workbench properties. Is one of the following types: Workbench, JSON, + IO[bytes] Required. + :type resource: ~azure.mgmt.cognitiveservices.models.Workbench or JSON or IO[bytes] + :return: An instance of LROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Workbench] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbench] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Workbench, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Workbench].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Workbench]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def _update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + workbench_name: str, + properties: Union[_models.Workbench, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -17298,16 +22019,16 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(properties, (IOBase, bytes)): + _content = properties else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_agent_applications_create_or_update_request( + _request = build_workbenches_update_request( resource_group_name=resource_group_name, account_name=account_name, project_name=project_name, - name=name, + workbench_name=workbench_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -17328,7 +22049,7 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -17341,14 +22062,9 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["x-ms-async-operation-timeout"] = self._deserialize( - "str", response.headers.get("x-ms-async-operation-timeout") - ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -17358,20 +22074,18 @@ def _create_or_update_initial( return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, account_name: str, project_name: str, - name: str, - body: _models.AgentApplication, + workbench_name: str, + properties: _models.Workbench, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AgentApplication]: - """Creates or updates an Agent Application (asynchronous). - - Creates or updates an Agent Application (asynchronous). + ) -> LROPoller[_models.Workbench]: + """Updates a workbench associated with the project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17380,34 +22094,32 @@ def begin_create_or_update( :type account_name: str :param project_name: The name of Cognitive Services account's project. Required. :type project_name: str - :param name: Name for the Agent Application. Required. - :type name: str - :param body: Agent Application definition object. Required. - :type body: ~azure.mgmt.cognitiveservices.models.AgentApplication + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param properties: The workbench properties to update. Required. + :type properties: ~azure.mgmt.cognitiveservices.models.Workbench :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AgentApplication. The AgentApplication is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.AgentApplication] + :return: An instance of LROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Workbench] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, account_name: str, project_name: str, - name: str, - body: JSON, + workbench_name: str, + properties: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AgentApplication]: - """Creates or updates an Agent Application (asynchronous). - - Creates or updates an Agent Application (asynchronous). + ) -> LROPoller[_models.Workbench]: + """Updates a workbench associated with the project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17416,34 +22128,32 @@ def begin_create_or_update( :type account_name: str :param project_name: The name of Cognitive Services account's project. Required. :type project_name: str - :param name: Name for the Agent Application. Required. - :type name: str - :param body: Agent Application definition object. Required. - :type body: JSON + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param properties: The workbench properties to update. Required. + :type properties: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AgentApplication. The AgentApplication is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.AgentApplication] + :return: An instance of LROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Workbench] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_update( self, resource_group_name: str, account_name: str, project_name: str, - name: str, - body: IO[bytes], + workbench_name: str, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.AgentApplication]: - """Creates or updates an Agent Application (asynchronous). - - Creates or updates an Agent Application (asynchronous). + ) -> LROPoller[_models.Workbench]: + """Updates a workbench associated with the project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17452,32 +22162,46 @@ def begin_create_or_update( :type account_name: str :param project_name: The name of Cognitive Services account's project. Required. :type project_name: str - :param name: Name for the Agent Application. Required. - :type name: str - :param body: Agent Application definition object. Required. - :type body: IO[bytes] + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param properties: The workbench properties to update. Required. + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns AgentApplication. The AgentApplication is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.AgentApplication] + :return: An instance of LROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Workbench] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def begin_update( self, resource_group_name: str, account_name: str, project_name: str, - name: str, - body: Union[_models.AgentApplication, JSON, IO[bytes]], + workbench_name: str, + properties: Union[_models.Workbench, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.AgentApplication]: - """Creates or updates an Agent Application (asynchronous). - - Creates or updates an Agent Application (asynchronous). + ) -> LROPoller[_models.Workbench]: + """Updates a workbench associated with the project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17486,31 +22210,31 @@ def begin_create_or_update( :type account_name: str :param project_name: The name of Cognitive Services account's project. Required. :type project_name: str - :param name: Name for the Agent Application. Required. - :type name: str - :param body: Agent Application definition object. Is one of the following types: - AgentApplication, JSON, IO[bytes] Required. - :type body: ~azure.mgmt.cognitiveservices.models.AgentApplication or JSON or IO[bytes] - :return: An instance of LROPoller that returns AgentApplication. The AgentApplication is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.AgentApplication] + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :param properties: The workbench properties to update. Is one of the following types: + Workbench, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.cognitiveservices.models.Workbench or JSON or IO[bytes] + :return: An instance of LROPoller that returns Workbench. The Workbench is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Workbench] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentApplication] = kwargs.pop("cls", None) + cls: ClsType[_models.Workbench] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, account_name=account_name, project_name=project_name, - name=name, - body=body, + workbench_name=workbench_name, + properties=properties, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -17522,7 +22246,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.AgentApplication, response.json()) + deserialized = _deserialize(_models.Workbench, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -17540,18 +22264,32 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.AgentApplication].from_continuation_token( + return LROPoller[_models.Workbench].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.AgentApplication]( + return LROPoller[_models.Workbench]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) def _delete_initial( - self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17566,11 +22304,11 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_agent_applications_delete_request( + _request = build_workbenches_delete_request( resource_group_name=resource_group_name, account_name=account_name, project_name=project_name, - name=name, + workbench_name=workbench_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17614,12 +22352,24 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) def begin_delete( - self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any ) -> LROPoller[None]: - """Delete Agent Application. - - Delete Agent Application. + """Deletes the specified workbench associated with the project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17628,8 +22378,8 @@ def begin_delete( :type account_name: str :param project_name: The name of Cognitive Services account's project. Required. :type project_name: str - :param name: Name for the Agent Application. Required. - :type name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -17646,7 +22396,7 @@ def begin_delete( resource_group_name=resource_group_name, account_name=account_name, project_name=project_name, - name=name, + workbench_name=workbench_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17681,24 +22431,24 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "accept", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) def list( - self, - resource_group_name: str, - account_name: str, - project_name: str, - *, - count: int = 30, - skip: Optional[int] = None, - skip_token: Optional[str] = None, - names: Optional[List[str]] = None, - search_text: Optional[str] = None, - order_by: Optional[str] = None, - order_by_asc: bool = False, - **kwargs: Any - ) -> ItemPaged["_models.AgentApplication"]: - """Lists Agent Applications in the project. - - Lists Agent Applications in the project. + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + ) -> ItemPaged["_models.Workbench"]: + """Gets the workbenches associated with the project. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17707,29 +22457,14 @@ def list( :type account_name: str :param project_name: The name of Cognitive Services account's project. Required. :type project_name: str - :keyword count: Number of agent applications to be retrieved in a page of results. Default - value is 30. - :paramtype count: int - :keyword skip: Number of agent applications to skip. Default value is None. - :paramtype skip: int - :keyword skip_token: Continuation token for pagination. Default value is None. - :paramtype skip_token: str - :keyword names: Names of agent applications to retrieve. Default value is None. - :paramtype names: list[str] - :keyword search_text: Search text for filtering agent applications. Default value is None. - :paramtype search_text: str - :keyword order_by: Field to order by. Default value is None. - :paramtype order_by: str - :keyword order_by_asc: Whether to order in ascending order. Default value is False. - :paramtype order_by_asc: bool - :return: An iterator like instance of AgentApplication - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.AgentApplication] + :return: An iterator like instance of Workbench + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Workbench] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.AgentApplication]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Workbench]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17742,18 +22477,11 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_agent_applications_list_request( + _request = build_workbenches_list_request( resource_group_name=resource_group_name, account_name=account_name, project_name=project_name, subscription_id=self._config.subscription_id, - count=count, - skip=skip, - skip_token=skip_token, - names=names, - search_text=search_text, - order_by=order_by, - order_by_asc=order_by_asc, api_version=self._config.api_version, headers=_headers, params=_params, @@ -17776,7 +22504,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -17790,7 +22521,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.AgentApplication], + List[_models.Workbench], deserialized.get("value", []), ) if cls: @@ -17818,28 +22549,180 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def _start_initial( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_workbenches_start_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + @distributed_trace - def list_agents( - self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any - ) -> _models.AgentReferenceResourceArmPaginatedResult: - """Lists agents for an Agent Application. + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def begin_start( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> LROPoller[None]: + """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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - Lists agents for an Agent Application. + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. Required. - :type account_name: str - :param project_name: The name of Cognitive Services account's project. Required. - :type project_name: str - :param name: Name for the Agent Application. Required. - :type name: str - :return: AgentReferenceResourceArmPaginatedResult. The AgentReferenceResourceArmPaginatedResult - is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.AgentReferenceResourceArmPaginatedResult - :raises ~azure.core.exceptions.HttpResponseError: - """ + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def _stop_initial( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17851,13 +22734,13 @@ def list_agents( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.AgentReferenceResourceArmPaginatedResult] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_agent_applications_list_agents_request( + _request = build_workbenches_stop_request( resource_group_name=resource_group_name, account_name=account_name, project_name=project_name, - name=name, + workbench_name=workbench_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17869,19 +22752,18 @@ def list_agents( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -17889,23 +22771,38 @@ def list_agents( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.AgentReferenceResourceArmPaginatedResult, response.json()) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def enable( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any - ) -> None: - """Enables an Agent Application. - - Enables an Agent Application. + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def begin_stop( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> LROPoller[None]: + """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. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17914,12 +22811,75 @@ def enable( # pylint: disable=inconsistent-return-statements :type account_name: str :param project_name: The name of Cognitive Services account's project. Required. :type project_name: str - :param name: Name for the Agent Application. Required. - :type name: str - :return: None - :rtype: None + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def _restart_initial( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -17931,13 +22891,13 @@ def enable( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_agent_applications_enable_request( + _request = build_workbenches_restart_request( resource_group_name=resource_group_name, account_name=account_name, project_name=project_name, - name=name, + workbench_name=workbench_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17948,14 +22908,19 @@ def enable( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( _models.ErrorResponse, @@ -17963,16 +22928,38 @@ def enable( # pylint: disable=inconsistent-return-statements ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore - @distributed_trace - def disable( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, project_name: str, name: str, **kwargs: Any - ) -> None: - """Disables an Agent Application. + return deserialized # type: ignore - Disables an Agent Application. + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15-preview", + params_added_on={ + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "project_name", + "workbench_name", + ] + }, + api_versions_list=["2026-03-15-preview"], + ) + def begin_restart( + self, resource_group_name: str, account_name: str, project_name: str, workbench_name: str, **kwargs: Any + ) -> LROPoller[None]: + """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. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17981,67 +22968,67 @@ def disable( # pylint: disable=inconsistent-return-statements :type account_name: str :param project_name: The name of Cognitive Services account's project. Required. :type project_name: str - :param name: Name for the Agent Application. Required. - :type name: str - :return: None - :rtype: None + :param workbench_name: The name of the workbench associated with the project. Required. + :type workbench_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + workbench_name=workbench_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - _request = build_agent_applications_disable_request( - resource_group_name=resource_group_name, - account_name=account_name, - project_name=project_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore -class ComputeOperationsOperations: +class ManagedComputeCapacitiesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s - :attr:`compute_operations` attribute. + :attr:`managed_compute_capacities` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -18055,23 +23042,44 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace @api_version_validation( - method_added_on="2026-01-15-preview", + method_added_on="2026-03-15-preview", params_added_on={ - "2026-01-15-preview": ["api_version", "subscription_id", "location", "operation_id", "accept"] + "2026-03-15-preview": [ + "api_version", + "subscription_id", + "offer", + "accelerator_type", + "deployment_id", + "accept", + ] }, - api_versions_list=["2026-01-15-preview"], + api_versions_list=["2026-03-15-preview"], ) - def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.ComputeOperationStatus: - """Gets the status of a compute operation. - - :param location: The name of the Azure region. Required. - :type location: str - :param operation_id: The ID of the compute operation. Required. - :type operation_id: str - :return: ComputeOperationStatus. The ComputeOperationStatus is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.ComputeOperationStatus + def list( + self, *, offer: str, accelerator_type: Optional[str] = None, deployment_id: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.ManagedComputeCapacity"]: + """Gets the managed compute capacities for a subscription. Returns available capacity per + accelerator type, including deployment size information. + + :keyword offer: The offer name to query capacity for (required). Required. + :paramtype offer: str + :keyword accelerator_type: Optional accelerator type filter to narrow results to a specific + accelerator type. Default value is None. + :paramtype accelerator_type: str + :keyword deployment_id: Optional deployment resource ID. When provided, returns capacity for + the specific region + where the deployment is hosted rather than the best available region. Default value is None. + :paramtype deployment_id: str + :return: An iterator like instance of ManagedComputeCapacity + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ManagedComputeCapacity] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedComputeCapacity]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18080,54 +23088,80 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Comput } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.ComputeOperationStatus] = kwargs.pop("cls", None) + _request = build_managed_compute_capacities_list_request( + subscription_id=self._config.subscription_id, + offer=offer, + accelerator_type=accelerator_type, + deployment_id=deployment_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_compute_operations_get_request( - location=location, - operation_id=operation_id, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ManagedComputeCapacity], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ComputeOperationStatus, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) class PrivateLinkResourcesOperations: @@ -18528,7 +23562,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[_models.RaiExternalSafetyProviderSchema, _models.RaiExternalSafetyProvider]: + ) -> _models.RaiExternalSafetyProviderSchema: """Create the rai safety provider associated with the subscription. :param safety_provider_name: The name of the Rai External Safety Provider associated with the @@ -18539,17 +23573,16 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiExternalSafetyProviderSchema or RaiExternalSafetyProvider. The - RaiExternalSafetyProviderSchema is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema or - ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProvider + :return: RaiExternalSafetyProviderSchema. The RaiExternalSafetyProviderSchema is compatible + with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema :raises ~azure.core.exceptions.HttpResponseError: """ @overload def create_or_update( self, safety_provider_name: str, safety_provider: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> Union[_models.RaiExternalSafetyProviderSchema, _models.RaiExternalSafetyProvider]: + ) -> _models.RaiExternalSafetyProviderSchema: """Create the rai safety provider associated with the subscription. :param safety_provider_name: The name of the Rai External Safety Provider associated with the @@ -18560,10 +23593,9 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: RaiExternalSafetyProviderSchema or RaiExternalSafetyProvider. The - RaiExternalSafetyProviderSchema is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema or - ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProvider + :return: RaiExternalSafetyProviderSchema. The RaiExternalSafetyProviderSchema is compatible + with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema :raises ~azure.core.exceptions.HttpResponseError: """ @@ -18575,7 +23607,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Union[_models.RaiExternalSafetyProviderSchema, _models.RaiExternalSafetyProvider]: + ) -> _models.RaiExternalSafetyProviderSchema: """Create the rai safety provider associated with the subscription. :param safety_provider_name: The name of the Rai External Safety Provider associated with the @@ -18586,10 +23618,9 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: RaiExternalSafetyProviderSchema or RaiExternalSafetyProvider. The - RaiExternalSafetyProviderSchema is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema or - ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProvider + :return: RaiExternalSafetyProviderSchema. The RaiExternalSafetyProviderSchema is compatible + with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema :raises ~azure.core.exceptions.HttpResponseError: """ @@ -18599,7 +23630,7 @@ def create_or_update( safety_provider_name: str, safety_provider: Union[_models.RaiExternalSafetyProviderSchema, JSON, IO[bytes]], **kwargs: Any - ) -> Union[_models.RaiExternalSafetyProviderSchema, _models.RaiExternalSafetyProvider]: + ) -> _models.RaiExternalSafetyProviderSchema: """Create the rai safety provider associated with the subscription. :param safety_provider_name: The name of the Rai External Safety Provider associated with the @@ -18609,10 +23640,9 @@ def create_or_update( following types: RaiExternalSafetyProviderSchema, JSON, IO[bytes] Required. :type safety_provider: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema or JSON or IO[bytes] - :return: RaiExternalSafetyProviderSchema or RaiExternalSafetyProvider. The - RaiExternalSafetyProviderSchema is compatible with MutableMapping - :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema or - ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProvider + :return: RaiExternalSafetyProviderSchema. The RaiExternalSafetyProviderSchema is compatible + with MutableMapping + :rtype: ~azure.mgmt.cognitiveservices.models.RaiExternalSafetyProviderSchema :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -18627,9 +23657,7 @@ def create_or_update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Union[_models.RaiExternalSafetyProviderSchema, _models.RaiExternalSafetyProvider]] = kwargs.pop( - "cls", None - ) + cls: ClsType[_models.RaiExternalSafetyProviderSchema] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -18673,17 +23701,10 @@ def create_or_update( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.RaiExternalSafetyProviderSchema, response.json()) - - if response.status_code == 201: - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.RaiExternalSafetyProvider, response.json()) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RaiExternalSafetyProviderSchema, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -18871,7 +23892,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -19555,7 +24579,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -20146,7 +25173,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -20785,7 +25815,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -21474,7 +26507,7 @@ def get_long_running_output(pipeline_response): "managed_network_name", ] }, - api_versions_list=["2026-01-15-preview"], + api_versions_list=["2026-01-15-preview", "2026-03-01", "2026-03-15-preview"], ) def _delete_initial( self, resource_group_name: str, account_name: str, managed_network_name: str, **kwargs: Any @@ -21550,7 +26583,7 @@ def _delete_initial( "managed_network_name", ] }, - api_versions_list=["2026-01-15-preview"], + api_versions_list=["2026-01-15-preview", "2026-03-01", "2026-03-15-preview"], ) def begin_delete( self, resource_group_name: str, account_name: str, managed_network_name: str, **kwargs: Any @@ -21676,7 +26709,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -21825,7 +26861,7 @@ def begin_post( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OutboundRuleListResult]: + ) -> LROPoller[ItemPaged["_models.OutboundRuleBasicResource"]]: """The POST API for updating the outbound rules of the managed network associated with the cognitive services account. @@ -21845,10 +26881,10 @@ def begin_post( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OutboundRuleListResult. The - OutboundRuleListResult is compatible with MutableMapping + :return: An instance of LROPoller that returns an iterator like instance of list of + OutboundRuleBasicResource :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.OutboundRuleListResult] + ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.OutboundRuleBasicResource]] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -21862,7 +26898,7 @@ def begin_post( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OutboundRuleListResult]: + ) -> LROPoller[ItemPaged["_models.OutboundRuleBasicResource"]]: """The POST API for updating the outbound rules of the managed network associated with the cognitive services account. @@ -21882,10 +26918,10 @@ def begin_post( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OutboundRuleListResult. The - OutboundRuleListResult is compatible with MutableMapping + :return: An instance of LROPoller that returns an iterator like instance of list of + OutboundRuleBasicResource :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.OutboundRuleListResult] + ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.OutboundRuleBasicResource]] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -21899,7 +26935,7 @@ def begin_post( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.OutboundRuleListResult]: + ) -> LROPoller[ItemPaged["_models.OutboundRuleBasicResource"]]: """The POST API for updating the outbound rules of the managed network associated with the cognitive services account. @@ -21919,10 +26955,10 @@ def begin_post( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns OutboundRuleListResult. The - OutboundRuleListResult is compatible with MutableMapping + :return: An instance of LROPoller that returns an iterator like instance of list of + OutboundRuleBasicResource :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.OutboundRuleListResult] + ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.OutboundRuleBasicResource]] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -21934,7 +26970,7 @@ def begin_post( managed_network_name: str, body: Union[_models.ManagedNetworkSettingsBasicResource, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.OutboundRuleListResult]: + ) -> LROPoller[ItemPaged["_models.OutboundRuleBasicResource"]]: """The POST API for updating the outbound rules of the managed network associated with the cognitive services account. @@ -21953,17 +26989,108 @@ def begin_post( ManagedNetworkSettingsBasicResource, JSON, IO[bytes] Required. :type body: ~azure.mgmt.cognitiveservices.models.ManagedNetworkSettingsBasicResource or JSON or IO[bytes] - :return: An instance of LROPoller that returns OutboundRuleListResult. The - OutboundRuleListResult is compatible with MutableMapping + :return: An instance of LROPoller that returns an iterator like instance of list of + OutboundRuleBasicResource :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.OutboundRuleListResult] + ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.OutboundRuleBasicResource]] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.OutboundRuleListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.OutboundRuleBasicResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + def prepare_request(next_link=None): + if not next_link: + + _request = build_outbound_rules_post_request( + resource_group_name=resource_group_name, + account_name=account_name, + managed_network_name=managed_network_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.OutboundRuleBasicResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -21983,15 +27110,12 @@ def begin_post( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} - response = pipeline_response.http_response - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + def internal_get_next(next_link=None): + if next_link is None: + return pipeline_response + return get_next(next_link) - deserialized = _deserialize(_models.OutboundRuleListResult, response.json()) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return ItemPaged(internal_get_next, extract_data) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -22006,13 +27130,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.OutboundRuleListResult].from_continuation_token( + return LROPoller[ItemPaged["_models.OutboundRuleBasicResource"]].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.OutboundRuleListResult]( + return LROPoller[ItemPaged["_models.OutboundRuleBasicResource"]]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -22966,7 +28090,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -23232,7 +28359,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -23350,7 +28480,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -23463,7 +28596,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -23576,7 +28712,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -23701,7 +28840,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -23823,7 +28965,10 @@ def prepare_request(next_link=None): ) _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_patch.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_patch.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/add_rai_blocklist_items.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/add_rai_blocklist_items.py index 4d3685221758..5b7b44734766 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/add_rai_blocklist_items.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/add_rai_blocklist_items.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/AddRaiBlocklistItems.json +# x-ms-original-file: 2026-03-15-preview/AddRaiBlocklistItems.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/calculate_model_capacity.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/calculate_model_capacity.py index acc0aa76279d..7bdc940ee487 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/calculate_model_capacity.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/calculate_model_capacity.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/CalculateModelCapacity.json +# x-ms-original-file: 2026-03-15-preview/CalculateModelCapacity.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/check_domain_availability.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/check_domain_availability.py index f2af5e1bd261..535736e47816 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/check_domain_availability.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/check_domain_availability.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/CheckDomainAvailability.json +# x-ms-original-file: 2026-03-15-preview/CheckDomainAvailability.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/check_sku_availability.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/check_sku_availability.py index 37c212663ec3..6320c7cd3c3f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/check_sku_availability.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/check_sku_availability.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/CheckSkuAvailability.json +# x-ms-original-file: 2026-03-15-preview/CheckSkuAvailability.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create.py index cf9583822ddf..01bfd8a20d4c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/AccountConnection/create.json +# x-ms-original-file: 2026-03-15-preview/AccountConnection/create.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py index 9a603167df52..709ea20a67e5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/CreateAccount.json +# x-ms-original-file: 2026-03-15-preview/CreateAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py index ff9a051fd3df..c9fca3415e49 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/CreateAccountMin.json +# x-ms-original-file: 2026-03-15-preview/CreateAccountMin.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update.py index fabe13e7e4ec..0b46fb3950c4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/AgentDeployment/createOrUpdate.json +# x-ms-original-file: 2026-03-15-preview/AgentDeployment/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_managed_compute_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_managed_compute_deployment.py new file mode 100644 index 000000000000..768eb7d5d013 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_managed_compute_deployment.py @@ -0,0 +1,53 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python create_or_update_managed_compute_deployment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.managed_compute_deployments.begin_create_or_update( + resource_group_name="resourceGroupName", + account_name="accountName", + deployment_name="gpt-oss-120b-gpu", + resource={ + "properties": { + "acceleratorType": "H100_80GB", + "deploymentTemplate": "azureml://registries/azureml-openai-oss/deploymenttemplates/gpt-oss-120b-short-context/versions/1", + "model": "azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4", + "versionUpgradeOption": "OnceNewDefaultVersionAvailable", + }, + "sku": {"capacity": 1, "name": "GlobalManagedCompute"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-15-preview/CreateOrUpdateManagedComputeDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_managed_network_v2.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_managed_network_v2.py index d0defd520fa7..988dec60cf34 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_managed_network_v2.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_managed_network_v2.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ManagedNetwork/createOrUpdateManagedNetworkV2.json +# x-ms-original-file: 2026-03-15-preview/ManagedNetwork/createOrUpdateManagedNetworkV2.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_quota_tier.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_quota_tier.py index fb98ed970f91..3d547cde7e60 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_quota_tier.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_quota_tier.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/CreateOrUpdateQuotaTier.json +# x-ms-original-file: 2026-03-15-preview/CreateOrUpdateQuotaTier.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_rule_v2.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_rule_v2.py index d00b74c65e28..fc8ea36d5541 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_rule_v2.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_rule_v2.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ManagedNetwork/createOrUpdateRuleV2.json +# x-ms-original-file: 2026-03-15-preview/ManagedNetwork/createOrUpdateRuleV2.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_vm_managed_compute_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_vm_managed_compute_deployment.py new file mode 100644 index 000000000000..bbc3a705f3ad --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_or_update_vm_managed_compute_deployment.py @@ -0,0 +1,53 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python create_or_update_vm_managed_compute_deployment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.managed_compute_deployments.begin_create_or_update( + resource_group_name="resourceGroupName", + account_name="accountName", + deployment_name="gpt-oss-120b-byoc", + resource={ + "properties": { + "computeId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/computes/my-h100-pool", + "deploymentTemplate": "projects/my-project/deploymentTemplates/gpt-oss-120b-vllm-tuned/versions/2", + "model": "azureml://registries/azureml-openai-oss/models/gpt-oss-120b/versions/4", + "priority": "High", + }, + "sku": {"capacity": 2, "name": "VmManagedCompute"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-15-preview/CreateOrUpdateVmManagedComputeDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project.py index 3ee198af5b38..fed4497b2935 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/CreateProject.json +# x-ms-original-file: 2026-03-15-preview/CreateProject.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project_min.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project_min.py index aacf1ab9a70a..1907395dfa24 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project_min.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project_min.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/CreateProjectMin.json +# x-ms-original-file: 2026-03-15-preview/CreateProjectMin.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py index aae85934644b..35d3ed2a9766 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/CreateSharedCommitmentPlan.json +# x-ms-original-file: 2026-03-15-preview/CreateSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py index 840d801e997d..e9936d1d4fe5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/CreateSharedCommitmentPlanAssociation.json +# x-ms-original-file: 2026-03-15-preview/CreateSharedCommitmentPlanAssociation.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete.py index 87532e49ca6b..a789c1e320bf 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete.py @@ -39,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/AgentDeployment/delete.json +# x-ms-original-file: 2026-03-15-preview/AgentDeployment/delete.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py index cf5575d2fb3b..c7abc8b3d8d2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteAccount.json +# x-ms-original-file: 2026-03-15-preview/DeleteAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py index 9231ff00df0e..141c3221c958 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteCommitmentPlan.json +# x-ms-original-file: 2026-03-15-preview/DeleteCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_compute.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_compute.py new file mode 100644 index 000000000000..873deaa27602 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_compute.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete_compute.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.computes.begin_delete( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + compute_name="myCompute", + ).result() + + +# x-ms-original-file: 2026-03-15-preview/DeleteCompute.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py index 706665e27709..7c2be7db1fbc 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteDeployment.json +# x-ms-original-file: 2026-03-15-preview/DeleteDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py index 28fa945298bc..f29fcfd56eb3 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteEncryptionScope.json +# x-ms-original-file: 2026-03-15-preview/DeleteEncryptionScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_managed_compute_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_managed_compute_deployment.py new file mode 100644 index 000000000000..4d2bbac2ea20 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_managed_compute_deployment.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete_managed_compute_deployment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.managed_compute_deployments.begin_delete( + resource_group_name="resourceGroupName", + account_name="accountName", + deployment_name="gpt-oss-120b-gpu", + ).result() + + +# x-ms-original-file: 2026-03-15-preview/DeleteManagedComputeDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_managed_network_v2.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_managed_network_v2.py index cafb1419808a..9ab62c3055cd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_managed_network_v2.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_managed_network_v2.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/ManagedNetwork/deleteManagedNetworkV2.json +# x-ms-original-file: 2026-03-15-preview/ManagedNetwork/deleteManagedNetworkV2.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py index 9dad82af1621..818143c38de1 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeletePrivateEndpointConnection.json +# x-ms-original-file: 2026-03-15-preview/DeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_project.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_project.py index ba3eb3c20202..a4914e8d398c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_project.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_project.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteProject.json +# x-ms-original-file: 2026-03-15-preview/DeleteProject.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py index 95320d1130a2..3fe2f8c2cee6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteRaiBlocklist.json +# x-ms-original-file: 2026-03-15-preview/DeleteRaiBlocklist.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.py index 09476dadd8d4..71a13bff78c6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteRaiBlocklistItem.json +# x-ms-original-file: 2026-03-15-preview/DeleteRaiBlocklistItem.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_items.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_items.py index e492dcbd02a7..c207c62706dd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_items.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_items.py @@ -38,6 +38,6 @@ def main(): ) -# x-ms-original-file: 2026-01-15-preview/DeleteRaiBlocklistItems.json +# x-ms-original-file: 2026-03-15-preview/DeleteRaiBlocklistItems.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_external_safety_provider.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_external_safety_provider.py index fecb09066d13..c9400776cf41 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_external_safety_provider.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_external_safety_provider.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteRaiExternalSafetyProvider.json +# x-ms-original-file: 2026-03-15-preview/DeleteRaiExternalSafetyProvider.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py index 065af01a053a..d8b80ce1bb88 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteRaiPolicy.json +# x-ms-original-file: 2026-03-15-preview/DeleteRaiPolicy.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_tool_label.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_tool_label.py index 24a673dda5cb..30f9b616918e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_tool_label.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_tool_label.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteRaiToolLabel.json +# x-ms-original-file: 2026-03-15-preview/DeleteRaiToolLabel.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_topic.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_topic.py index b0cf28e42d40..5a8fabacecfa 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_topic.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_topic.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteRaiTopic.json +# x-ms-original-file: 2026-03-15-preview/DeleteRaiTopic.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rule_v2.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rule_v2.py index ec004566d83f..3cc1d62bcc29 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rule_v2.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rule_v2.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/ManagedNetwork/deleteRuleV2.json +# x-ms-original-file: 2026-03-15-preview/ManagedNetwork/deleteRuleV2.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py index af04bdad7966..1c38237a18a6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteSharedCommitmentPlan.json +# x-ms-original-file: 2026-03-15-preview/DeleteSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py index 1a12ce5c2bd4..31fa66596c26 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteSharedCommitmentPlanAssociation.json +# x-ms-original-file: 2026-03-15-preview/DeleteSharedCommitmentPlanAssociation.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_subscription_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_subscription_rai_policy.py index 073d788b8518..a30cedab5492 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_subscription_rai_policy.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_subscription_rai_policy.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/DeleteSubscriptionRaiPolicy.json +# x-ms-original-file: 2026-03-15-preview/DeleteSubscriptionRaiPolicy.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_workbench.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_workbench.py new file mode 100644 index 000000000000..1c4f0c349cb5 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_workbench.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete_workbench.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.workbenches.begin_delete( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + project_name="myProject", + workbench_name="myWorkbench", + ).result() + + +# x-ms-original-file: 2026-03-15-preview/DeleteWorkbench.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/disable.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/disable.py index 1d34e42d4cd6..3b05ffb135f1 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/disable.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/disable.py @@ -38,6 +38,6 @@ def main(): ) -# x-ms-original-file: 2026-01-15-preview/AgentApplication/disable.json +# x-ms-original-file: 2026-03-15-preview/AgentApplication/disable.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/enable.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/enable.py index 96b75778d148..f58698603b4d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/enable.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/enable.py @@ -38,6 +38,6 @@ def main(): ) -# x-ms-original-file: 2026-01-15-preview/AgentApplication/enable.json +# x-ms-original-file: 2026-03-15-preview/AgentApplication/enable.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/evaluate_deployment_policies.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/evaluate_deployment_policies.py new file mode 100644 index 000000000000..f48f151a1067 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/evaluate_deployment_policies.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python evaluate_deployment_policies.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.accounts.evaluate_deployment_policies( + resource_group_name="resourceGroupName", + account_name="accountName", + body={ + "deployments": [ + { + "name": "gpt4o-deployment", + "properties": { + "model": {"format": "OpenAI", "name": "gpt-4o", "version": "2024-11-20"}, + "raiPolicyName": "Microsoft.DefaultV2", + }, + }, + { + "name": "ada-embedding", + "properties": {"model": {"format": "OpenAI", "name": "text-embedding-ada-002", "version": "2"}}, + }, + ] + }, + ) + print(response) + + +# x-ms-original-file: 2026-03-15-preview/EvaluateDeploymentPolicies.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get.py index 0689288f5d38..a4ddd115086c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/AgentDeployment/get.json +# x-ms-original-file: 2026-03-15-preview/AgentDeployment/get.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py index bc344e2973a1..646dcd046bc6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetAccount.json +# x-ms-original-file: 2026-03-15-preview/GetAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py index 04e1b71f5640..0660a1b6e08f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetCommitmentPlan.json +# x-ms-original-file: 2026-03-15-preview/GetCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_compute.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_compute.py new file mode 100644 index 000000000000..cc8cd49ded81 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_compute.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get_compute.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.computes.get( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + compute_name="myCompute", + ) + print(response) + + +# x-ms-original-file: 2026-03-15-preview/GetCompute.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_compute_operation_status.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_compute_operation_status.py index e78ba77cd6a2..ead9297af173 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_compute_operation_status.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_compute_operation_status.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetComputeOperationStatus.json +# x-ms-original-file: 2026-03-15-preview/GetComputeOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_container_instance_compute.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_container_instance_compute.py new file mode 100644 index 000000000000..d8645345c380 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_container_instance_compute.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get_container_instance_compute.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.computes.get( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + compute_name="myContainerInstance", + ) + print(response) + + +# x-ms-original-file: 2026-03-15-preview/GetContainerInstanceCompute.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_defender_for_ai_setting.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_defender_for_ai_setting.py index 78f1f75e6431..461c911fd298 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_defender_for_ai_setting.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_defender_for_ai_setting.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetDefenderForAISetting.json +# x-ms-original-file: 2026-03-15-preview/GetDefenderForAISetting.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py index adf5bbd918bb..b9e94432607d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetDeletedAccount.json +# x-ms-original-file: 2026-03-15-preview/GetDeletedAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py index 012279d4e18d..2fbb53563217 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetDeployment.json +# x-ms-original-file: 2026-03-15-preview/GetDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.py index b3a4a11d4451..286b7a180d63 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetEncryptionScope.json +# x-ms-original-file: 2026-03-15-preview/GetEncryptionScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_managed_compute_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_managed_compute_deployment.py new file mode 100644 index 000000000000..3477667ce2bb --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_managed_compute_deployment.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get_managed_compute_deployment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.managed_compute_deployments.get( + resource_group_name="resourceGroupName", + account_name="accountName", + deployment_name="gpt-oss-120b-gpu", + ) + print(response) + + +# x-ms-original-file: 2026-03-15-preview/GetManagedComputeDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_managed_network_v2.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_managed_network_v2.py index 2192af389f5e..23627dbf7843 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_managed_network_v2.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_managed_network_v2.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ManagedNetwork/getManagedNetworkV2.json +# x-ms-original-file: 2026-03-15-preview/ManagedNetwork/getManagedNetworkV2.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_network_security_perimeter_configurations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_network_security_perimeter_configurations.py index 1fbc7bc15ede..211fa91e1775 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_network_security_perimeter_configurations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_network_security_perimeter_configurations.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetNetworkSecurityPerimeterConfigurations.json +# x-ms-original-file: 2026-03-15-preview/GetNetworkSecurityPerimeterConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py index 292947491925..2b75286eec1f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/GetOperations.json +# x-ms-original-file: 2026-03-15-preview/GetOperations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py index 482a170bb990..a4c4a3a5a9c2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetPrivateEndpointConnection.json +# x-ms-original-file: 2026-03-15-preview/GetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_project.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_project.py index 904a9e6f33eb..42deb6621d4d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_project.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_project.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetProject.json +# x-ms-original-file: 2026-03-15-preview/GetProject.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_quota_tier.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_quota_tier.py index 30d622ae0c7f..489ea64b4f9f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_quota_tier.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_quota_tier.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetQuotaTier.json +# x-ms-original-file: 2026-03-15-preview/GetQuotaTier.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.py index 2e32b8424573..c49004effe8c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetRaiBlocklist.json +# x-ms-original-file: 2026-03-15-preview/GetRaiBlocklist.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.py index 1809776547a8..eadc717354bb 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetRaiBlocklistItem.json +# x-ms-original-file: 2026-03-15-preview/GetRaiBlocklistItem.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_content_filter.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_content_filter.py index 8bee5f4553e9..5ffef1e2a9c0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_content_filter.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_content_filter.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetRaiContentFilter.json +# x-ms-original-file: 2026-03-15-preview/GetRaiContentFilter.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_external_safety_provider.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_external_safety_provider.py index 31cd97a9e361..0ea58fda4b45 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_external_safety_provider.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_external_safety_provider.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetRaiExternalSafetyProvider.json +# x-ms-original-file: 2026-03-15-preview/GetRaiExternalSafetyProvider.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.py index 34036a7ee1e2..1c2698ae7770 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetRaiPolicy.json +# x-ms-original-file: 2026-03-15-preview/GetRaiPolicy.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_tool_label.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_tool_label.py index 516051b2ac5f..e95a17148b7c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_tool_label.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_tool_label.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetRaiToolLabel.json +# x-ms-original-file: 2026-03-15-preview/GetRaiToolLabel.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_topic.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_topic.py index 3bbe218204fb..8d3c6fd89e54 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_topic.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_topic.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetRaiTopic.json +# x-ms-original-file: 2026-03-15-preview/GetRaiTopic.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rule_v2.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rule_v2.py index 1f08c006d0a8..3bcc9bf3dccf 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rule_v2.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rule_v2.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ManagedNetwork/getRuleV2.json +# x-ms-original-file: 2026-03-15-preview/ManagedNetwork/getRuleV2.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py index a24495143842..5f232a256149 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetSharedCommitmentPlan.json +# x-ms-original-file: 2026-03-15-preview/GetSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py index 63ab7b80d12f..32f4ffccfce1 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetSharedCommitmentPlanAssociation.json +# x-ms-original-file: 2026-03-15-preview/GetSharedCommitmentPlanAssociation.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py index 131e5db447d4..8eb21808869f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/GetSkus.json +# x-ms-original-file: 2026-03-15-preview/GetSkus.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_subscription_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_subscription_rai_policy.py index 088bffb767de..35227badee3d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_subscription_rai_policy.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_subscription_rai_policy.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetSubscriptionRaiPolicy.json +# x-ms-original-file: 2026-03-15-preview/GetSubscriptionRaiPolicy.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py index 43d4820b0089..99023c83ed96 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetUsages.json +# x-ms-original-file: 2026-03-15-preview/GetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_classic_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_classic_scope.py index a1991f0883ba..02e96d6de115 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_classic_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_classic_scope.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetUsagesClassicScope.json +# x-ms-original-file: 2026-03-15-preview/GetUsagesClassicScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_data_zone_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_data_zone_scope.py index 0710ac37565c..435c6f94aad3 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_data_zone_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_data_zone_scope.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetUsagesDataZoneScope.json +# x-ms-original-file: 2026-03-15-preview/GetUsagesDataZoneScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_global_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_global_scope.py index 4b31c056cffa..d1005ee726f5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_global_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages_global_scope.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/GetUsagesGlobalScope.json +# x-ms-original-file: 2026-03-15-preview/GetUsagesGlobalScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_vm_managed_compute_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_vm_managed_compute_deployment.py new file mode 100644 index 000000000000..5f1c65da353d --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_vm_managed_compute_deployment.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get_vm_managed_compute_deployment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.managed_compute_deployments.get( + resource_group_name="resourceGroupName", + account_name="accountName", + deployment_name="gpt-oss-120b-byoc", + ) + print(response) + + +# x-ms-original-file: 2026-03-15-preview/GetVmManagedComputeDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_workbench.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_workbench.py new file mode 100644 index 000000000000..15686f3736fe --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_workbench.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get_workbench.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.workbenches.get( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + project_name="myProject", + workbench_name="myWorkbench", + ) + print(response) + + +# x-ms-original-file: 2026-03-15-preview/GetWorkbench.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list.py index f78e89b16cf9..0444b2f211d2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/AgentDeployment/list.json +# x-ms-original-file: 2026-03-15-preview/AgentDeployment/list.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py index fb851902eff1..1b3c5924c4f4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListAccountModels.json +# x-ms-original-file: 2026-03-15-preview/ListAccountModels.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py index 855899211e9c..b2579ed942ba 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListAccountsByResourceGroup.json +# x-ms-original-file: 2026-03-15-preview/ListAccountsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py index 20e8b71ed6a5..bbc69db02477 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListAccountsBySubscription.json +# x-ms-original-file: 2026-03-15-preview/ListAccountsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_agents.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_agents.py index e756a346ece3..3ac4b7cf8549 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_agents.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_agents.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/AgentApplication/listAgents.json +# x-ms-original-file: 2026-03-15-preview/AgentApplication/listAgents.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.py index d5ede2ee562d..7b63c1f932e2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListBlocklistItems.json +# x-ms-original-file: 2026-03-15-preview/ListBlocklistItems.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py index 3aa2899c5e99..5afba318b476 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListBlocklists.json +# x-ms-original-file: 2026-03-15-preview/ListBlocklists.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py index 720f807f2290..4e05ddde8670 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListCommitmentPlans.json +# x-ms-original-file: 2026-03-15-preview/ListCommitmentPlans.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py index 83cd894618bb..f883ac3d858a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListCommitmentTiers.json +# x-ms-original-file: 2026-03-15-preview/ListCommitmentTiers.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_computes.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_computes.py new file mode 100644 index 000000000000..784a600a7f60 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_computes.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_computes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.computes.list( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-03-15-preview/ListComputes.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_defender_for_ai_setting.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_defender_for_ai_setting.py index 6b84bc96e742..9df3c078d2ff 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_defender_for_ai_setting.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_defender_for_ai_setting.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListDefenderForAISetting.json +# x-ms-original-file: 2026-03-15-preview/ListDefenderForAISetting.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py index 8d93eb9413c8..0f6e40390f22 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListDeletedAccountsBySubscription.json +# x-ms-original-file: 2026-03-15-preview/ListDeletedAccountsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.py index c4d7bb5f6d91..74e7553fabce 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListDeploymentSkus.json +# x-ms-original-file: 2026-03-15-preview/ListDeploymentSkus.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py index 6f0f6cfa0a69..cb6a3527ee76 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListDeployments.json +# x-ms-original-file: 2026-03-15-preview/ListDeployments.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.py index f6662a391a91..ba150d7ed11d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListEncryptionScopes.json +# x-ms-original-file: 2026-03-15-preview/ListEncryptionScopes.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py index 6e7582b08870..c88b9a7a19d0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ListKeys.json +# x-ms-original-file: 2026-03-15-preview/ListKeys.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities.py index 44c9cf4ed786..20fe0332a8df 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListLocationBasedModelCapacities.json +# x-ms-original-file: 2026-03-15-preview/ListLocationBasedModelCapacities.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_classic_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_classic_scope.py index 2e89b2bcdcbb..ed62017725a5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_classic_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_classic_scope.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListLocationBasedModelCapacitiesClassicScope.json +# x-ms-original-file: 2026-03-15-preview/ListLocationBasedModelCapacitiesClassicScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_data_zone_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_data_zone_scope.py index 1f271130dbe8..18682848ef5a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_data_zone_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_data_zone_scope.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListLocationBasedModelCapacitiesDataZoneScope.json +# x-ms-original-file: 2026-03-15-preview/ListLocationBasedModelCapacitiesDataZoneScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_global_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_global_scope.py index 081651b22053..ad1fab563189 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_global_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities_global_scope.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListLocationBasedModelCapacitiesGlobalScope.json +# x-ms-original-file: 2026-03-15-preview/ListLocationBasedModelCapacitiesGlobalScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_models.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_models.py index b911c0559937..5fe3461a3432 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_models.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_models.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListLocationModels.json +# x-ms-original-file: 2026-03-15-preview/ListLocationModels.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_capacities.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_capacities.py new file mode 100644 index 000000000000..6ef3c5c60803 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_capacities.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_managed_compute_capacities.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.managed_compute_capacities.list( + offer="MaaP", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-03-15-preview/ListManagedComputeCapacities.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_deployments.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_deployments.py new file mode 100644 index 000000000000..bc1f3d42c1ab --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_deployments.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_managed_compute_deployments.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.managed_compute_deployments.list( + resource_group_name="resourceGroupName", + account_name="accountName", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-03-15-preview/ListManagedComputeDeployments.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_usages.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_usages.py new file mode 100644 index 000000000000..941ab217f575 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_compute_usages.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_managed_compute_usages.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.managed_compute_usages_operation_group.list( + location="eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-03-15-preview/ListManagedComputeUsages.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_network_v2.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_network_v2.py index ddbf67872994..c69278d46f35 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_network_v2.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_managed_network_v2.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ManagedNetwork/listManagedNetworkV2.json +# x-ms-original-file: 2026-03-15-preview/ManagedNetwork/listManagedNetworkV2.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities.py index d5f4c7bae135..bfc593884125 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListModelCapacities.json +# x-ms-original-file: 2026-03-15-preview/ListModelCapacities.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_classic_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_classic_scope.py index 37c48d7aa664..1bd8007743ee 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_classic_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_classic_scope.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListModelCapacitiesClassicScope.json +# x-ms-original-file: 2026-03-15-preview/ListModelCapacitiesClassicScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_data_zone_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_data_zone_scope.py index 1721ea1c9215..0154287cd1eb 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_data_zone_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_data_zone_scope.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListModelCapacitiesDataZoneScope.json +# x-ms-original-file: 2026-03-15-preview/ListModelCapacitiesDataZoneScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_global_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_global_scope.py index 80f25f325f6a..60e75b1b2a08 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_global_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities_global_scope.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListModelCapacitiesGlobalScope.json +# x-ms-original-file: 2026-03-15-preview/ListModelCapacitiesGlobalScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_network_security_perimeter_configurations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_network_security_perimeter_configurations.py index f59bfa0e9f57..fe7f6377812c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_network_security_perimeter_configurations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_network_security_perimeter_configurations.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListNetworkSecurityPerimeterConfigurations.json +# x-ms-original-file: 2026-03-15-preview/ListNetworkSecurityPerimeterConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py index 66ab51fcb38b..d105057b07ca 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ListPrivateEndpointConnections.json +# x-ms-original-file: 2026-03-15-preview/ListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py index dd1c32aa8416..790e0c76d450 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ListPrivateLinkResources.json +# x-ms-original-file: 2026-03-15-preview/ListPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_projects.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_projects.py index 0097747d30ae..76a79b507df2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_projects.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_projects.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListProjects.json +# x-ms-original-file: 2026-03-15-preview/ListProjects.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_quota_tiers.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_quota_tiers.py index 2d466e95fcf4..04256ce75fe3 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_quota_tiers.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_quota_tiers.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListQuotaTiers.json +# x-ms-original-file: 2026-03-15-preview/ListQuotaTiers.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py index 7cb863de5490..20cec0da30c1 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListRaiContentFilters.json +# x-ms-original-file: 2026-03-15-preview/ListRaiContentFilters.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_external_safety_providers.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_external_safety_providers.py index 84cb40b1b4f0..6b54977b2ec4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_external_safety_providers.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_external_safety_providers.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListRaiExternalSafetyProviders.json +# x-ms-original-file: 2026-03-15-preview/ListRaiExternalSafetyProviders.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.py index fddbfb82cb8a..71d9ac75a982 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListRaiPolicies.json +# x-ms-original-file: 2026-03-15-preview/ListRaiPolicies.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_tool_labels.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_tool_labels.py index 64cebddee691..0e055c0f51f6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_tool_labels.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_tool_labels.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListRaiToolLabels.json +# x-ms-original-file: 2026-03-15-preview/ListRaiToolLabels.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_topics.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_topics.py index 799e14e0745d..2135ade970f9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_topics.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_topics.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListRaiTopics.json +# x-ms-original-file: 2026-03-15-preview/ListRaiTopics.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rule_v2.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rule_v2.py index d69416ad49e5..e9ac6e958f28 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rule_v2.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rule_v2.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ManagedNetwork/listRuleV2.json +# x-ms-original-file: 2026-03-15-preview/ManagedNetwork/listRuleV2.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py index b146c6c498a2..4d9685df81a1 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListSharedCommitmentPlanAssociations.json +# x-ms-original-file: 2026-03-15-preview/ListSharedCommitmentPlanAssociations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py index 3e72c6b5cb1f..9f49702ed882 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListSharedCommitmentPlansByResourceGroup.json +# x-ms-original-file: 2026-03-15-preview/ListSharedCommitmentPlansByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py index dc2a46da5eba..0eb76b69cb55 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListSharedCommitmentPlansBySubscription.json +# x-ms-original-file: 2026-03-15-preview/ListSharedCommitmentPlansBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py index 4fb625c5155d..d81117f142e8 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ListSkus.json +# x-ms-original-file: 2026-03-15-preview/ListSkus.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py index e45b15d4a6a8..7f821e36532b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListUsages.json +# x-ms-original-file: 2026-03-15-preview/ListUsages.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_classic_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_classic_scope.py index 30c9bf2302de..4e213efb38ea 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_classic_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_classic_scope.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListUsagesClassicScope.json +# x-ms-original-file: 2026-03-15-preview/ListUsagesClassicScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_data_zone_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_data_zone_scope.py index c2c46e4cde9c..27b9a88f2933 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_data_zone_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_data_zone_scope.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListUsagesDataZoneScope.json +# x-ms-original-file: 2026-03-15-preview/ListUsagesDataZoneScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_global_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_global_scope.py index 0599a8d9bca8..1585d06f1b51 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_global_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages_global_scope.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2026-01-15-preview/ListUsagesGlobalScope.json +# x-ms-original-file: 2026-03-15-preview/ListUsagesGlobalScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_vm_managed_compute_deployments.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_vm_managed_compute_deployments.py new file mode 100644 index 000000000000..a019ae01de9c --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_vm_managed_compute_deployments.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_vm_managed_compute_deployments.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.managed_compute_deployments.list( + resource_group_name="resourceGroupName", + account_name="accountName", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-03-15-preview/ListVmManagedComputeDeployments.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_workbenches.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_workbenches.py new file mode 100644 index 000000000000..926ec7993ba8 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_workbenches.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_workbenches.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.workbenches.list( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + project_name="myProject", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-03-15-preview/ListWorkbenches.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/patch_managed_network_v2.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/patch_managed_network_v2.py index d9c84c463202..50b9a7b67160 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/patch_managed_network_v2.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/patch_managed_network_v2.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ManagedNetwork/patchManagedNetworkV2.json +# x-ms-original-file: 2026-03-15-preview/ManagedNetwork/patchManagedNetworkV2.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/pause_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/pause_deployment.py index 8a7ff5a1a1c6..f106e630bd3b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/pause_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/pause_deployment.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PauseDeployment.json +# x-ms-original-file: 2026-03-15-preview/PauseDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/post_outbound_rules_v2.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/post_outbound_rules_v2.py index 84711be5342f..84a6f951e562 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/post_outbound_rules_v2.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/post_outbound_rules_v2.py @@ -44,9 +44,10 @@ def main(): } }, ).result() - print(response) + for item in response: + print(item) -# x-ms-original-file: 2026-01-15-preview/ManagedNetwork/postOutboundRulesV2.json +# x-ms-original-file: 2026-03-15-preview/ManagedNetwork/postOutboundRulesV2.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/provision_managed_network.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/provision_managed_network.py index 7d8508896616..410e1b7761ba 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/provision_managed_network.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/provision_managed_network.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ManagedNetwork/provisionManagedNetwork.json +# x-ms-original-file: 2026-03-15-preview/ManagedNetwork/provisionManagedNetwork.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py index ddd7f31cccaa..e6a256d1a577 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-01-15-preview/PurgeDeletedAccount.json +# x-ms-original-file: 2026-03-15-preview/PurgeDeletedAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py index 7f73af5216f7..8a8bf76eed15 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutCommitmentPlan.json +# x-ms-original-file: 2026-03-15-preview/PutCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_compute.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_compute.py new file mode 100644 index 000000000000..ab4f9ca25e7b --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_compute.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python put_compute.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.computes.begin_create_or_update( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + compute_name="myCompute", + resource={ + "identity": {"type": "None"}, + "location": "eastus", + "properties": { + "computeType": "Cluster", + "pools": [ + {"instanceType": "Standard_DS3_v2", "name": "default", "nodeCount": 2, "vmPriority": "Regular"} + ], + "subnetArmId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/default", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-15-preview/PutCompute.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_container_instance_compute.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_container_instance_compute.py new file mode 100644 index 000000000000..6dad6701e077 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_container_instance_compute.py @@ -0,0 +1,60 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python put_container_instance_compute.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.computes.begin_create_or_update( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + compute_name="myContainerInstance", + resource={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {} + }, + }, + "location": "eastus", + "properties": { + "computeType": "ContainerInstance", + "idleTimeBeforeShutdown": "PT30M", + "imageLink": "mcr.microsoft.com/azureml/curated/pytorch-gpu:latest", + "sshSettings": {"adminEnabled": True, "sshPublicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."}, + "targetClusterId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-15-preview/PutContainerInstanceCompute.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_defender_for_ai_setting.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_defender_for_ai_setting.py index 60458d190250..98def5f45671 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_defender_for_ai_setting.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_defender_for_ai_setting.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutDefenderForAISetting.json +# x-ms-original-file: 2026-03-15-preview/PutDefenderForAISetting.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py index 4f99fe2c4747..1977cd24f5ab 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutDeployment.json +# x-ms-original-file: 2026-03-15-preview/PutDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.py index 52daf66ce1b1..83881dc724ff 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutEncryptionScope.json +# x-ms-original-file: 2026-03-15-preview/PutEncryptionScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py index c7232f23a7ec..29c0b60e61a0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutPrivateEndpointConnection.json +# x-ms-original-file: 2026-03-15-preview/PutPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.py index f3a890dd8db1..0c2e3e870aa6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutRaiBlocklist.json +# x-ms-original-file: 2026-03-15-preview/PutRaiBlocklist.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.py index 3e57f70a981b..34a0750d930a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutRaiBlocklistItem.json +# x-ms-original-file: 2026-03-15-preview/PutRaiBlocklistItem.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_external_safety_provider.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_external_safety_provider.py index e837eddce262..5f2fd253d534 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_external_safety_provider.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_external_safety_provider.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutRaiExternalSafetyProvider.json +# x-ms-original-file: 2026-03-15-preview/PutRaiExternalSafetyProvider.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py index 9108bb653c44..987c4e2907c6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py @@ -106,6 +106,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutRaiPolicy.json +# x-ms-original-file: 2026-03-15-preview/PutRaiPolicy.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_tool_label.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_tool_label.py index d9319430dc4b..5b583daed2aa 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_tool_label.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_tool_label.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutRaiToolLabel.json +# x-ms-original-file: 2026-03-15-preview/PutRaiToolLabel.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_topic.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_topic.py index 9b76320b9ed6..b652b5a112ae 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_topic.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_topic.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutRaiTopic.json +# x-ms-original-file: 2026-03-15-preview/PutRaiTopic.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_subscription_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_subscription_rai_policy.py index f2894b6cf560..fc2cdfb53a25 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_subscription_rai_policy.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_subscription_rai_policy.py @@ -104,6 +104,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/PutSubscriptionRaiPolicy.json +# x-ms-original-file: 2026-03-15-preview/PutSubscriptionRaiPolicy.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_workbench.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_workbench.py new file mode 100644 index 000000000000..bcfe094bb086 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_workbench.py @@ -0,0 +1,61 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python put_workbench.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.workbenches.begin_create_or_update( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + project_name="myProject", + workbench_name="myWorkbench", + resource={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {} + }, + }, + "location": "eastus", + "properties": { + "datasetId": "dataset-12345", + "idleTimeBeforeShutdown": "PT30M", + "imageLink": "mcr.microsoft.com/azureml/curated/pytorch-gpu:latest", + "sshSettings": {"adminEnabled": True, "sshPublicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."}, + "targetClusterId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-15-preview/PutWorkbench.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/reconcile_network_security_perimeter_configurations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/reconcile_network_security_perimeter_configurations.py index 3a8f812cce42..108139372498 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/reconcile_network_security_perimeter_configurations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/reconcile_network_security_perimeter_configurations.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ReconcileNetworkSecurityPerimeterConfigurations.json +# x-ms-original-file: 2026-03-15-preview/ReconcileNetworkSecurityPerimeterConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/regenerate_key.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/regenerate_key.py index aca8956c12ee..ffe6a0ebec7e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/regenerate_key.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/regenerate_key.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/RegenerateKey.json +# x-ms-original-file: 2026-03-15-preview/RegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/restart_container_instance_compute.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/restart_container_instance_compute.py new file mode 100644 index 000000000000..88fc9e63f40b --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/restart_container_instance_compute.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python restart_container_instance_compute.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.computes.begin_restart( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + compute_name="myContainerInstance", + ).result() + + +# x-ms-original-file: 2026-03-15-preview/RestartContainerInstanceCompute.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/restart_workbench.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/restart_workbench.py new file mode 100644 index 000000000000..8f95482e1b11 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/restart_workbench.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python restart_workbench.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.workbenches.begin_restart( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + project_name="myProject", + workbench_name="myWorkbench", + ).result() + + +# x-ms-original-file: 2026-03-15-preview/RestartWorkbench.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/resume_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/resume_deployment.py index 56a2c9e97de5..f541c419e2ec 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/resume_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/resume_deployment.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/ResumeDeployment.json +# x-ms-original-file: 2026-03-15-preview/ResumeDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start.py index 443c1bdd2706..e653e737ebe6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start.py @@ -39,6 +39,6 @@ def main(): ) -# x-ms-original-file: 2026-01-15-preview/AgentDeployment/start.json +# x-ms-original-file: 2026-03-15-preview/AgentDeployment/start.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start_container_instance_compute.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start_container_instance_compute.py new file mode 100644 index 000000000000..ad0570ec90c4 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start_container_instance_compute.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python start_container_instance_compute.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.computes.begin_start( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + compute_name="myContainerInstance", + ).result() + + +# x-ms-original-file: 2026-03-15-preview/StartContainerInstanceCompute.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start_workbench.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start_workbench.py new file mode 100644 index 000000000000..42013808e6cb --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/start_workbench.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python start_workbench.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.workbenches.begin_start( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + project_name="myProject", + workbench_name="myWorkbench", + ).result() + + +# x-ms-original-file: 2026-03-15-preview/StartWorkbench.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop.py index 19c63ba5ecf2..806072b4071d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop.py @@ -39,6 +39,6 @@ def main(): ) -# x-ms-original-file: 2026-01-15-preview/AgentDeployment/stop.json +# x-ms-original-file: 2026-03-15-preview/AgentDeployment/stop.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop_container_instance_compute.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop_container_instance_compute.py new file mode 100644 index 000000000000..b4e593b2faba --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop_container_instance_compute.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python stop_container_instance_compute.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.computes.begin_stop( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + compute_name="myContainerInstance", + ).result() + + +# x-ms-original-file: 2026-03-15-preview/StopContainerInstanceCompute.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop_workbench.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop_workbench.py new file mode 100644 index 000000000000..7f2e4b7112ac --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/stop_workbench.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python stop_workbench.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.workbenches.begin_stop( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + project_name="myProject", + workbench_name="myWorkbench", + ).result() + + +# x-ms-original-file: 2026-03-15-preview/StopWorkbench.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/test_rai_external_safety_provider.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/test_rai_external_safety_provider.py index 166a86b5acdc..5066a04a7485 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/test_rai_external_safety_provider.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/test_rai_external_safety_provider.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/TestRaiExternalSafetyProvider.json +# x-ms-original-file: 2026-03-15-preview/TestRaiExternalSafetyProvider.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update.py index e89491b7fc02..72c9cb037159 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/AccountConnection/update.json +# x-ms-original-file: 2026-03-15-preview/AccountConnection/update.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py index aefa0f2c2a29..46f79114f983 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/UpdateAccount.json +# x-ms-original-file: 2026-03-15-preview/UpdateAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_compute.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_compute.py new file mode 100644 index 000000000000..95a8bcc45d92 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_compute.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python update_compute.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.computes.begin_update( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + compute_name="myCompute", + properties={ + "properties": { + "computeType": "Cluster", + "pools": [ + {"instanceType": "Standard_DS3_v2", "name": "default", "nodeCount": 4, "vmPriority": "Regular"} + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-15-preview/UpdateCompute.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_defender_for_ai_setting.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_defender_for_ai_setting.py index 4c5747d6ca0d..1309e1d0fb39 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_defender_for_ai_setting.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_defender_for_ai_setting.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/UpdateDefenderForAISetting.json +# x-ms-original-file: 2026-03-15-preview/UpdateDefenderForAISetting.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py index 1b8264ab5e21..18f03394b5d4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/UpdateDeployment.json +# x-ms-original-file: 2026-03-15-preview/UpdateDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_managed_compute_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_managed_compute_deployment.py new file mode 100644 index 000000000000..ee67372e067d --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_managed_compute_deployment.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python update_managed_compute_deployment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.managed_compute_deployments.begin_update( + resource_group_name="resourceGroupName", + account_name="accountName", + deployment_name="gpt-oss-120b-gpu", + properties={"sku": {"capacity": 2, "name": "GlobalManagedCompute"}}, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-15-preview/UpdateManagedComputeDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_projects.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_projects.py index 4553e127b6c5..d0e109579a29 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_projects.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_projects.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/UpdateProjects.json +# x-ms-original-file: 2026-03-15-preview/UpdateProjects.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_quota_tier.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_quota_tier.py index 4f91be455314..49081fe3f67a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_quota_tier.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_quota_tier.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/UpdateQuotaTier.json +# x-ms-original-file: 2026-03-15-preview/UpdateQuotaTier.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py index b1c24bc3f049..212e49bd964d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-01-15-preview/UpdateSharedCommitmentPlan.json +# x-ms-original-file: 2026-03-15-preview/UpdateSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_vm_managed_compute_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_vm_managed_compute_deployment.py new file mode 100644 index 000000000000..906631b24599 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_vm_managed_compute_deployment.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python update_vm_managed_compute_deployment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.managed_compute_deployments.begin_update( + resource_group_name="resourceGroupName", + account_name="accountName", + deployment_name="gpt-oss-120b-byoc", + properties={"sku": {"capacity": 2, "name": "VmManagedCompute"}}, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-15-preview/UpdateVmManagedComputeDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_workbench.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_workbench.py new file mode 100644 index 000000000000..c5be5ecf462e --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_workbench.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python update_workbench.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.workbenches.begin_update( + resource_group_name="rgcognitiveservices", + account_name="myAccount", + project_name="myProject", + workbench_name="myWorkbench", + properties={ + "properties": { + "datasetId": "dataset-67890", + "idleTimeBeforeShutdown": "PT1H", + "imageLink": "mcr.microsoft.com/azureml/curated/pytorch-gpu:v2", + "sshSettings": {"adminEnabled": True, "sshPublicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQ..."}, + "targetClusterId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rgcognitiveservices/providers/Microsoft.CognitiveServices/accounts/myAccount/computes/myCluster", + }, + "tags": {"environment": "production"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-15-preview/UpdateWorkbench.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations.py index a07ca2d9d259..6273668d3175 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations.py @@ -443,3 +443,46 @@ def test_accounts_list_models(self, resource_group): result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_accounts_evaluate_deployment_policies(self, resource_group): + response = self.client.accounts.evaluate_deployment_policies( + resource_group_name=resource_group.name, + account_name="str", + body={ + "deployments": [ + { + "name": "str", + "properties": { + "model": { + "callRateLimit": { + "count": 0.0, + "renewalPeriod": 0.0, + "rules": [ + { + "count": 0.0, + "dynamicThrottlingEnabled": bool, + "key": "str", + "matchPatterns": [{"method": "str", "path": "str"}], + "minCount": 0.0, + "renewalPeriod": 0.0, + } + ], + }, + "format": "str", + "name": "str", + "publisher": "str", + "source": "str", + "sourceAccount": "str", + "version": "str", + }, + "raiPolicyName": "str", + }, + } + ] + }, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations_async.py index eaaf1d936f87..bc0ac7e6e109 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations_async.py @@ -458,3 +458,46 @@ async def test_accounts_list_models(self, resource_group): result = [r async for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_accounts_evaluate_deployment_policies(self, resource_group): + response = await self.client.accounts.evaluate_deployment_policies( + resource_group_name=resource_group.name, + account_name="str", + body={ + "deployments": [ + { + "name": "str", + "properties": { + "model": { + "callRateLimit": { + "count": 0.0, + "renewalPeriod": 0.0, + "rules": [ + { + "count": 0.0, + "dynamicThrottlingEnabled": bool, + "key": "str", + "matchPatterns": [{"method": "str", "path": "str"}], + "minCount": 0.0, + "renewalPeriod": 0.0, + } + ], + }, + "format": "str", + "name": "str", + "publisher": "str", + "source": "str", + "sourceAccount": "str", + "version": "str", + }, + "raiPolicyName": "str", + }, + } + ] + }, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_computes_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_computes_operations.py new file mode 100644 index 000000000000..bf993c613879 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_computes_operations.py @@ -0,0 +1,162 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementComputesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_computes_get(self, resource_group): + response = self.client.computes.get( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_computes_begin_create_or_update(self, resource_group): + response = self.client.computes.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + resource={ + "properties": "compute_properties", + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "location": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_computes_begin_update(self, resource_group): + response = self.client.computes.begin_update( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + properties={ + "properties": "compute_properties", + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "location": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_computes_begin_delete(self, resource_group): + response = self.client.computes.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_computes_list(self, resource_group): + response = self.client.computes.list( + resource_group_name=resource_group.name, + account_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_computes_begin_start(self, resource_group): + response = self.client.computes.begin_start( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_computes_begin_stop(self, resource_group): + response = self.client.computes.begin_stop( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_computes_begin_restart(self, resource_group): + response = self.client.computes.begin_restart( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_computes_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_computes_operations_async.py new file mode 100644 index 000000000000..a16dc0d32b24 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_computes_operations_async.py @@ -0,0 +1,175 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices.aio import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementComputesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_computes_get(self, resource_group): + response = await self.client.computes.get( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_computes_begin_create_or_update(self, resource_group): + response = await ( + await self.client.computes.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + resource={ + "properties": "compute_properties", + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "location": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_computes_begin_update(self, resource_group): + response = await ( + await self.client.computes.begin_update( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + properties={ + "properties": "compute_properties", + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "location": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_computes_begin_delete(self, resource_group): + response = await ( + await self.client.computes.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_computes_list(self, resource_group): + response = self.client.computes.list( + resource_group_name=resource_group.name, + account_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_computes_begin_start(self, resource_group): + response = await ( + await self.client.computes.begin_start( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_computes_begin_stop(self, resource_group): + response = await ( + await self.client.computes.begin_stop( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_computes_begin_restart(self, resource_group): + response = await ( + await self.client.computes.begin_restart( + resource_group_name=resource_group.name, + account_name="str", + compute_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations.py index 60ce1b67568d..498e6a0be709 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations.py @@ -18,6 +18,14 @@ class TestCognitiveServicesManagementDeletedAccountsOperations(AzureMgmtRecorded def setup_method(self, method): self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deleted_accounts_list(self, resource_group): + response = self.client.deleted_accounts.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_deleted_accounts_get(self, resource_group): @@ -41,11 +49,3 @@ def test_deleted_accounts_begin_purge(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_deleted_accounts_list(self, resource_group): - response = self.client.deleted_accounts.list() - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations_async.py index 5392cc91e0a6..6ec70bb4666c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations_async.py @@ -19,6 +19,14 @@ class TestCognitiveServicesManagementDeletedAccountsOperationsAsync(AzureMgmtRec def setup_method(self, method): self.client = self.create_mgmt_client(CognitiveServicesManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deleted_accounts_list(self, resource_group): + response = self.client.deleted_accounts.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_deleted_accounts_get(self, resource_group): @@ -44,11 +52,3 @@ async def test_deleted_accounts_begin_purge(self, resource_group): # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_deleted_accounts_list(self, resource_group): - response = self.client.deleted_accounts.list() - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_capacities_operations.py new file mode 100644 index 000000000000..6efb510933f0 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_capacities_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementManagedComputeCapacitiesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_compute_capacities_list(self, resource_group): + response = self.client.managed_compute_capacities.list( + offer="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_capacities_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_capacities_operations_async.py new file mode 100644 index 000000000000..ac1705f4bf4a --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_capacities_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices.aio import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementManagedComputeCapacitiesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_compute_capacities_list(self, resource_group): + response = self.client.managed_compute_capacities.list( + offer="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_deployments_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_deployments_operations.py new file mode 100644 index 000000000000..d92c4fa59006 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_deployments_operations.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementManagedComputeDeploymentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_compute_deployments_get(self, resource_group): + response = self.client.managed_compute_deployments.get( + resource_group_name=resource_group.name, + account_name="str", + deployment_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_compute_deployments_begin_create_or_update(self, resource_group): + response = self.client.managed_compute_deployments.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + deployment_name="str", + resource={ + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "model": "str", + "acceleratorType": "str", + "acceleratorsPerInstance": 0, + "computeId": "str", + "deploymentTemplate": "str", + "priority": "str", + "provisioningDetails": {"lastOperationTimestamp": "2020-02-20 00:00:00", "message": "str"}, + "provisioningState": "str", + "routes": {"chatCompletionsScoringPath": "str", "messagesApiScoringPath": "str", "swagger": "str"}, + "totalAccelerators": 0, + "versionUpgradeOption": "str", + }, + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_compute_deployments_begin_update(self, resource_group): + response = self.client.managed_compute_deployments.begin_update( + resource_group_name=resource_group.name, + account_name="str", + deployment_name="str", + properties={"sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}}, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_compute_deployments_begin_delete(self, resource_group): + response = self.client.managed_compute_deployments.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + deployment_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_compute_deployments_list(self, resource_group): + response = self.client.managed_compute_deployments.list( + resource_group_name=resource_group.name, + account_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_deployments_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_deployments_operations_async.py new file mode 100644 index 000000000000..3a6b037b65f7 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_deployments_operations_async.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices.aio import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementManagedComputeDeploymentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_compute_deployments_get(self, resource_group): + response = await self.client.managed_compute_deployments.get( + resource_group_name=resource_group.name, + account_name="str", + deployment_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_compute_deployments_begin_create_or_update(self, resource_group): + response = await ( + await self.client.managed_compute_deployments.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + deployment_name="str", + resource={ + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "model": "str", + "acceleratorType": "str", + "acceleratorsPerInstance": 0, + "computeId": "str", + "deploymentTemplate": "str", + "priority": "str", + "provisioningDetails": {"lastOperationTimestamp": "2020-02-20 00:00:00", "message": "str"}, + "provisioningState": "str", + "routes": { + "chatCompletionsScoringPath": "str", + "messagesApiScoringPath": "str", + "swagger": "str", + }, + "totalAccelerators": 0, + "versionUpgradeOption": "str", + }, + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_compute_deployments_begin_update(self, resource_group): + response = await ( + await self.client.managed_compute_deployments.begin_update( + resource_group_name=resource_group.name, + account_name="str", + deployment_name="str", + properties={"sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}}, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_compute_deployments_begin_delete(self, resource_group): + response = await ( + await self.client.managed_compute_deployments.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + deployment_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_compute_deployments_list(self, resource_group): + response = self.client.managed_compute_deployments.list( + resource_group_name=resource_group.name, + account_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_usages_operation_group_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_usages_operation_group_operations.py new file mode 100644 index 000000000000..a8dd6b2c3ae8 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_usages_operation_group_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementManagedComputeUsagesOperationGroupOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_compute_usages_operation_group_list(self, resource_group): + response = self.client.managed_compute_usages_operation_group.list( + location="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_usages_operation_group_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_usages_operation_group_operations_async.py new file mode 100644 index 000000000000..86cb34988f0e --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_managed_compute_usages_operation_group_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices.aio import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementManagedComputeUsagesOperationGroupOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_compute_usages_operation_group_list(self, resource_group): + response = self.client.managed_compute_usages_operation_group.list( + location="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_outbound_rules_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_outbound_rules_operations.py index 6f3a5308cad5..ef50d908da55 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_outbound_rules_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_outbound_rules_operations.py @@ -49,6 +49,6 @@ def test_outbound_rules_begin_post(self, resource_group): "type": "str", }, ).result() # call '.result()' to poll until service return final result - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_outbound_rules_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_outbound_rules_operations_async.py index 1d4f4f5f4006..ef752ccebf67 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_outbound_rules_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_outbound_rules_operations_async.py @@ -52,6 +52,6 @@ async def test_outbound_rules_begin_post(self, resource_group): }, ) ).result() # call '.result()' to poll until service return final result - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations.py index b9bb91bc40a0..e3cec3f03c39 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations.py @@ -54,7 +54,6 @@ def test_rai_policies_create_or_update(self, resource_group): } ], "customBlocklists": [{"blocking": bool, "blocklistName": "str", "source": "str"}], - "customTopics": [{"blocking": bool, "source": "str", "topicName": "str"}], "mode": "str", "safetyProviders": [{"blocking": bool, "safetyProviderName": "str", "source": "str"}], "type": "str", diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations_async.py index c5370088bf72..2860bbbf2d30 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations_async.py @@ -55,7 +55,6 @@ async def test_rai_policies_create_or_update(self, resource_group): } ], "customBlocklists": [{"blocking": bool, "blocklistName": "str", "source": "str"}], - "customTopics": [{"blocking": bool, "source": "str", "topicName": "str"}], "mode": "str", "safetyProviders": [{"blocking": bool, "safetyProviderName": "str", "source": "str"}], "type": "str", diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_subscription_rai_policy_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_subscription_rai_policy_operations.py index f0cd85628257..08265cd7ec72 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_subscription_rai_policy_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_subscription_rai_policy_operations.py @@ -50,7 +50,6 @@ def test_subscription_rai_policy_create_or_update(self, resource_group): } ], "customBlocklists": [{"blocking": bool, "blocklistName": "str", "source": "str"}], - "customTopics": [{"blocking": bool, "source": "str", "topicName": "str"}], "mode": "str", "safetyProviders": [{"blocking": bool, "safetyProviderName": "str", "source": "str"}], "type": "str", diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_subscription_rai_policy_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_subscription_rai_policy_operations_async.py index 9704ecf72200..55f1a4ba8b7c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_subscription_rai_policy_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_subscription_rai_policy_operations_async.py @@ -51,7 +51,6 @@ async def test_subscription_rai_policy_create_or_update(self, resource_group): } ], "customBlocklists": [{"blocking": bool, "blocklistName": "str", "source": "str"}], - "customTopics": [{"blocking": bool, "source": "str", "topicName": "str"}], "mode": "str", "safetyProviders": [{"blocking": bool, "safetyProviderName": "str", "source": "str"}], "type": "str", diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_workbenches_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_workbenches_operations.py new file mode 100644 index 000000000000..1d87b50cf5f9 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_workbenches_operations.py @@ -0,0 +1,206 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementWorkbenchesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workbenches_get(self, resource_group): + response = self.client.workbenches.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workbenches_begin_create_or_update(self, resource_group): + response = self.client.workbenches.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + resource={ + "properties": { + "imageLink": "str", + "targetClusterId": "str", + "connectivityEndpoints": {"publicIpAddress": "str", "sshPort": 0}, + "creationTime": "2020-02-20 00:00:00", + "datasetId": "str", + "errors": [ + { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + } + ], + "idleTimeBeforeShutdown": "str", + "provisioningState": "str", + "sshSettings": {"adminEnabled": bool, "sshPublicKey": "str"}, + "webEndpoint": "str", + }, + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workbenches_begin_update(self, resource_group): + response = self.client.workbenches.begin_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + properties={ + "properties": { + "imageLink": "str", + "targetClusterId": "str", + "connectivityEndpoints": {"publicIpAddress": "str", "sshPort": 0}, + "creationTime": "2020-02-20 00:00:00", + "datasetId": "str", + "errors": [ + { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + } + ], + "idleTimeBeforeShutdown": "str", + "provisioningState": "str", + "sshSettings": {"adminEnabled": bool, "sshPublicKey": "str"}, + "webEndpoint": "str", + }, + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workbenches_begin_delete(self, resource_group): + response = self.client.workbenches.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workbenches_list(self, resource_group): + response = self.client.workbenches.list( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workbenches_begin_start(self, resource_group): + response = self.client.workbenches.begin_start( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workbenches_begin_stop(self, resource_group): + response = self.client.workbenches.begin_stop( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workbenches_begin_restart(self, resource_group): + response = self.client.workbenches.begin_restart( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_workbenches_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_workbenches_operations_async.py new file mode 100644 index 000000000000..367d05b3002c --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_workbenches_operations_async.py @@ -0,0 +1,219 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices.aio import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementWorkbenchesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workbenches_get(self, resource_group): + response = await self.client.workbenches.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workbenches_begin_create_or_update(self, resource_group): + response = await ( + await self.client.workbenches.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + resource={ + "properties": { + "imageLink": "str", + "targetClusterId": "str", + "connectivityEndpoints": {"publicIpAddress": "str", "sshPort": 0}, + "creationTime": "2020-02-20 00:00:00", + "datasetId": "str", + "errors": [ + { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + } + ], + "idleTimeBeforeShutdown": "str", + "provisioningState": "str", + "sshSettings": {"adminEnabled": bool, "sshPublicKey": "str"}, + "webEndpoint": "str", + }, + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workbenches_begin_update(self, resource_group): + response = await ( + await self.client.workbenches.begin_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + properties={ + "properties": { + "imageLink": "str", + "targetClusterId": "str", + "connectivityEndpoints": {"publicIpAddress": "str", "sshPort": 0}, + "creationTime": "2020-02-20 00:00:00", + "datasetId": "str", + "errors": [ + { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + } + ], + "idleTimeBeforeShutdown": "str", + "provisioningState": "str", + "sshSettings": {"adminEnabled": bool, "sshPublicKey": "str"}, + "webEndpoint": "str", + }, + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workbenches_begin_delete(self, resource_group): + response = await ( + await self.client.workbenches.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workbenches_list(self, resource_group): + response = self.client.workbenches.list( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workbenches_begin_start(self, resource_group): + response = await ( + await self.client.workbenches.begin_start( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workbenches_begin_stop(self, resource_group): + response = await ( + await self.client.workbenches.begin_stop( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workbenches_begin_restart(self, resource_group): + response = await ( + await self.client.workbenches.begin_restart( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + workbench_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/pyproject.toml b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/pyproject.toml index b82ead8306cf..da5abdfd668f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/pyproject.toml +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/pyproject.toml @@ -17,13 +17,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = [ "azure", "azure sdk", diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/tsp-location.yaml b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/tsp-location.yaml index 4cf3bf1aba5f..eccc18ac2de9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/tsp-location.yaml +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/cognitiveservices/CognitiveServices.Management -commit: 2f2a6cd8118938c1ba3f65d4e09a550d4504620f +commit: 182eacfaa4691f06fb161722f13f4d99e9b26a0a repo: Azure/azure-rest-api-specs additionalDirectories: